comparison src/protocols/qq/buddy_list.c @ 13989:16102b9c5c4a

[gaim-migrate @ 16562] *Eliminated all Gtk-related code from the prpl. Notably, this included the group ("Qun") administrative dialog and a dialog for setting and viewing personal information. Code for the latter now uses the gaim UI, while the former is currently disabled. *Disabled a few non-functional/non-essential menu actions. These included: IP lookup, system logging, about dialog, and qq_buddy_menu. committer: Tailor Script <tailor@pidgin.im>
author Mark Huetsch <markhuetsch>
date Mon, 24 Jul 2006 13:39:12 +0000
parents 983fd420e86b
children ef8490f9e823
comparison
equal deleted inserted replaced
13988:4d5cc9e4cb12 13989:16102b9c5c4a
40 #include "group.h" // qq_group, by gfhuang 40 #include "group.h" // qq_group, by gfhuang
41 #include "group_find.h" // qq_group_find 41 #include "group_find.h" // qq_group_find
42 #include "group_hash.h" //qq_group_create_by_id 42 #include "group_hash.h" //qq_group_create_by_id
43 #include "group_info.h" //qq_send_cmd_group_get_group_info 43 #include "group_info.h" //qq_send_cmd_group_get_group_info
44 44
45 #include "qq_proxy.h"
46
45 #define QQ_GET_ONLINE_BUDDY_02 0x02 47 #define QQ_GET_ONLINE_BUDDY_02 0x02
46 #define QQ_GET_ONLINE_BUDDY_03 0x03 // unknown function 48 #define QQ_GET_ONLINE_BUDDY_03 0x03 // unknown function
47 49
48 #define QQ_ONLINE_BUDDY_ENTRY_LEN 38 50 #define QQ_ONLINE_BUDDY_ENTRY_LEN 38
49 51
53 guint8 flag1; 55 guint8 flag1;
54 guint8 comm_flag; 56 guint8 comm_flag;
55 guint16 unknown2; 57 guint16 unknown2;
56 guint8 ending; //0x00 58 guint8 ending; //0x00
57 } qq_friends_online_entry; 59 } qq_friends_online_entry;
58
59 //TODO: defined in qq_buddy_status.c, but only used here. Check decomposition.
60 extern void // defined in qq_buddy_status.c
61 _qq_buddy_status_dump_unclear(qq_buddy_status * s);
62
63 extern gint // defined in qq_buddy_status.c
64 _qq_buddy_status_read(guint8 * data, guint8 ** cursor, gint len, qq_buddy_status * s);
65 60
66 /*****************************************************************************/ 61 /*****************************************************************************/
67 // get a list of online_buddies 62 // get a list of online_buddies
68 void qq_send_packet_get_buddies_online(GaimConnection * gc, guint8 position) 63 void qq_send_packet_get_buddies_online(GaimConnection * gc, guint8 position)
69 { 64 {
146 { 141 {
147 GString *dump; 142 GString *dump;
148 143
149 g_return_if_fail(fe != NULL); 144 g_return_if_fail(fe != NULL);
150 145
151 _qq_buddy_status_dump_unclear(fe->s); 146 qq_buddy_status_dump_unclear(fe->s);
152 147
153 dump = g_string_new(""); 148 dump = g_string_new("");
154 g_string_append_printf(dump, "unclear fields for [%d]:\n", fe->s->uid); 149 g_string_append_printf(dump, "unclear fields for [%d]:\n", fe->s->uid);
155 g_string_append_printf(dump, "031-032: %04x (unknown)\n", fe->unknown1); 150 g_string_append_printf(dump, "031-032: %04x (unknown)\n", fe->unknown1);
156 g_string_append_printf(dump, "033: %02x (flag1)\n", fe->flag1); 151 g_string_append_printf(dump, "033: %02x (flag1)\n", fe->flag1);
178 qd = (qq_data *) gc->proto_data; 173 qd = (qq_data *) gc->proto_data;
179 len = buf_len; 174 len = buf_len;
180 data = g_newa(guint8, len); 175 data = g_newa(guint8, len);
181 cursor = data; 176 cursor = data;
182 177
178 gaim_debug(GAIM_DEBUG_INFO, "QQ", "processing get_buddies_online_reply\n");
179
183 if (qq_crypt(DECRYPT, buf, buf_len, qd->session_key, data, &len)) { 180 if (qq_crypt(DECRYPT, buf, buf_len, qd->session_key, data, &len)) {
184 181
182 _qq_show_packet("Get buddies online reply packet", data, len);
183
185 read_packet_b(data, &cursor, len, &position); 184 read_packet_b(data, &cursor, len, &position);
185
186 fe = g_newa(qq_friends_online_entry, 1); 186 fe = g_newa(qq_friends_online_entry, 1);
187 fe->s = g_newa(qq_buddy_status, 1); 187 fe->s = g_newa(qq_buddy_status, 1);
188 188
189 while (cursor < (data + len)) { 189 while (cursor < (data + len)) {
190 // based on one online buddy entry 190 // based on one online buddy entry
191 bytes = 0; 191 bytes = 0;
192 // 000-030 qq_buddy_status 192 // 000-030 qq_buddy_status
193 bytes += _qq_buddy_status_read(data, &cursor, len, fe->s); 193 bytes += qq_buddy_status_read(data, &cursor, len, fe->s);
194 // 031-032: unknown4 194 // 031-032: unknown4
195 bytes += read_packet_w(data, &cursor, len, &fe->unknown1); 195 bytes += read_packet_w(data, &cursor, len, &fe->unknown1);
196 // 033-033: flag1 196 // 033-033: flag1
197 bytes += read_packet_b(data, &cursor, len, &fe->flag1); 197 bytes += read_packet_b(data, &cursor, len, &fe->flag1);
198 // 034-034: comm_flag 198 // 034-034: comm_flag
207 g_free(fe->s->ip); 207 g_free(fe->s->ip);
208 g_free(fe->s->unknown_key); 208 g_free(fe->s->unknown_key);
209 continue; 209 continue;
210 } // check if it is a valid entry 210 } // check if it is a valid entry
211 211
212 // if (QQ_DEBUG) 212 if (QQ_DEBUG)
213 // _qq_buddies_online_reply_dump_unclear(fe); 213 _qq_buddies_online_reply_dump_unclear(fe);
214 214
215 // update buddy information 215 // update buddy information
216 b = gaim_find_buddy(gaim_connection_get_account(gc), uid_to_gaim_name(fe->s->uid)); 216 b = gaim_find_buddy(gaim_connection_get_account(gc), uid_to_gaim_name(fe->s->uid));
217 q_bud = (b == NULL) ? NULL : (qq_buddy *) b->proto_data; 217 q_bud = (b == NULL) ? NULL : (qq_buddy *) b->proto_data;
218 218
219 if (q_bud != NULL) { // we find one and update qq_buddy 219 if (q_bud != NULL) { // we find one and update qq_buddy
220 if(0 != fe->s->client_version) 220 if(0 != fe->s->client_version)
221 q_bud->client_version = fe->s->client_version; //by gfhuang 221 q_bud->client_version = fe->s->client_version; //by gfhuang
222 if(0 != *((guint32 *)fe->s->ip)) { // by gfhuang 222 // if(0 != *((guint32 *)fe->s->ip)) { // by gfhuang
223 g_memmove(q_bud->ip, fe->s->ip, 4); 223 g_memmove(q_bud->ip, fe->s->ip, 4);
224 q_bud->port = fe->s->port; 224 q_bud->port = fe->s->port;
225 } 225 // }
226 q_bud->status = fe->s->status; 226 q_bud->status = fe->s->status;
227 q_bud->flag1 = fe->flag1; 227 q_bud->flag1 = fe->flag1;
228 q_bud->comm_flag = fe->comm_flag; 228 q_bud->comm_flag = fe->comm_flag;
229 qq_update_buddy_contact(gc, q_bud); 229 qq_update_buddy_contact(gc, q_bud);
230 } // if q_bud 230 } // if q_bud