comparison libpurple/protocols/qq/buddy_opt.c @ 30430:351d07aefb09

Kill off many dead assignments and any useless remaining variables. I think some of those QQ ones were actual logic errors, too. Let me know if there were any side-effects that were cut.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 23 Aug 2010 00:52:24 +0000
parents f1437342cc0e
children 6854cca5e2f7
comparison
equal deleted inserted replaced
30429:922c8c553758 30430:351d07aefb09
260 qq_send_cmd_mess(gc, QQ_CMD_AUTH_CODE, raw_data, bytes, 0, uid); 260 qq_send_cmd_mess(gc, QQ_CMD_AUTH_CODE, raw_data, bytes, 0, uid);
261 } 261 }
262 262
263 void qq_process_auth_code(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid) 263 void qq_process_auth_code(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid)
264 { 264 {
265 qq_data *qd;
266 gint bytes; 265 gint bytes;
267 guint8 cmd, reply; 266 guint8 cmd, reply;
268 guint16 sub_cmd; 267 guint16 sub_cmd;
269 guint8 *code = NULL; 268 guint8 *code = NULL;
270 guint16 code_len = 0; 269 guint16 code_len = 0;
271 270
272 g_return_if_fail(data != NULL && data_len != 0); 271 g_return_if_fail(data != NULL && data_len != 0);
273 g_return_if_fail(uid != 0); 272 g_return_if_fail(uid != 0);
274
275 qd = (qq_data *) gc->proto_data;
276 273
277 qq_show_packet("qq_process_auth_code", data, data_len); 274 qq_show_packet("qq_process_auth_code", data, data_len);
278 bytes = 0; 275 bytes = 0;
279 bytes += qq_get8(&cmd, data + bytes); 276 bytes += qq_get8(&cmd, data + bytes);
280 bytes += qq_get16(&sub_cmd, data + bytes); 277 bytes += qq_get16(&sub_cmd, data + bytes);
398 qq_send_cmd(gc, QQ_CMD_ADD_BUDDY_AUTH_EX, raw_data, bytes); 395 qq_send_cmd(gc, QQ_CMD_ADD_BUDDY_AUTH_EX, raw_data, bytes);
399 } 396 }
400 397
401 void qq_process_question(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid) 398 void qq_process_question(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid)
402 { 399 {
403 qq_data *qd;
404 gint bytes; 400 gint bytes;
405 guint8 cmd, reply; 401 guint8 cmd, reply;
406 gchar *question, *answer; 402 gchar *question, *answer;
407 guint16 code_len; 403 guint16 code_len;
408 guint8 *code; 404 guint8 *code;
409 405
410 g_return_if_fail(data != NULL && data_len != 0); 406 g_return_if_fail(data != NULL && data_len != 0);
411
412 qd = (qq_data *) gc->proto_data;
413 407
414 qq_show_packet("qq_process_question", data, data_len); 408 qq_show_packet("qq_process_question", data, data_len);
415 bytes = 0; 409 bytes = 0;
416 bytes += qq_get8(&cmd, data + bytes); 410 bytes += qq_get8(&cmd, data + bytes);
417 if (cmd == QQ_QUESTION_GET) { 411 if (cmd == QQ_QUESTION_GET) {
718 } 712 }
719 713
720 /* process reply to add_buddy_auth request */ 714 /* process reply to add_buddy_auth request */
721 void qq_process_add_buddy_auth(guint8 *data, gint data_len, PurpleConnection *gc) 715 void qq_process_add_buddy_auth(guint8 *data, gint data_len, PurpleConnection *gc)
722 { 716 {
723 qq_data *qd;
724 gchar **segments, *msg_utf8; 717 gchar **segments, *msg_utf8;
725 718
726 g_return_if_fail(data != NULL && data_len != 0); 719 g_return_if_fail(data != NULL && data_len != 0);
727
728 qd = (qq_data *) gc->proto_data;
729 720
730 if (data[0] == '0') { 721 if (data[0] == '0') {
731 purple_debug_info("QQ", "Reply OK for sending authorize\n"); 722 purple_debug_info("QQ", "Reply OK for sending authorize\n");
732 return; 723 return;
733 } 724 }
765 } 756 }
766 757
767 /* process the server reply for my request to remove myself from a buddy */ 758 /* process the server reply for my request to remove myself from a buddy */
768 void qq_process_buddy_remove_me(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid) 759 void qq_process_buddy_remove_me(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid)
769 { 760 {
770 qq_data *qd;
771 gchar *msg; 761 gchar *msg;
772 762
773 g_return_if_fail(data != NULL && data_len != 0); 763 g_return_if_fail(data != NULL && data_len != 0);
774 qd = (qq_data *) gc->proto_data;
775 764
776 if (data[0] == 0) { 765 if (data[0] == 0) {
777 purple_debug_info("QQ", "Reply OK for removing me from %u's buddy list\n", uid); 766 purple_debug_info("QQ", "Reply OK for removing me from %u's buddy list\n", uid);
778 return; 767 return;
779 } 768 }
1002 g_free(reason); 991 g_free(reason);
1003 } 992 }
1004 993
1005 void qq_process_buddy_check_code(PurpleConnection *gc, guint8 *data, gint data_len) 994 void qq_process_buddy_check_code(PurpleConnection *gc, guint8 *data, gint data_len)
1006 { 995 {
1007 qq_data *qd;
1008 gint bytes; 996 gint bytes;
1009 guint8 cmd; 997 guint8 cmd;
1010 guint8 reply; 998 guint8 reply;
1011 guint32 uid; 999 guint32 uid;
1012 guint16 flag1, flag2; 1000 guint16 flag1, flag2;
1013 1001
1014 g_return_if_fail(data != NULL && data_len >= 5); 1002 g_return_if_fail(data != NULL && data_len >= 5);
1015
1016 qd = (qq_data *) gc->proto_data;
1017 1003
1018 qq_show_packet("buddy_check_code", data, data_len); 1004 qq_show_packet("buddy_check_code", data, data_len);
1019 1005
1020 bytes = 0; 1006 bytes = 0;
1021 bytes += qq_get8(&cmd, data + bytes); /* 0x03 */ 1007 bytes += qq_get8(&cmd, data + bytes); /* 0x03 */