Cześć!
piszę na podstawie tej dokumentacji: http://toxygen.net/libgadu/protocol/
i mam pewien problem Tzn tak przetłumaczyłem pakiety dla wiadomości:
type TGGHeader = record
PackType :LongInt;
Size :LongInt;
end;
PGGHeader = ^TGGHeader;
type TGGRecv_Msg = record
PackType :LongInt;
Size :LongInt;
Sender :LongInt;
seq :Longint;
time :LongInt;
clas :LongInt;
offset_plain: LongInt;
offset_attributes: LongInt;
html_message: array[0..2000] of byte;
plain_message:array[0..2000] of byte;
attributes: array of Byte;
end;
PGGRecv_Msg = ^TGGRecv_Msg;
Następnie sprawdzam i wczytuje wiadomość tak:
var
BuforIn :Array[0..30000] of Byte; //bufor odczytu
BuforInSize :LongInt;
i,j,o,size:integer;
wiadomoscHTML:String;
begin
BuforInSize:=form1.idtcpclient1.Socket.Recv(BuforIn,30000);
if PGGHeader(@BuforIn)^.PackType =$002e then // nadeszla wiadomosc
begin
i:=PGGRecv_Msg(@BuforIn)^.Sender;
j:=PGGRecv_Msg(@BuforIn)^.offset_plain;
o:=PGGRecv_Msg(@BuforIn)^.offset_attributes
Size:=PggRecv_Msg(@BuforIn)^.Size;
wiadomoscHTML:='';
k:=32;
while (BuforIn[k]<>0)and(k<size+8) do
Begin
wiadomoscHTML:= wiadomoscHTML+Chr(BuforIn[k]);
Inc(k);
End;
form1.memo1.Lines.Add(wiadomoscHTML);
end;
end;
No i wszystko jest ok jeśli wiadomość jest krótka wtedy pokazuję całą wiadomość. Jeśli natomiast wiadomość jest długa tzn wtedy pokazywane jest tylko 440 znaków wiadomości co jest nie tak że wczytuje tylko te 440 znaków? Gdzie jest błąd?