📄 icqworks.pas
字号:
packet contains the same group numbers as was in the SRV_RATES
packet and is an acknowledgement of their receipt.}
procedure CreateCLI_ACKRATES(Pkt: PRawPkt; var Seq: Word);
begin
PktInit(Pkt, 2, Seq); //Channel 2
PktSnac(Pkt, $01, $08, 0, 0); //Type x01/x08, ID x0000, Flags 0
PktInt(Pkt, $0001, 2); //Group1 - 0x0001
PktInt(Pkt, $0002, 2); //Group2 - 0x0002
PktInt(Pkt, $0003, 2); //Group3 - 0x0003
PktInt(Pkt, $0004, 2); //Group4 - 0x0004
PktInt(Pkt, $0005, 2); //Group5 - 0x0005
PktFinal(Pkt); //Finalize packet
end;
{This command requests from the server certain information
about the client that is stored on the server}
procedure CreateCLI_REQINFO(Pkt: PRawPkt; var Seq: Word);
begin
PktInit(Pkt, 2, Seq); //Channel 2
PktSnac(Pkt, $01, $0E, 0, 0); //Snac: Type x01/x0E, ID x0000, Flags 0
PktFinal(Pkt); //Finalize packet
end;
{Unknown}
procedure CreateCLI_REQUNKNOWN(Pkt: PRawPkt; var Seq: Word);
begin
PktInit(Pkt, 2, Seq); //Channel 2
PktSnac(Pkt, $13, $02, 0, 0); //Snac: Type x13/x02, ID x0000, Flags 0
PktFinal(Pkt); //Finalize packet
end;
{This command, like CLI_CHECKROSTER, requests the server side contact list.
The difference between CLI_REQROSTER and CLI_CHECKROSTER is that CLI_REQROSTER
has no parameters, and always causes SRV_REPLYROSTER (rather than
SRV_REPLYROSTEROK). My guess is that CLI_REQROSTER is sent instead of
CLI_CHECKROSTER when the client does not have a cached copy of the contact
list; ie, the first time a user logs in with a particular client.}
procedure CreateCLI_REQROSTER(Pkt: PRawPkt; var Seq: Word);
begin
PktInit(Pkt, 2, Seq); //Channel 2
PktSnac(Pkt, $13, $04, $00010004, 0); //Snac: Type x13/x04, ID x00010004, Flags 0
PktFinal(Pkt); //Finalize packet
end;
{Synchronizes the server side contact list with the client's.
If the passed values match those on the server, SNAC(13,F)
SRV_REPLYROSTEROK will be returned. If the values are older
than what is on the server then SNAC(13,6) SRV_REPLYROSTER will
be returned.}
procedure CreateCLI_CHECKROSTER(Pkt: PRawPkt; var Seq: Word);
begin
PktInit(Pkt, 2, Seq); //Channel 2
PktSnac(Pkt, $13, $05, $00010005, 0); //Snac: Type x13/x05, ID x00010005, Flags 0
PktInt(Pkt, $3C36D709, 4); //time(NULL), The last modification time of the server side contact list.
PktInt(Pkt, $0000, 2); //Size of server side contact list.
PktFinal(Pkt); //Finalize packet
end;
{Request rights information for location service. This is from
the OSCAR document.}
procedure CreateCLI_REQLOCATION(Pkt: PRawPkt; var Seq: Word);
begin
PktInit(Pkt, 2, Seq); //Channel 2
PktSnac(Pkt, $02, $02, 0, 0); //Snac: Type x02/x02, ID x0000, Flags 0
PktFinal(Pkt); //Finalize packet
end;
{Request rights information for buddy service. This from the OSCAR document.}
procedure CreateCLI_REQBUDDY(Pkt: PRawPkt; var Seq: Word);
begin
PktInit(Pkt, 2, Seq); //Channel 2
PktSnac(Pkt, $03, $02, 0, 0); //Snac: Type x03/x02, ID x0000, Flags 0
PktFinal(Pkt); //Finalize packet
end;
{Request rights information for ICBM (instant messages) operations. This
from the OSCAR document.}
procedure CreateCLI_REQICBM(Pkt: PRawPkt; var Seq: Word);
begin
PktInit(Pkt, 2, Seq); //Channel 2
PktSnac(Pkt, $04, $04, 0, 0); //Snac: Type x04/x04, ID x0000, Flags 0
PktFinal(Pkt); //Finalize packet
end;
{Request BOS rights. This from the OSCAR document.}
procedure CreateCLI_REQBOS(Pkt: PRawPkt; var Seq: Word);
begin
PktInit(Pkt, 2, Seq); //Channel 2
PktSnac(Pkt, $09, $02, 0, 0); //Snac: Type x09/x02, ID x0000, Flags 0
PktFinal(Pkt); //Finalize packet
end;
{This packet sends the client's capabilities information to the server.}
procedure CreateCLI_SETUSERINFO(Pkt: PRawPkt; var Seq: Word);
const
caps: array[0..$40 - 1] of Byte = (
$09, $46, $13, $49, $4C, $7F, $11, $D1, $82, $22, $44, $45, $53, $54, $00, $00,
$97, $B1, $27, $51, $24, $3C, $43, $34, $AD, $22, $D6, $AB, $F7, $3F, $14, $92,
$2E, $7A, $64, $75, $FA, $DF, $4D, $C8, $88, $6F, $EA, $35, $95, $FD, $B6, $DF,
$09, $46, $13, $44, $4C, $7F, $11, $D1, $82, $22, $44, $45, $53, $54, $00, $00
);
begin
PktInit(Pkt, 2, Seq); //Channel 2
PktSnac(Pkt, $02, $04, 0, 0); //Snac: Type x02/x04, ID x0000, Flags 0
PktTLV(Pkt, 5, Length(caps), @caps); //Client's capabilities
PktFinal(Pkt); //Finalize packet
end;
{This packet seems to change some of the values passed from the server
in SRV_REPLYICBM SNAC(4,5).}
procedure CreateCLI_SETICBM(Pkt: PRawPkt; var Seq: Word);
begin
PktInit(Pkt, 2, Seq); //Channel 2
PktSnac(Pkt, $04, $02, 0, 0); //Snac: Type x04/x02, ID x0000, Flags 0
PktInt(Pkt, 0, 4); //0, Unknown; Numbers similar to x04/x05
PktInt(Pkt, $0003, 2); //3, Unknown
PktInt(Pkt, $1F40, 2); //8000, Unknown
PktInt(Pkt, $03E7, 2); //999, Unknown
PktInt(Pkt, $03E7, 2); //999, Unknown
PktInt(Pkt, 0, 4); //0, Unknown
PktFinal(Pkt); //Finalize packet
end;
{This sets the clients online status code and some other direct client
to client information as well. Used in login sequence.}
procedure CreateCLI_SETSTATUS(Pkt: PRawPkt; Status: LongWord; IP: LongInt; Port: Word; Cookie: LongWord; ProxyType: TProxyType; var Seq: Word);
var
lpkt: TRawPkt;
begin
PktInit(Pkt, 2, Seq); //Channel 2
PktSnac(Pkt, $01, $1E, 0, 0); //Snac: Type x01/x1E, ID x0000, Flags 0
PktTLV(Pkt, $06, 4, Status); //TLV(06) Status
PktTLV(Pkt, $08, 2, 0); //TLV(08) Error code
PktInitRaw(@lpkt);
//{$R-}
PktInt(@lpkt, Swap32(IP), 4); //The client computer's local IP address.(internal)
//{$R+}
PktInt(@lpkt, Port, 4); //This is the port to connect with when making client to client connections.
if ProxyType = P_NONE then
PktInt(@lpkt, $04, 1) //01 = Firewall (or HTTPS proxy); 02 = SOCKS4/5 proxy; 04 = 'normal' connection
else if (ProxyType = P_SOCKS4) or (ProxyType = P_SOCKS5) then
PktInt(@lpkt, $02, 1);
PktInt(@lpkt, $0008, 2); //The highest client to client protocol version this client uses.
PktInt(@lpkt, Cookie, 4); //Probably a direct client to client connection cookie.
PktInt(@lpkt, $0000, 2); //0, Unknown
PktInt(@lpkt, $0050, 2); //80, Unknown
PktInt(@lpkt, $0000, 2); //0, Unknown
PktInt(@lpkt, $0003, 2); //Count: 3
//Theese are used in miranda-icq
//PktInt(@lpkt, $FFFFFFFF, 4); //time(NULL): Wed Sep 19 13:53:51 2001
//PktInt(@lpkt, $00010201, 4); //time(NULL): Thu Nov 08 22:54:27 2001
//PktInt(@lpkt, $3B7248ED, 4); //time(NULL): Thu Nov 08 22:49:54 2001
PktInt(@lpkt, $00000000, 4); //time(NULL)
PktInt(@lpkt, $00000000, 4); //time(NULL)
PktInt(@lpkt, $00000000, 4); //time(NULL)
PktInt(@lpkt, $0000, 2); //0, Unknown
PktTLV(Pkt, $0C, lpkt.len, @lpkt.Data); //TLV(0C)
PktFinal(Pkt); //Finalize packet
end;
{Set client's online status after login.}
procedure CreateCLI_SETSTATUS_SHORT(Pkt: PRawPkt; Status: LongWord; var Seq: Word);
begin
PktInit(Pkt, 2, Seq); //Channel 2
PktSnac(Pkt, $01, $1E, 0, 0); //Snac: Type x01/x1E, ID x0000, Flags 0
PktTLV(Pkt, $06, 4, Status); //TLV(06) Status
PktFinal(Pkt); //Finalize packet
end;
{This packet seems to pass the SNAC Families and their versions
along with some unknown other information back to the server.}
procedure CreateCLI_READY(Pkt: PRawPkt; var Seq: Word);
const
buf: array[0..79] of Byte = (
$00, $01, $00, $03, $01, $10, $04, $7B,
$00, $13, $00, $02, $01, $10, $04, $7B,
$00, $02, $00, $01, $01, $01, $04, $7B,
$00, $03, $00, $01, $01, $10, $04, $7B,
$00, $15, $00, $01, $01, $10, $04, $7B,
$00, $04, $00, $01, $01, $10, $04, $7B,
$00, $06, $00, $01, $01, $10, $04, $7B,
$00, $09, $00, $01, $01, $10, $04, $7B,
$00, $0A, $00, $01, $01, $10, $04, $7B,
$00, $0B, $00, $01, $01, $10, $04, $7B
);
begin
PktInit(Pkt, 2, Seq); //Channel 2
PktSnac(Pkt, $01, $02, 0, 0); //Snac: Type x01/x02, ID x0000, Flags 0
PktAddArrBuf(Pkt, @buf, SizeOf(buf)); //Number sequence matches SNAC(x01/x17)
PktFinal(Pkt); //Finalize packet
end;
{This packet seems to act as an interface between the AIM OSCAR-based server
and the old original ICQ server database.}
procedure CreateCLI_TOICQSRV(Pkt: PRawPkt; UIN: LongWord; Command: Word; Data: Pointer; DataLen: LongWord; var Seq, Seq2: Word);
var
lpkt: TRawPkt;
len: Word;
begin
PktInit(Pkt, 2, Seq); //Channel 2
if Seq2 = 2 then
PktSnac(Pkt, $15, $02, $00010002, 0) //Snac: Type x15/x02, ID x00010002, Flags 0
else
PktSnac(Pkt, $15, $02, $00000000, 0); //Snac: Type x15/x02, ID x00000000, Flags 0
PktInitRaw(@lpkt);
Inc(lpkt.Len, 2);
PktInt(@lpkt, Swap32(UIN), 4);
PktInt(@lpkt, Swap16(Command), 2);
PktInt(@lpkt, Swap16(Seq2), 2);
PktAddArrBuf(@lpkt, Data, DataLen);
//Store remaining size
len := lpkt.Len;
lpkt.Len := 0;
PktLInt(@lpkt, len - 2, 2);
lpkt.Len := len;
//--
PktTLV(Pkt, 1, lpkt.Len, @lpkt);
PktFinal(Pkt);
Inc(Seq2);
end;
{This is sent at login and when you add a new user to your
contact list. It contains a list of all the uin's in you're
contact list. ****May be repeated multiple times****}
procedure CreateCLI_ADDCONTACT(Pkt: PRawPkt; UIN: String; var Seq: Word);
begin
PktInit(Pkt, 2, Seq); //Channel 2
PktSnac(Pkt, $03, $04, 0, 0); //Snac: Type x03/x04, ID x0000, Flags 0
PktLStr(Pkt, UIN); //UIN
PktFinal(Pkt); //Finalize packet
end;
{Sent to remove contacts from contact list.}
procedure CreateCLI_REMOVECONTACT(Pkt: PRawPkt; UIN: LongWord; var Seq: Word);
begin
PktInit(Pkt, 2, Seq); //Channel 2
PktSnac(Pkt, $03, $05, 0, 0); //Snac: Type x03/x05, ID x0000, Flags 0
PktLStr(Pkt, IntToStr(UIN)); //List of UINs to remove from contact list.
PktFinal(Pkt); //Finalize packet
end;
{Add UINs to your visible list.}
procedure CreateCLI_ADDVISIBLE(Pkt: PRawPkt; UINs: TStrings; var Seq: Word);
var
i: Word;
begin
PktInit(Pkt, 2, Seq); //Channel 2
PktSnac(Pkt, $09, $05, 0, 0); //Snac: Type x09/x05, ID x0000, Flags 0
if UINs.Count > 0 then
for i := 0 to UINs.Count - 1 do
PktLStr(Pkt, UINs.Strings[i]);
PktFinal(Pkt); //Finalize packet
end;
{Remove UINs from your visible list.}
procedure CreateCLI_REMVISIBLE(Pkt: PRawPkt; UIN: LongWord; var Seq: Word);
begin
PktInit(Pkt, 2, Seq); //Channel 2
PktSnac(Pkt, $09, $06, 0, 0); //Snac: Type x09/x05, ID x0000, Flags 0
PktLStr(Pkt, IntToStr(UIN)); //The UINs to remove from your invisible list.
PktFinal(Pkt); //Finalize packet
end;
{List of UINs to add to invisible list. ****May be repeated multiple times****}
procedure CreateCLI_ADDINVISIBLE(Pkt: PRawPkt; UINs: TStrings; var Seq: Word);
var
i: Word;
begin
PktInit(Pkt, 2, Seq); //Channel 2
PktSnac(Pkt, $09, $07, 0, 0); //Snac: Type x09/x05, ID x0000, Flags 0
if UINs.Count > 0 then
for i := 0 to UINs.Count - 1 do
PktLStr(Pkt, UINs.Strings[i]);
PktFinal(Pkt); //Finalize packet
end;
{Remove UINs from your invisible list...}
procedure CreateCLI_REMINVISIBLE(Pkt: PRawPkt; UIN: LongWord; var Seq: Word);
begin
PktInit(Pkt, 2, Seq); //Channel 2
PktSnac(Pkt, $09, $08, 0, 0); //Snac: Type x09/x05, ID x0000, Flags 0
PktLStr(Pkt, IntToStr(UIN)); //The UINs to remove from your invisible list.
PktFinal(Pkt); //Finalize packet
end;
{Acknowledge the receipt of all offline messages.}
procedure CreateCLI_ACKOFFLINEMSGS(Pkt: PRawPkt; UIN: LongWord; var Seq, Seq2: Word);
begin
CreateCLI_TOICQSRV(Pkt, UIN, CMD_ACKOFFMSG, nil, 0, Seq, Seq2);
end;
{Send a message.}
procedure CreateCLI_SENDMSG(Pkt: PRawPkt; ITime, IRandom, UIN: LongWord; const Msg: String; var Seq: Word);
var
lpkt: TRawPkt;
pmsg: TRawPkt;
begin
PktInit(Pkt, 2, Seq); //Channel 2
PktSnac(Pkt, $04, $06, 0, 0); //Snac: Type x04/x06, ID x0000, Flags 0
PktInt(Pkt, ITime, 4); //MID
PktInt(Pkt, IRandom, 4); //MID
PktInt(Pkt, 1, 2); //type, 1 - text messages
PktLStr(Pkt, UIN); //The UIN to send the message to.
PktInitRaw(@lpkt); //Allocate packet for incapsulated TLV(02)
PktTLV(@lpkt, 1281, 1, 1); //Unknown: 0x1 = 1.
PktInitRaw(@pmsg); //Allocate packet for incapsulated TLV(257)
PktInt(@pmsg, 0, 4); //Unknown: empty. vICQ uses 00 00 ff ff.
PktStr(@pmsg, Msg); //Finally, the message to send.
PktTLV(@lpkt, 257, pmsg.Len, @pmsg); //Add TLV(257)
PktTLV(Pkt, 2, lpkt.Len, @lpkt); //Add TLV(2)
PktTLV(Pkt, 6, 0, 0); //Always present empty TLV.
PktFinal(Pkt); //Finalize packet
end;
{Send an URL.}
procedure CreateCLI_SENDURL(Pkt: PRawPkt; ITime, IRandom, MyUIN, UIN: LongWord; const URL, Description: String; var Seq: Word);
var
lpkt: TRawPkt;
S: String;
begin
PktInit(Pkt, 2, Seq); //Channel 2
PktSnac(Pkt, $04, $06, 0, 0); //Snac: Type x04/x06, ID x0000, Flags 0
PktInt(Pkt, ITime, 4); //MID
PktInt(Pkt, IRandom, 4); //MID
PktInt(Pkt, 4, 2); //type, 1 - url etc messages
PktLStr(Pkt, UIN); //The UIN to sent the message to.
PktInitRaw(@lpkt); //Allocate packet for incapsulated TLV
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -