comparison src/protocols/qq/qq.c @ 14015:9516a796ed5f

[gaim-migrate @ 16607] Added a debugging tool for firing custom packets at the QQ server. committer: Tailor Script <tailor@pidgin.im>
author Mark Huetsch <markhuetsch>
date Tue, 01 Aug 2006 17:39:47 +0000
parents 9c5790820ac6
children 39d6d4128599
comparison
equal deleted inserted replaced
14014:9c5790820ac6 14015:9516a796ed5f
49 #include "header_info.h" /* qq_get_cmd_desc */ 49 #include "header_info.h" /* qq_get_cmd_desc */
50 #include "im.h" 50 #include "im.h"
51 #include "keep_alive.h" 51 #include "keep_alive.h"
52 #include "ip_location.h" /* qq_ip_get_location */ 52 #include "ip_location.h" /* qq_ip_get_location */
53 #include "login_logout.h" 53 #include "login_logout.h"
54 #include "packet_parse.h" /* MAX_PACKET_SIZE */
54 #include "qq_proxy.h" /* qq_connect, qq_disconnect */ 55 #include "qq_proxy.h" /* qq_connect, qq_disconnect */
55 #include "send_core.h" 56 #include "send_core.h"
56 #include "qq.h" 57 #include "qq.h"
57 #include "send_file.h" 58 #include "send_file.h"
58 #include "version.h" 59 #include "version.h"
445 qd = (qq_data *) gc->proto_data; 446 qd = (qq_data *) gc->proto_data;
446 //_qq_get_info(gc, uid_to_gaim_name(qd->uid)); 447 //_qq_get_info(gc, uid_to_gaim_name(qd->uid));
447 qq_prepare_modify_info(gc); 448 qq_prepare_modify_info(gc);
448 } 449 }
449 450
450
451 static void _qq_menu_change_password(GaimPluginAction * action) 451 static void _qq_menu_change_password(GaimPluginAction * action)
452 { 452 {
453 gaim_notify_uri(NULL, "https://password.qq.com"); 453 gaim_notify_uri(NULL, "https://password.qq.com");
454 } 454 }
455 455
456 /* remove a buddy from my list and remove myself from his list */ 456 /* remove a buddy from my list and remove myself from his list */
457 /* TODO: re-enable this 457 /* TODO: re-enable this
458 static void _qq_menu_block_buddy(GaimBlistNode * node) 458 static void _qq_menu_block_buddy(GaimBlistNode * node)
661 g_return_if_fail (gc != NULL && gc->proto_data != NULL); 661 g_return_if_fail (gc != NULL && gc->proto_data != NULL);
662 qq_send_file(gc, buddy->name, NULL); 662 qq_send_file(gc, buddy->name, NULL);
663 // } 663 // }
664 } 664 }
665 */ 665 */
666 /*
667 static void _qq_send_custom_packet(GaimConnection *gc, const gchar *packet)
668 {
669 guint16 cmd;
670 guint8 *buffer;
671 gint len;
672
673 if (!packet) {
674 gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Null packet inputted!\n");
675 return;
676 }
677 if (strlen(packet) > MAX_PACKET_SIZE * 2) {
678 gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Packet inputted is too large!\n");
679 return;
680 }
681 if (strlen(packet) < 4) {
682 gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Packet is impossibly short!\n");
683 return;
684 }
685
686 buffer = hex_str_to_bytes(packet);
687 if (!buffer) {
688 gaim_debug(GAIM_DEBUG_ERROR, "QQ", "Invalid packet inputted!\n");
689 return;
690 }
691 // big endian
692 cmd = 256 * buffer[0] + buffer[1];
693 gaim_debug(GAIM_DEBUG_INFO, "QQ", "Inputted CMD: %d\n", cmd);
694
695 len = strlen(buffer) - 2;
696 packet = buffer + 2;
697
698 qq_send_cmd(gc, cmd, TRUE, 0, TRUE, packet, len);
699
700 g_free(buffer);
701 }
702 */
703
704 /* send a custom packet to the server - for protocol testing */
705 /*
706 static void _qq_menu_send_custom_packet(GaimPluginAction *action)
707 {
708 GaimConnection *gc = (GaimConnection *) action->context;
709 g_return_if_fail(gc != NULL);
710 gaim_request_input(gc, _("Send Custom Packet"),
711 _("Enter the packet in hex here"),
712 _("Include the command and everything following"),
713 NULL, FALSE, FALSE, NULL,
714 _("Send"), G_CALLBACK(_qq_send_custom_packet), _("Cancel"), NULL, gc);
715 }
716 */
666 717
667 /* protocol related menus */ 718 /* protocol related menus */
668 static GList *_qq_actions(GaimPlugin * plugin, gpointer context) 719 static GList *_qq_actions(GaimPlugin * plugin, gpointer context)
669 { 720 {
670 GList *m; 721 GList *m;
677 act = gaim_plugin_action_new(_("Change Password"), _qq_menu_change_password); 728 act = gaim_plugin_action_new(_("Change Password"), _qq_menu_change_password);
678 m = g_list_append(m, act); 729 m = g_list_append(m, act);
679 730
680 act = gaim_plugin_action_new(_("Show Login Information"), _qq_menu_show_login_info); 731 act = gaim_plugin_action_new(_("Show Login Information"), _qq_menu_show_login_info);
681 m = g_list_append(m, act); 732 m = g_list_append(m, act);
733
734 /*
735 act = gaim_plugin_action_new(_("Send Custom Packet"), _qq_menu_send_custom_packet);
736 m = g_list_append(m, act);
737 */
682 738
683 /* XXX consider re-enabling this 739 /* XXX consider re-enabling this
684 act = gaim_plugin_action_new(_("Show System Message"), _qq_menu_show_system_message); 740 act = gaim_plugin_action_new(_("Show System Message"), _qq_menu_show_system_message);
685 m = g_list_append(m, act); 741 m = g_list_append(m, act);
686 */ 742 */