Mercurial > pidgin
comparison libpurple/protocols/qq/qq_process.c @ 24146:ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
* Merge lonicerae and ccpaging into trunk
author | SHiNE CsyFeK <csyfek@gmail.com> |
---|---|
date | Wed, 22 Oct 2008 14:52:26 +0000 |
parents | ec3f7d3e0445 |
children | 1bdf7b602684 |
comparison
equal
deleted
inserted
replaced
24145:ec3f7d3e0445 | 24146:ce94189f15ad |
---|---|
56 QQ_ROOM_CMD_REPLY_SEARCH_ERROR = 0x02, | 56 QQ_ROOM_CMD_REPLY_SEARCH_ERROR = 0x02, |
57 QQ_ROOM_CMD_REPLY_NOT_MEMBER = 0x0a | 57 QQ_ROOM_CMD_REPLY_NOT_MEMBER = 0x0a |
58 }; | 58 }; |
59 | 59 |
60 /* default process, decrypt and dump */ | 60 /* default process, decrypt and dump */ |
61 static void process_cmd_unknow(PurpleConnection *gc,const gchar *title, guint8 *data, gint data_len, guint16 cmd, guint16 seq) | 61 static void process_unknow_cmd(PurpleConnection *gc,const gchar *title, guint8 *data, gint data_len, guint16 cmd, guint16 seq) |
62 { | 62 { |
63 qq_data *qd; | 63 qq_data *qd; |
64 gchar *msg_utf8 = NULL; | 64 gchar *msg_utf8 = NULL; |
65 | 65 |
66 g_return_if_fail(data != NULL && data_len != 0); | 66 g_return_if_fail(data != NULL && data_len != 0); |
79 purple_notify_info(gc, _("QQ Error"), title, msg_utf8); | 79 purple_notify_info(gc, _("QQ Error"), title, msg_utf8); |
80 g_free(msg_utf8); | 80 g_free(msg_utf8); |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 /* parse the reply to send_im */ | |
85 static void do_im_ack(guint8 *data, gint data_len, PurpleConnection *gc) | |
86 { | |
87 qq_data *qd; | |
88 | |
89 g_return_if_fail(data != NULL && data_len != 0); | |
90 | |
91 qd = gc->proto_data; | |
92 | |
93 if (data[0] != 0) { | |
94 purple_debug_warning("QQ", "Failed sent IM\n"); | |
95 purple_notify_error(gc, _("Error"), _("Failed to send IM."), NULL); | |
96 return; | |
97 } | |
98 | |
99 purple_debug_info("QQ", "OK sent IM\n"); | |
100 } | |
101 | |
102 static void do_server_news(guint8 *data, gint data_len, PurpleConnection *gc) | |
103 { | |
104 qq_data *qd = (qq_data *) gc->proto_data; | |
105 gint bytes; | |
106 guint8 *temp; | |
107 guint8 temp_len; | |
108 gchar *title, *brief, *url; | |
109 gchar *title_utf8; | |
110 gchar *content, *content_utf8; | |
111 | |
112 g_return_if_fail(data != NULL && data_len != 0); | |
113 | |
114 /* qq_show_packet("Rcv news", data, data_len); */ | |
115 | |
116 temp = g_newa(guint8, data_len); | |
117 bytes = 4; /* ignore unknown 4 bytes */ | |
118 | |
119 bytes += qq_get8(&temp_len, data + bytes); | |
120 g_return_if_fail(bytes + temp_len <= data_len); | |
121 bytes += qq_getdata(temp, temp_len, data+bytes); | |
122 title = g_strndup((gchar *)temp, temp_len); | |
123 | |
124 bytes += qq_get8(&temp_len, data + bytes); | |
125 g_return_if_fail(bytes + temp_len <= data_len); | |
126 bytes += qq_getdata(temp, temp_len, data+bytes); | |
127 brief = g_strndup((gchar *)temp, temp_len); | |
128 | |
129 bytes += qq_get8(&temp_len, data + bytes); | |
130 g_return_if_fail(bytes + temp_len <= data_len); | |
131 bytes += qq_getdata(temp, temp_len, data+bytes); | |
132 url = g_strndup((gchar *)temp, temp_len); | |
133 | |
134 title_utf8 = qq_to_utf8(title, QQ_CHARSET_DEFAULT); | |
135 content = g_strdup_printf(_("Server News:\n%s\n%s\n%s"), title, brief, url); | |
136 content_utf8 = qq_to_utf8(content, QQ_CHARSET_DEFAULT); | |
137 | |
138 if (qd->is_show_news) { | |
139 qq_got_attention(gc, content_utf8); | |
140 } else { | |
141 purple_debug_info("QQ", "QQ Server news:\n%s\n%s", title_utf8, content_utf8); | |
142 } | |
143 g_free(title); | |
144 g_free(title_utf8); | |
145 g_free(brief); | |
146 g_free(url); | |
147 g_free(content); | |
148 g_free(content_utf8); | |
149 } | |
150 | |
151 static void do_msg_sys_30(PurpleConnection *gc, guint8 *data, gint data_len) | |
152 { | |
153 gint len; | |
154 guint8 reply; | |
155 gchar **segments, *msg_utf8; | |
156 | |
157 g_return_if_fail(data != NULL && data_len != 0); | |
158 | |
159 len = data_len; | |
160 | |
161 if (NULL == (segments = split_data(data, len, "\x2f", 2))) | |
162 return; | |
163 | |
164 reply = strtol(segments[0], NULL, 10); | |
165 if (reply == 1) | |
166 purple_debug_warning("QQ", "We are kicked out by QQ server\n"); | |
167 | |
168 msg_utf8 = qq_to_utf8(segments[1], QQ_CHARSET_DEFAULT); | |
169 qq_got_attention(gc, msg_utf8); | |
170 } | |
171 | |
172 static void do_msg_sys_4c(PurpleConnection *gc, guint8 *data, gint data_len) | |
173 { | |
174 gint bytes; | |
175 gint msg_len; | |
176 GString *content; | |
177 gchar *msg = NULL; | |
178 | |
179 g_return_if_fail(data != NULL && data_len > 0); | |
180 | |
181 bytes = 6; /* skip 0x(06 00 01 1e 01 1c)*/ | |
182 | |
183 content = g_string_new(""); | |
184 while (bytes < data_len) { | |
185 msg_len = qq_get_vstr(&msg, QQ_CHARSET_DEFAULT, data + bytes); | |
186 g_string_append(content, msg); | |
187 g_string_append(content, "\n"); | |
188 g_free(msg); | |
189 | |
190 if (msg_len <= 1) { | |
191 break; | |
192 } | |
193 bytes += msg_len; | |
194 } | |
195 if (bytes != data_len) { | |
196 purple_debug_warning("QQ", "Failed to read QQ_MSG_SYS_4C\n"); | |
197 qq_show_packet("do_msg_sys_4c", data, data_len); | |
198 } | |
199 qq_got_attention(gc, content->str); | |
200 g_string_free(content, FALSE); | |
201 } | |
202 | |
203 static const gchar *get_im_type_desc(gint type) | |
204 { | |
205 switch (type) { | |
206 case QQ_MSG_TO_BUDDY: | |
207 return "QQ_MSG_TO_BUDDY"; | |
208 case QQ_MSG_TO_UNKNOWN: | |
209 return "QQ_MSG_TO_UNKNOWN"; | |
210 case QQ_MSG_UNKNOWN_QUN_IM: | |
211 return "QQ_MSG_UNKNOWN_QUN_IM"; | |
212 case QQ_MSG_ADD_TO_QUN: | |
213 return "QQ_MSG_ADD_TO_QUN"; | |
214 case QQ_MSG_DEL_FROM_QUN: | |
215 return "QQ_MSG_DEL_FROM_QUN"; | |
216 case QQ_MSG_APPLY_ADD_TO_QUN: | |
217 return "QQ_MSG_APPLY_ADD_TO_QUN"; | |
218 case QQ_MSG_CREATE_QUN: | |
219 return "QQ_MSG_CREATE_QUN"; | |
220 case QQ_MSG_SYS_30: | |
221 return "QQ_MSG_SYS_30"; | |
222 case QQ_MSG_SYS_4C: | |
223 return "QQ_MSG_SYS_4C"; | |
224 case QQ_MSG_APPROVE_APPLY_ADD_TO_QUN: | |
225 return "QQ_MSG_APPROVE_APPLY_ADD_TO_QUN"; | |
226 case QQ_MSG_REJCT_APPLY_ADD_TO_QUN: | |
227 return "QQ_MSG_REJCT_APPLY_ADD_TO_QUN"; | |
228 case QQ_MSG_TEMP_QUN_IM: | |
229 return "QQ_MSG_TEMP_QUN_IM"; | |
230 case QQ_MSG_QUN_IM: | |
231 return "QQ_MSG_QUN_IM"; | |
232 case QQ_MSG_NEWS: | |
233 return "QQ_MSG_NEWS"; | |
234 case QQ_MSG_EXTEND: | |
235 return "QQ_MSG_EXTEND"; | |
236 case QQ_MSG_EXTEND_85: | |
237 return "QQ_MSG_EXTEND_85"; | |
238 default: | |
239 return "QQ_MSG_UNKNOWN"; | |
240 } | |
241 } | |
242 | |
243 /* I receive a message, mainly it is text msg, | |
244 * but we need to proess other types (group etc) */ | |
245 static void process_private_msg(guint8 *data, gint data_len, guint16 seq, PurpleConnection *gc) | |
246 { | |
247 qq_data *qd; | |
248 gint bytes; | |
249 | |
250 struct { | |
251 guint32 uid_from; | |
252 guint32 uid_to; | |
253 guint32 seq; | |
254 struct in_addr ip_from; | |
255 guint16 port_from; | |
256 guint16 msg_type; | |
257 } header; | |
258 | |
259 g_return_if_fail(data != NULL && data_len != 0); | |
260 | |
261 qd = (qq_data *) gc->proto_data; | |
262 | |
263 if (data_len < 16) { /* we need to ack with the first 16 bytes */ | |
264 purple_debug_error("QQ", "MSG is too short\n"); | |
265 return; | |
266 } else { | |
267 /* when we receive a message, | |
268 * we send an ACK which is the first 16 bytes of incoming packet */ | |
269 qq_send_server_reply(gc, QQ_CMD_RECV_IM, seq, data, 16); | |
270 } | |
271 | |
272 /* check len first */ | |
273 if (data_len < 20) { /* length of im_header */ | |
274 purple_debug_error("QQ", "Invald MSG header, len %d < 20\n", data_len); | |
275 return; | |
276 } | |
277 | |
278 bytes = 0; | |
279 bytes += qq_get32(&(header.uid_from), data + bytes); | |
280 bytes += qq_get32(&(header.uid_to), data + bytes); | |
281 bytes += qq_get32(&(header.seq), data + bytes); | |
282 /* if the message is delivered via server, it is server IP/port */ | |
283 bytes += qq_getIP(&(header.ip_from), data + bytes); | |
284 bytes += qq_get16(&(header.port_from), data + bytes); | |
285 bytes += qq_get16(&(header.msg_type), data + bytes); | |
286 /* im_header prepared */ | |
287 | |
288 if (header.uid_to != qd->uid) { /* should not happen */ | |
289 purple_debug_error("QQ", "MSG to [%d], NOT me\n", header.uid_to); | |
290 return; | |
291 } | |
292 | |
293 /* check bytes */ | |
294 if (bytes >= data_len - 1) { | |
295 purple_debug_warning("QQ", "Empty MSG\n"); | |
296 return; | |
297 } | |
298 | |
299 switch (header.msg_type) { | |
300 case QQ_MSG_NEWS: | |
301 do_server_news(data + bytes, data_len - bytes, gc); | |
302 break; | |
303 case QQ_MSG_EXTEND: | |
304 case QQ_MSG_EXTEND_85: | |
305 purple_debug_info("QQ", "MSG from buddy [%d]\n", header.uid_from); | |
306 qq_process_extend_im(gc, data + bytes, data_len - bytes); | |
307 break; | |
308 case QQ_MSG_TO_UNKNOWN: | |
309 case QQ_MSG_TO_BUDDY: | |
310 purple_debug_info("QQ", "MSG from buddy [%d]\n", header.uid_from); | |
311 qq_process_im(gc, data + bytes, data_len - bytes); | |
312 break; | |
313 case QQ_MSG_UNKNOWN_QUN_IM: | |
314 case QQ_MSG_TEMP_QUN_IM: | |
315 case QQ_MSG_QUN_IM: | |
316 purple_debug_info("QQ", "MSG from room [%d]\n", header.uid_from); | |
317 qq_process_room_msg_normal(data + bytes, data_len - bytes, header.uid_from, gc, header.msg_type); | |
318 break; | |
319 case QQ_MSG_ADD_TO_QUN: | |
320 purple_debug_info("QQ", "Notice from [%d], Added\n", header.uid_from); | |
321 /* uid_from is group id | |
322 * we need this to create a dummy group and add to blist */ | |
323 qq_process_room_msg_been_added(data + bytes, data_len - bytes, header.uid_from, gc); | |
324 break; | |
325 case QQ_MSG_DEL_FROM_QUN: | |
326 purple_debug_info("QQ", "Notice from room [%d], Removed\n", header.uid_from); | |
327 /* uid_from is group id */ | |
328 qq_process_room_msg_been_removed(data + bytes, data_len - bytes, header.uid_from, gc); | |
329 break; | |
330 case QQ_MSG_APPLY_ADD_TO_QUN: | |
331 purple_debug_info("QQ", "Notice from room [%d], Joined\n", header.uid_from); | |
332 /* uid_from is group id */ | |
333 qq_process_room_msg_apply_join(data + bytes, data_len - bytes, header.uid_from, gc); | |
334 break; | |
335 case QQ_MSG_APPROVE_APPLY_ADD_TO_QUN: | |
336 purple_debug_info("QQ", "Notice from room [%d], Confirm add in\n", | |
337 header.uid_from); | |
338 /* uid_from is group id */ | |
339 qq_process_room_msg_been_approved(data + bytes, data_len - bytes, header.uid_from, gc); | |
340 break; | |
341 case QQ_MSG_REJCT_APPLY_ADD_TO_QUN: | |
342 purple_debug_info("QQ", "Notice from room [%d], Refuse add in\n", | |
343 header.uid_from); | |
344 /* uid_from is group id */ | |
345 qq_process_room_msg_been_rejected(data + bytes, data_len - bytes, header.uid_from, gc); | |
346 break; | |
347 case QQ_MSG_SYS_30: | |
348 do_msg_sys_30(gc, data + bytes, data_len - bytes); | |
349 break; | |
350 case QQ_MSG_SYS_4C: | |
351 do_msg_sys_4c(gc, data + bytes, data_len - bytes); | |
352 break; | |
353 default: | |
354 purple_debug_warning("QQ", "MSG from [%d], unknown type %s [0x%04X]\n", | |
355 header.uid_from, get_im_type_desc(header.msg_type), header.msg_type); | |
356 qq_show_packet("Unknown MSG type", data, data_len); | |
357 break; | |
358 } | |
359 } | |
360 | |
84 /* Send ACK if the sys message needs an ACK */ | 361 /* Send ACK if the sys message needs an ACK */ |
85 static void ack_server_msg(PurpleConnection *gc, guint8 code, guint32 from, guint16 seq) | 362 static void request_server_ack(PurpleConnection *gc, guint8 code, guint32 from, guint16 seq) |
86 { | 363 { |
87 qq_data *qd; | 364 qq_data *qd; |
88 guint8 bar, *ack; | 365 guint8 bar, *ack; |
89 gchar *str; | 366 gchar *str; |
90 gint ack_len, bytes; | 367 gint ack_len, bytes; |
110 else | 387 else |
111 purple_debug_error("QQ", | 388 purple_debug_error("QQ", |
112 "Fail creating sys msg ACK, expect %d bytes, build %d bytes\n", ack_len, bytes); | 389 "Fail creating sys msg ACK, expect %d bytes, build %d bytes\n", ack_len, bytes); |
113 } | 390 } |
114 | 391 |
115 static void process_server_notice(PurpleConnection *gc, gchar *from, gchar *to, gchar *msg_utf8) | 392 static void do_server_notice(PurpleConnection *gc, gchar *from, gchar *to, gchar *msg_utf8) |
116 { | 393 { |
117 qq_data *qd = (qq_data *) gc->proto_data; | 394 qq_data *qd = (qq_data *) gc->proto_data; |
118 gchar *title, *content; | 395 gchar *title, *content; |
119 | 396 |
120 g_return_if_fail(from != NULL && to != NULL); | 397 g_return_if_fail(from != NULL && to != NULL); |
146 code = segments[0]; | 423 code = segments[0]; |
147 from = segments[1]; | 424 from = segments[1]; |
148 to = segments[2]; | 425 to = segments[2]; |
149 msg = segments[3]; | 426 msg = segments[3]; |
150 | 427 |
151 ack_server_msg(gc, code[0], strtol(from, NULL, 10), seq); | 428 request_server_ack(gc, code[0], strtol(from, NULL, 10), seq); |
152 | 429 |
153 if (strtol(to, NULL, 10) != qd->uid) { /* not to me */ | 430 if (strtol(to, NULL, 10) != qd->uid) { /* not to me */ |
154 purple_debug_error("QQ", "Recv sys msg to [%s], not me!, discard\n", to); | 431 purple_debug_error("QQ", "Recv sys msg to [%s], not me!, discard\n", to); |
155 g_strfreev(segments); | 432 g_strfreev(segments); |
156 return; | 433 return; |
171 case QQ_SERVER_BUDDY_ADDED_ME: | 448 case QQ_SERVER_BUDDY_ADDED_ME: |
172 case QQ_SERVER_BUDDY_REJECTED_ME: | 449 case QQ_SERVER_BUDDY_REJECTED_ME: |
173 qq_process_buddy_from_server(gc, funct, from, to, msg_utf8); | 450 qq_process_buddy_from_server(gc, funct, from, to, msg_utf8); |
174 break; | 451 break; |
175 case QQ_SERVER_NOTICE: | 452 case QQ_SERVER_NOTICE: |
176 process_server_notice(gc, from, to, msg_utf8); | 453 do_server_notice(gc, from, to, msg_utf8); |
177 break; | 454 break; |
178 case QQ_SERVER_NEW_CLIENT: | 455 case QQ_SERVER_NEW_CLIENT: |
179 purple_debug_warning("QQ", "QQ Server has newer client version\n"); | 456 purple_debug_warning("QQ", "QQ Server has newer client version\n"); |
180 break; | 457 break; |
181 default: | 458 default: |
214 } | 491 } |
215 | 492 |
216 /* now process the packet */ | 493 /* now process the packet */ |
217 switch (cmd) { | 494 switch (cmd) { |
218 case QQ_CMD_RECV_IM: | 495 case QQ_CMD_RECV_IM: |
219 qq_process_recv_im(data, data_len, seq, gc); | 496 process_private_msg(data, data_len, seq, gc); |
220 break; | 497 break; |
221 case QQ_CMD_RECV_MSG_SYS: | 498 case QQ_CMD_RECV_MSG_SYS: |
222 process_server_msg(data, data_len, seq, gc); | 499 process_server_msg(data, data_len, seq, gc); |
223 break; | 500 break; |
224 case QQ_CMD_BUDDY_CHANGE_STATUS: | 501 case QQ_CMD_BUDDY_CHANGE_STATUS: |
225 qq_process_buddy_change_status(data, data_len, gc); | 502 qq_process_buddy_change_status(data, data_len, gc); |
226 break; | 503 break; |
227 default: | 504 default: |
228 process_cmd_unknow(gc, _("Unknow SERVER CMD"), data, data_len, cmd, seq); | 505 process_unknow_cmd(gc, _("Unknow SERVER CMD"), data, data_len, cmd, seq); |
229 break; | 506 break; |
230 } | 507 } |
231 } | 508 } |
232 | 509 |
233 static void process_room_cmd_notify(PurpleConnection *gc, | 510 static void process_room_cmd_notify(PurpleConnection *gc, |
621 case QQ_CMD_LOGIN: | 898 case QQ_CMD_LOGIN: |
622 default: | 899 default: |
623 if (qd->client_version >= 2007) { | 900 if (qd->client_version >= 2007) { |
624 purple_debug_warning("QQ", "Decrypt login packet by pwd_twice_md5\n"); | 901 purple_debug_warning("QQ", "Decrypt login packet by pwd_twice_md5\n"); |
625 data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.pwd_twice_md5); | 902 data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.pwd_twice_md5); |
626 | |
627 if (data_len >= 0) { | 903 if (data_len >= 0) { |
628 purple_debug_warning("QQ", "Dpwd_twice_md5 *OK*\n"); | 904 purple_debug_warning("QQ", "Dpwd_twice_md5 *OK*\n"); |
629 } | 905 } |
630 else { | 906 else { |
631 purple_debug_warning("QQ", "Dpwd_twice_md5 *FAILED*, try login_key, last data_len=%d\n", data_len); | 907 purple_debug_warning("QQ", "Dpwd_twice_md5 *FAILED*, try login_key, last data_len=%d\n", data_len); |
632 data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.login_key); | 908 data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.login_key); |
633 | |
634 if (data_len >= 0) { | 909 if (data_len >= 0) { |
635 purple_debug_warning("QQ", "Dlogin_key *OK*\n"); | 910 purple_debug_warning("QQ", "Dlogin_key *OK*\n"); |
636 } | 911 } |
637 else { | 912 else { |
638 purple_debug_warning("QQ", "Dlogin_key *FAILED*\n"); | 913 purple_debug_warning("QQ", "Dlogin_key *FAILED*\n"); |
663 PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, | 938 PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, |
664 _("Can not decrypt login reply")); | 939 _("Can not decrypt login reply")); |
665 return QQ_LOGIN_REPLY_ERR; | 940 return QQ_LOGIN_REPLY_ERR; |
666 } | 941 } |
667 | 942 |
668 purple_debug_warning("QQ", "we are processing: 0x%02x\n", cmd); | |
669 switch (cmd) { | 943 switch (cmd) { |
670 case QQ_CMD_GET_SERVER: | 944 case QQ_CMD_GET_SERVER: |
671 ret_8 = qq_process_get_server(gc, data, data_len); | 945 ret_8 = qq_process_get_server(gc, data, data_len); |
672 if ( ret_8 == QQ_LOGIN_REPLY_OK) { | 946 if ( ret_8 == QQ_LOGIN_REPLY_OK) { |
673 qq_request_token(gc); | 947 qq_request_token(gc); |
689 } | 963 } |
690 break; | 964 break; |
691 case QQ_CMD_CHECK_PWD: | 965 case QQ_CMD_CHECK_PWD: |
692 ret_8 = qq_process_check_pwd(gc, data, data_len); | 966 ret_8 = qq_process_check_pwd(gc, data, data_len); |
693 if (ret_8 != QQ_LOGIN_REPLY_OK) { | 967 if (ret_8 != QQ_LOGIN_REPLY_OK) { |
694 return ret_8; | 968 return ret_8; |
695 } | 969 } |
696 if (qd->client_version == 2008) { | 970 if (qd->client_version == 2008) { |
697 qq_request_login_2008(gc); | 971 qq_request_login_2008(gc); |
698 } else { | 972 } else { |
699 qq_request_login_2007(gc); | 973 qq_request_login_2007(gc); |
706 ret_8 = qq_process_login_2007(gc, data, data_len); | 980 ret_8 = qq_process_login_2007(gc, data, data_len); |
707 } else { | 981 } else { |
708 ret_8 = qq_process_login(gc, data, data_len); | 982 ret_8 = qq_process_login(gc, data, data_len); |
709 } | 983 } |
710 if (ret_8 != QQ_LOGIN_REPLY_OK) { | 984 if (ret_8 != QQ_LOGIN_REPLY_OK) { |
711 return ret_8; | 985 return ret_8; |
712 } | 986 } |
713 | 987 |
714 purple_connection_update_progress(gc, _("Logined"), QQ_CONNECT_STEPS - 1, QQ_CONNECT_STEPS); | 988 purple_connection_update_progress(gc, _("Logined"), QQ_CONNECT_STEPS - 1, QQ_CONNECT_STEPS); |
715 purple_debug_info("QQ", "Login repliess OK; everything is fine\n"); | 989 purple_debug_info("QQ", "Login repliess OK; everything is fine\n"); |
716 purple_connection_set_state(gc, PURPLE_CONNECTED); | 990 purple_connection_set_state(gc, PURPLE_CONNECTED); |
724 | 998 |
725 qq_update_all(gc, 0); | 999 qq_update_all(gc, 0); |
726 break; | 1000 break; |
727 default: | 1001 default: |
728 purple_debug_warning("QQ", "UNKNOWN LOGIN CMD: %d\n", cmd); | 1002 purple_debug_warning("QQ", "UNKNOWN LOGIN CMD: %d\n", cmd); |
729 process_cmd_unknow(gc, _("Unknow LOGIN CMD"), data, data_len, cmd, seq); | 1003 process_unknow_cmd(gc, _("Unknow LOGIN CMD"), data, data_len, cmd, seq); |
730 return QQ_LOGIN_REPLY_ERR; | 1004 return QQ_LOGIN_REPLY_ERR; |
731 } | 1005 } |
732 return QQ_LOGIN_REPLY_OK; | 1006 return QQ_LOGIN_REPLY_OK; |
733 } | 1007 } |
734 | 1008 |
788 break; | 1062 break; |
789 case QQ_CMD_CHANGE_STATUS: | 1063 case QQ_CMD_CHANGE_STATUS: |
790 qq_process_change_status_reply(data, data_len, gc); | 1064 qq_process_change_status_reply(data, data_len, gc); |
791 break; | 1065 break; |
792 case QQ_CMD_SEND_IM: | 1066 case QQ_CMD_SEND_IM: |
793 qq_process_send_im_reply(data, data_len, gc); | 1067 do_im_ack(data, data_len, gc); |
794 break; | 1068 break; |
795 case QQ_CMD_KEEP_ALIVE: | 1069 case QQ_CMD_KEEP_ALIVE: |
796 if (qd->client_version >= 2008) { | 1070 if (qd->client_version >= 2008) { |
797 qq_process_keep_alive_2008(data, data_len, gc); | 1071 qq_process_keep_alive_2008(data, data_len, gc); |
798 } else if (qd->client_version >= 2007) { | 1072 } else if (qd->client_version >= 2007) { |
831 return; | 1105 return; |
832 } | 1106 } |
833 purple_debug_info("QQ", "All buddies and groups received\n"); | 1107 purple_debug_info("QQ", "All buddies and groups received\n"); |
834 break; | 1108 break; |
835 default: | 1109 default: |
836 process_cmd_unknow(gc, _("Unknow CLIENT CMD"), data, data_len, cmd, seq); | 1110 process_unknow_cmd(gc, _("Unknow CLIENT CMD"), data, data_len, cmd, seq); |
837 is_unknow = TRUE; | 1111 is_unknow = TRUE; |
838 break; | 1112 break; |
839 } | 1113 } |
840 if (is_unknow) | 1114 if (is_unknow) |
841 return; | 1115 return; |