http://rapidshare.de/files/10118104/hgg.zip.html

[HGG]
dodane:

type
TBytes=array of packed record
byte:integer;
end;
type
TColor=packed record
r:integer;
g:integer;
b:integer;
end;

type
TColorText=array of packed record
poz:integer;
color:TColor;
styl:integer;
end;

function formatuj(MessageContent: String):TColorText;

zmienione:

procedure TTCPThread.EventHandler;

TMessageEvent = procedure(Sender: TObject; GGNumber: Integer;
MessageContent: string; MessageTime: TDateTime;ColorText: TColorText)
of object;

ColorText jest to tablica wszystkich argomentow
np jak ktos wysle ci

[b]cze[/b][i]dadsa[/i]

co
colorText[0].poz=0
colortext[0].color.r=0
colortext[0].color.g=0
colortext[0].color.g=0
colorText[0].styl=1

itd...

[/HGG]

tu jest funkcja ktora przerobi tekst do html'a

function formatuj(Dane:TColorText;Tekst:string):string;
var
  I:integer;
  tekst2,Temp,styl,styl2,color,color2,r,g,b:string;
begin

  result:=Tekst;
if length(Dane)>0 then
begin

    if Dane[0].poz>0 then
    begin
      Temp:=copy(tekst,0,Dane[0].poz);
    end;

    for I:=0 to length(dane)-1 do
    begin

      if Dane[I+1].poz<>0 then
        tekst2:=copy(tekst,Dane[I].poz+1,Dane[I+1].poz-Dane[I].poz);

      r:=inttostr(dane[I].color.r);
      g:=inttostr(dane[I].color.g);
      b:=inttostr(dane[I].color.b);

      styl:='';
      styl2:='';
      color:='<span style="color:rgb('+r+','+g+','+b+')">';
      color2:='</span>';

      if (Dane[i].styl=1) OR (Dane[i].styl=9) then
      begin
        styl:='<b>';
        styl2:='</b>';
      end;
      if (Dane[i].styl=2) OR (Dane[i].styl=10) then
      begin
        styl:='<i>';
        styl2:='</i>';
      end;

      if (Dane[i].styl=3) OR (Dane[i].styl=11) then
      begin
        styl:='<b><i>';
        styl2:='</b></i>';
      end;
      if (Dane[i].styl=4) OR (Dane[i].styl=12) then
      begin
        styl:='<u>';
        styl2:='</u>';
      end;

      if (Dane[i].styl=5) OR (Dane[i].styl=13) then
      begin
        styl:='<b><u>';
        styl2:='</b></u>';
      end;

      if (Dane[i].styl=6) OR (Dane[i].styl=14) then
      begin
        styl:='<i><u>';
        styl2:='</i></u>';
      end;
      if (Dane[i].styl=7) OR (Dane[i].styl=15) then
      begin
        styl:='<b><i><u>';
        styl2:='</b></i></u>';
      end;

      Temp:=Temp+color+styl+tekst2+styl2+color2;
    end;
    result:=temp;

end;
end;

TODO:
CZASAMI:
nie dziala jak ktos nam wysle tak
black,red,black,red

i wtedy odczyta tylko red 1 raz 2 raz juz nie
w pliku hgg jest funkcja formatuj w niej nalezy to zmienic :)
moze byc to trudne bo nie ma komentarzy :)

to tyle na pewno sa bledy i mozna to zrobic latwiej a moze juz jest to
zrobione :) i wywazalem otwarte drzwi.

JAK COS NIE DZIALA TO
http://groups.google.pl/group/pl.comp.lang.delphi/browse_thread/thread/b671af763fee4ac5