--- jit/src/Client.cpp.orig Wed Feb 4 13:47:09 2009 +++ jit/src/Client.cpp Thu Feb 5 15:49:52 2009 @@ -39,11 +39,6 @@ namespace ICQ2000 { -const unsigned short startSequences[] = { -5695, 23595, 23620, 23049, 0x2886, 0x2493, 23620, 23049, 2853, 17372, 1255, 1796, 1657, 13606, 1930, 23918, 31234, 30120, 0x1BEA, 0x5342, 0x30CC, 0x2294, 0x5697, 0x25FA, 0x3C26, 0x3303, 0x078A, 0x0FC5, 0x25D6, 0x26EE,0x7570, 0x7F33, 0x4E94, 0x07C9, 0x7339, 0x42A8 -//0x39B1, 0x1F07 -}; - /* signal messages */ void DCCache_expired_cb(Client * client,DirectClient *dc) { if (client == NULL) return; @@ -222,6 +217,12 @@ return m_requestid; } +unsigned short generate_flap_sequence() { + unsigned int n = rand(), s = 0, i; + for (i = n; i >>= 3; s += i); + return (unsigned int)((((0 - s) ^ (unsigned char)n) & 7 ^ n) + 2); +} + void Client::ConnectAuthorizer(State state) { SignalLog(LogEvent::INFO, "Client connecting"); @@ -229,13 +230,9 @@ // randomize sequence number srand(time(0)); -// m_client_seq_num = (unsigned short)(0x7fff*(rand()/(RAND_MAX+1.0))); - m_client_seq_num = (unsigned short)(0); + m_client_seq_num = generate_flap_sequence(); m_requestid = (unsigned int)(0x7fffffff*(rand()/(RAND_MAX+1.0))); - int startSequencesIndex = rand() % ((sizeof startSequences) / (sizeof startSequences[0])); - m_client_seq_num = startSequences[startSequencesIndex] - 1; - m_state = state; } @@ -833,9 +830,9 @@ << ClientProfileTLV("ICQBasic") << ClientTypeTLV(266) << ClientVersionMajorTLV(14) - << ClientVersionMinorTLV(22) + << ClientVersionMinorTLV(52) << ClientICQNumberTLV(0) - << ClientBuildMajorTLV(2321) + << ClientBuildMajorTLV(3000) << ClientBuildMinorTLV(1085) << LanguageTLV("en") << CountryCodeTLV("us");