unit WebTabsPacket; interface uses BasePacket, RealICQModel; type TWebTabsPacket = class(TBasePacket) private FWebTabRecords: array of TWebTabRecord; public class function MajorProto: Byte; override; class function UnPack(const Data: Array of Byte): TBasePacket; override; function Pack(var buffer: TByte): Boolean; override; function Dispose: Boolean; override; end; implementation { TWebTabsPacket } function TWebTabsPacket.Dispose: Boolean; begin end; class function TWebTabsPacket.MajorProto: Byte; begin Result := $28; end; function TWebTabsPacket.Pack(var buffer: TByte): Boolean; begin end; class function TWebTabsPacket.UnPack(const Data: array of Byte): TBasePacket; var nIndex, iLoop, jLoop: Integer; WebTabCount: Byte; WebTabs: String; WebTabList: TStringList; WebTabRecord: TWebTabRecord; begin nIndex := 0; //取 (3)标签数量 1byte CopyMemory(@WebTabCount, @Data[nIndex], 1); Inc(nIndex, 1); //取 (4)消息内容 动态长度 SetLength(WebTabs, Length(Data) - nIndex); CopyMemory(PChar(WebTabs), @Data[nIndex], Length(Data) - nIndex); //Inc(nIndex, Length(Data) - nIndex); WebTabList := SplitString(WebTabs, Chr(10)); try SetLength(WebTabRecords, WebTabCount); jLoop := 0; for iLoop := 0 to WebTabCount - 1 do begin WebTabRecord := TWebTabRecord.Create; WebTabRecord.ID := WebTabList.Strings[jLoop]; Inc(jLoop); WebTabRecord.Name := WebTabList.Strings[jLoop]; Inc(jLoop); WebTabRecord.Icon := WebTabList.Strings[jLoop]; Inc(jLoop); WebTabRecord.Method := WebTabList.Strings[jLoop]; Inc(jLoop); WebTabRecord.PostFields := WebTabList.Strings[jLoop]; Inc(jLoop); WebTabRecord.URL := WebTabList.Strings[jLoop]; Inc(jLoop); WebTabRecord.MustShow := WebTabList.Strings[jLoop] = '1'; Inc(jLoop); WebTabRecord.Content := WebTabList.Strings[jLoop]; Inc(jLoop); SendDownloadFileRequest(WebTabRecord.Icon); WebTabRecords[iLoop] := WebTabRecord; end; finally FreeAndNil(WebTabList); end; if WebTabCount > 0 then begin CallServerDBProcedure('GetWebTabAcounts', ''); Sleep(200); end; DoGetWebTabs(WebTabCount, WebTabRecords); end; end.