Фикс от Rst7/CBSIE. Кто такие не знаю, но судя по коду - должно робить.
Код:
procedure TICQClient.HSnac0407(Flap: TFlapHdr; Snac: TSnacHdr; Pkt: PRawPkt);
....
chan: integer;
begin
Request := False;
ITime := GetInt(Pkt, 4); //Time(system up since): time(NULL) - ITime div 1000
//'System up since: ' + DateTimeToStr(DateTimeToUnix(Now) -
ITime div 1000);
//Seen by ICQ2003x
IRandomID := GetInt(Pkt, 2); //RandomID
Inc(Pkt^.Len, 2); //Unknown: empty
Msg := '';
{Subtypes}
chan:=GetInt(Pkt, 2);
UIN := GetStr(Pkt, GetInt(Pkt, 1));
Inc(Pkt^.Len, 2);
c := GetInt(Pkt, 2); //A count of the number of following TLVs.
for i := 0 to c - 1 do //Skip all TLVs
begin
Inc(Pkt^.Len, 2);
if (Pkt^.Len>=Flap.DataLen) then exit;
Inc(Pkt^.Len, GetInt(Pkt, 2));
end;
case chan of
1: //Simply(old-type) message
begin
if GetInt(Pkt, 2) = 2 then //TLV with message remain
begin
Inc(Pkt^.Len, 4); //TLV length + Unknown const
Inc(Pkt^.Len, GetInt(Pkt, 2)); //Counts of following bytes + following bytes
Inc(Pkt^.Len, 2); //x0101, Unknown, constant
ULen := GetInt(Pkt, 2) - 4; //Length of the message + 4
// Support for other charsets by Yegor
CharsetNumber:=GetInt (Pkt, 2); //The encoding used for the message.
//0x0000: US-ASCII
//0x0002: UCS-2BE (or UTF-16?)
//0x0003: local 8bit encoding, eg iso-8859-1, cp-1257, cp-
1251.
//Beware that UCS-2BE will contain zero-bytes for
characters in the US-ASCII range.
CharsetSubset:=GetInt (Pkt, 2); //Unknown; seen: 0x0000 = 0, 0xffff = -1.
// Inc(Pkt^.Len, 4); //Unknown seems to be constant
Msg := GetStr(Pkt, ULen); //The actual message text. There will be no ending NULL.
if not ((CharsetNumber=0) or (CharsetNumber=3))
then Msg:=UTF8ToStrSmart (Msg);
if FDoPlain
then Msg:=RTF2Plain (Msg);
if (Length(Msg) > 0) and Assigned(OnMessageRecv) then
FOnMsg(Self, Msg, UIN);
end;
end;
2: //Advanced(new-type)
begin
while(Pkt^.Len<Flap.DataLen)do
begin
if GetInt(Pkt, 2) = 5 then
...
Взято со zloy.org, пост BuH@LicH