Obsługa GG w BCB/TCE/BDS

0

Witam.

Zna ktoś obecnie sposób na obsługę gadulca pod C++ ale z wykorzystaniem komponentów indy 10 a nie 9 i niższych? Obecnie nie mogę skompilować starego programu a nie mam exeka z niego. Niestety przydało by mi się znowu zrobić obsługę na gg ale nie mam pojęcia czym obecnie.

Jeżeli ktoś ma klasy lub komponenty obsługujące gadu gadu w wersji 10 to będę bardzo wdzięczny za informacje bo do tej pory wszystko co znalazłem to THGG i GGLite działające na Indy 9.

0

Może ktoś chociaż pomoże z tym czemu nie działa logowanie :

Moja struktura gg

struct gg_log
      {
       int gg_login;
       int version;
       int numer;
       int hash;
       int status;
       int ukn1;
       int ukn2;
       int ukn3;
       int ukn4;
       int ukn5;
      };

struct gg_stat
      {
       int status;
       char description[];
       int time;
      };

struct gg_recv
      {
       int uknown1;
       int sender;
       int seq;
       int time;
       int klasa;
       char message[1986];
      };

struct gg_sen
      {
       int type;
       int klasa;
       int numer;
       int seq;
       int ukn1;
       char message[1986];
      };

struct gg_desc
      {
       int type;
       int seq;
       int klasa;
       char description[128];
      };

struct gg_sear
      {
       int type;
       int ukn1;
       int seq;
       char request[64];
      };

struct gg_fnd
      {
       int ukn1;
       int seq;
       char request[255];
      };

Unit1.cpp :

gg_log gadu;
gg_stat gadu_status;
gg_recv gg_recv_msg;
gg_sen gg_sent_msg;
gg_desc gg_description;
gg_sear gg_search;
gg_fnd gg_find;
void __fastcall TForm1::CS_ClientRead(TObject *Sender,
      TCustomWinSocket *Socket)
{
 int code = 0;
 CS_Client->Socket->ReceiveBuf(&code,4);
 // =============================== GG_WELCOME =======
 if(code == 0x01 && login == false)
   {
    M_log->Lines->Add(nazwa_programu + " : GG_WELCOME");
    int _seed;
    seed = 0;
    CS_Client->Socket->ReceiveBuf(&_seed,4);
    CS_Client->Socket->ReceiveBuf(&seed,4);
    GGLogin(StrToInt(E_numer->Text),E_haslo->Text);
    login = true;
   }
 // ==================================================
 // ====================== GG_LOGIN SUCCESFULL =======
 if(code == 0x03)
   {
    M_log->Lines->Add(nazwa_programu + " : Zalogowano na konto !");
    GGSentPacket(0x12);
    SocketTimer->Enabled = true;
    GGChangeDescription(1,"System " + nazwa_programu + " działa !");
    String wiadomosc = nazwa_programu + " : System został podłączony do sieci !";
    GGSentMessage(StrToInt(CoB_moj_nr_gg->Items->Strings[0]), wiadomosc);
   }
 // ==================================================
 // ====================== GG_LOGIN ERROR LOGIN ======
 if(code == 0x09)
   {
    M_log->Lines->Add(nazwa_programu + " : Błędne hasło!");
   }
 // ==================================================
 // ==================================================
 // ====================== GG_LOGIN MSG RECV =========
 if(code == 0x0a)
   {
    // Otrzymywanie wiadomości
    gg_recv_msg.sender = 0;
    gg_recv_msg.seq = 0;
    AnsiString txt,tekst;
    CS_Client->Socket->ReceiveBuf(&gg_recv_msg, sizeof(gg_recv_msg));
    tekst = gg_recv_msg.message;
    txt = tekst;
    E_odebrana_wiadomosc->Text = txt;
    txt = IntToStr(gg_recv_msg.sender) + " : " + tekst;

    //---Polecenia--

    e1 = "";
    e2 = "";
    e3 = "";
    nr_znaku = 0;
    e1 = tekst;

    for(int i=1; i<=e1.Length(); i++)
       {
        if(e1[i] == ':')
          {
           nr_znaku = i+1;
           break;
          }else{
                e2 = e2 + e1[i];
               };
       }
    for(int i=nr_znaku+1; i<=e1.Length(); i++) e3 = e3 + e1[i];
    int dl = e2.Length();
    e2.Delete(dl,1);
   }

Funkcje :

void __fastcall TForm1::GGLogin(int numer, String haslo)
{
 int gg_login = 0x15;
 int gg_version = 0x1f;
 unsigned int x, y, z;
 char* password = haslo.c_str();
 y = seed;
 for(x=0; *password; password++)
    {
     x = (x & 0xffffff00) | *password;
     y ^= x;
     y += x;
     x <<= 8;
     y ^= x;
     x <<= 8;
     y -= x;
     x <<= 8;
     y ^= x;
     z = y & 0x1f;
     y = (y << z) | (y >> (32 - z));
    }
 //Log->Lines->Add(y);
 gadu.gg_login = gg_login;
 gadu.version = gg_version;
 gadu.numer = numer;
 gadu.hash = y;
 gadu.status = 0x02; // dostepny
 gadu.ukn1 = 0x40000022;
 gadu.ukn2 = 0x03a8c000;
 gadu.ukn3 = 0x00060e97;
 gadu.ukn4 = 0x00000000;
 gadu.ukn5 = 0xbe14;
 CS_Client->Socket->SendBuf(&gadu, sizeof(gadu)-1);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::GGSentPacket(int status)
{
 gadu_status.status = status;
 CS_Client->Socket->SendBuf(&gadu_status, 8);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::GGSentMessage(int numer, String tresc)
{
 int lenght = 20;
 gg_sent_msg.type = 0x0b;
 gg_sent_msg.klasa = 0x0d + tresc.Length();
 gg_sent_msg.numer = numer;
 gg_sent_msg.seq = 0x00d14f88;
 gg_sent_msg.ukn1 = 0x28;
 // 16 +
 strcpy(gg_sent_msg.message, tresc.c_str());
 lenght = lenght + tresc.Length()+1;
 CS_Client->Socket->SendBuf(&gg_sent_msg, lenght);
 M_log->Lines->Add(nazwa_programu + " : Wysłano wiadomość \"" + tresc + "\"");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::GGChangeDescription(int typ, String opis)
{
 if(opis == "") // Statusy bez opisu...
   {
    if (typ == 0) typ = 0x01; // Niedostępny
    if (typ == 1) typ = 0x02; // Dostępny
    if (typ == 2) typ = 0x03; // Zaraz Wracam
    if (typ == 3) typ = 0x14; // Niewidoczny
    if (typ == 4) typ = 0x06; // Zablokowany
   }
 if(opis != "")
   {
    if (typ == 0) typ = 0x15; // Niedostępny
    if (typ == 1) typ = 0x04; // Dostępny
    if (typ == 2) typ = 0x05; // Zaraz Wracam
    if (typ == 3) typ = 0x16; // Niewidoczny
   }
 int lenght = 12;
 gg_description.type = 0x02;
 gg_description.seq = 0x04+opis.Length();
 gg_description.klasa = typ;
 strcpy(gg_description.description, opis.c_str());
 lenght = lenght + opis.Length();
 CS_Client->Socket->SendBuf(&gg_description, lenght);
 M_log->Lines->Add(nazwa_programu + " : Obecny opis \"" + opis + "\"");
}

Będę wdzięczny za pomoc :)

1 użytkowników online, w tym zalogowanych: 0, gości: 1