comparison libpurple/protocols/qq/qq_process.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 4deef745de87
comparison
equal deleted inserted replaced
30429:922c8c553758 30430:351d07aefb09
56 }; 56 };
57 57
58 /* default process, decrypt and dump */ 58 /* default process, decrypt and dump */
59 static void process_unknow_cmd(PurpleConnection *gc,const gchar *title, guint8 *data, gint data_len, guint16 cmd, guint16 seq) 59 static void process_unknow_cmd(PurpleConnection *gc,const gchar *title, guint8 *data, gint data_len, guint16 cmd, guint16 seq)
60 { 60 {
61 qq_data *qd;
62 gchar *msg; 61 gchar *msg;
63 62
64 g_return_if_fail(data != NULL && data_len != 0); 63 g_return_if_fail(data != NULL && data_len != 0);
65 64
66 qq_show_packet(title, data, data_len); 65 qq_show_packet(title, data, data_len);
67
68 qd = (qq_data *) gc->proto_data;
69 66
70 qq_hex_dump(PURPLE_DEBUG_WARNING, "QQ", 67 qq_hex_dump(PURPLE_DEBUG_WARNING, "QQ",
71 data, data_len, 68 data, data_len,
72 ">>> [%d] %s -> [default] decrypt and dump", 69 ">>> [%d] %s -> [default] decrypt and dump",
73 seq, qq_get_cmd_desc(cmd)); 70 seq, qq_get_cmd_desc(cmd));
78 } 75 }
79 76
80 /* parse the reply to send_im */ 77 /* parse the reply to send_im */
81 static void do_im_ack(guint8 *data, gint data_len, PurpleConnection *gc) 78 static void do_im_ack(guint8 *data, gint data_len, PurpleConnection *gc)
82 { 79 {
83 qq_data *qd;
84
85 g_return_if_fail(data != NULL && data_len != 0); 80 g_return_if_fail(data != NULL && data_len != 0);
86
87 qd = gc->proto_data;
88 81
89 if (data[0] != 0) { 82 if (data[0] != 0) {
90 purple_debug_warning("QQ", "Failed sent IM\n"); 83 purple_debug_warning("QQ", "Failed sent IM\n");
91 purple_notify_error(gc, _("Error"), _("Unable to send message."), NULL); 84 purple_notify_error(gc, _("Error"), _("Unable to send message."), NULL);
92 return; 85 return;
378 } 371 }
379 372
380 /* Send ACK if the sys message needs an ACK */ 373 /* Send ACK if the sys message needs an ACK */
381 static void request_server_ack(PurpleConnection *gc, gchar *funct_str, gchar *from, guint16 seq) 374 static void request_server_ack(PurpleConnection *gc, gchar *funct_str, gchar *from, guint16 seq)
382 { 375 {
383 qq_data *qd;
384 guint8 *raw_data; 376 guint8 *raw_data;
385 gint bytes; 377 gint bytes;
386 guint8 bar; 378 guint8 bar;
387 379
388 g_return_if_fail(funct_str != NULL && from != NULL); 380 g_return_if_fail(funct_str != NULL && from != NULL);
389 qd = (qq_data *) gc->proto_data;
390
391 381
392 bar = 0x1e; 382 bar = 0x1e;
393 raw_data = g_newa(guint8, strlen(funct_str) + strlen(from) + 16); 383 raw_data = g_newa(guint8, strlen(funct_str) + strlen(from) + 16);
394 384
395 bytes = 0; 385 bytes = 0;
566 g_free(msg_utf8); 556 g_free(msg_utf8);
567 } 557 }
568 558
569 void qq_update_room(PurpleConnection *gc, guint8 room_cmd, guint32 room_id) 559 void qq_update_room(PurpleConnection *gc, guint8 room_cmd, guint32 room_id)
570 { 560 {
571 qq_data *qd;
572 gint ret; 561 gint ret;
573 562
574 g_return_if_fail (gc != NULL && gc->proto_data != NULL); 563 g_return_if_fail (gc != NULL);
575 qd = (qq_data *) gc->proto_data;
576 564
577 switch (room_cmd) { 565 switch (room_cmd) {
578 case 0: 566 case 0:
579 qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_INFO, room_id, NULL, 0, 567 qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_INFO, room_id, NULL, 0,
580 QQ_CMD_CLASS_UPDATE_ROOM, 0); 568 QQ_CMD_CLASS_UPDATE_ROOM, 0);
597 } 585 }
598 } 586 }
599 587
600 void qq_update_all_rooms(PurpleConnection *gc, guint8 room_cmd, guint32 room_id) 588 void qq_update_all_rooms(PurpleConnection *gc, guint8 room_cmd, guint32 room_id)
601 { 589 {
602 qq_data *qd;
603 gboolean is_new_turn = FALSE; 590 gboolean is_new_turn = FALSE;
604 guint32 next_id; 591 guint32 next_id;
605 592
606 g_return_if_fail (gc != NULL && gc->proto_data != NULL); 593 g_return_if_fail(gc != NULL);
607 qd = (qq_data *) gc->proto_data;
608 594
609 next_id = qq_room_get_next(gc, room_id); 595 next_id = qq_room_get_next(gc, room_id);
610 purple_debug_info("QQ", "Update rooms, next id %u, prev id %u\n", next_id, room_id); 596 purple_debug_info("QQ", "Update rooms, next id %u, prev id %u\n", next_id, room_id);
611 597
612 if (next_id <= 0) { 598 if (next_id <= 0) {
687 qd->online_last_update = time(NULL); 673 qd->online_last_update = time(NULL);
688 } 674 }
689 675
690 static void update_all_rooms_online(PurpleConnection *gc, guint8 room_cmd, guint32 room_id) 676 static void update_all_rooms_online(PurpleConnection *gc, guint8 room_cmd, guint32 room_id)
691 { 677 {
692 qq_data *qd;
693 guint32 next_id; 678 guint32 next_id;
694 679
695 g_return_if_fail (gc != NULL && gc->proto_data != NULL); 680 g_return_if_fail (gc != NULL);
696 qd = (qq_data *) gc->proto_data;
697 681
698 next_id = qq_room_get_next_conv(gc, room_id); 682 next_id = qq_room_get_next_conv(gc, room_id);
699 if (next_id <= 0 && room_id <= 0) { 683 if (next_id <= 0 && room_id <= 0) {
700 purple_debug_info("QQ", "No room in conversation, no update online buddies\n"); 684 purple_debug_info("QQ", "No room in conversation, no update online buddies\n");
701 return; 685 return;