comparison libpurple/protocols/qq/qq.c @ 23881:69c218fd5d54

applied changes from 5688199e261449d33b5803dafff50d860896ebcb through 5316525f53e27f838d18a6a08b82c7d55f674591 Reapplied 5316525f53e27f838d18a6a08b82c7d55f674591 2008.09.11 - csyfek <csyfek(at)gmail.com> * Commit to Pidgin 2008.09.05 - ccpaging <ccpaging(at)gmail.com> * Filter chars 0x01-0x20 in nickname 2008.09.05 - ccpaging <ccpaging(at)gmail.com> * Fixed compilation even pidgin-udp-patch not applied * Place and analysis 'before login packet' after login. packages will be updated slowly and server may send lots of 'server command packet', while 'before login packet' is placed after 'finished update' committer: Daniel Atallah <daniel.atallah@gmail.com>
author SHiNE CsyFeK <csyfek@gmail.com>
date Mon, 15 Sep 2008 03:03:11 +0000
parents 1a0caf9983fa
children bcfc98c7a55f
comparison
equal deleted inserted replaced
23880:1a0caf9983fa 23881:69c218fd5d54
155 purple_debug_info("QQ", "Server list has %d\n", g_list_length(qd->servers)); 155 purple_debug_info("QQ", "Server list has %d\n", g_list_length(qd->servers));
156 156
157 qd->is_show_notice = purple_account_get_bool(account, "show_notice", TRUE); 157 qd->is_show_notice = purple_account_get_bool(account, "show_notice", TRUE);
158 qd->is_show_news = purple_account_get_bool(account, "show_news", TRUE); 158 qd->is_show_news = purple_account_get_bool(account, "show_news", TRUE);
159 159
160 qd->itv_config.resend = purple_account_get_int(account, "resend_interval", 10); 160 qd->resend_times = purple_prefs_get_int("/plugins/prpl/qq/resend_times");
161 if (qd->itv_config.resend <= 0) qd->itv_config.resend = 10; 161 if (qd->resend_times <= 1) qd->itv_config.resend = 4;
162
163 qd->itv_config.resend = purple_prefs_get_int("/plugins/prpl/qq/resend_interval");
164 if (qd->itv_config.resend <= 0) qd->itv_config.resend = 3;
165 purple_debug_info("QQ", "Resend interval %d, retries %d\n",
166 qd->itv_config.resend, qd->resend_times);
162 167
163 qd->itv_config.keep_alive = purple_account_get_int(account, "keep_alive_interval", 60); 168 qd->itv_config.keep_alive = purple_account_get_int(account, "keep_alive_interval", 60);
164 if (qd->itv_config.keep_alive < 30) qd->itv_config.keep_alive = 30; 169 if (qd->itv_config.keep_alive < 30) qd->itv_config.keep_alive = 30;
165 qd->itv_config.keep_alive /= qd->itv_config.resend; 170 qd->itv_config.keep_alive /= qd->itv_config.resend;
166 qd->itv_count.keep_alive = qd->itv_config.keep_alive; 171 qd->itv_count.keep_alive = qd->itv_config.keep_alive;
516 _("Block"), G_CALLBACK(qq_block_buddy_with_gc_and_uid)); 521 _("Block"), G_CALLBACK(qq_block_buddy_with_gc_and_uid));
517 } 522 }
518 */ 523 */
519 524
520 /* show a brief summary of what we get from login packet */ 525 /* show a brief summary of what we get from login packet */
521 static void _qq_menu_show_login_info(PurplePluginAction *action) 526 static void _qq_menu_account_info(PurplePluginAction *action)
522 { 527 {
523 PurpleConnection *gc = (PurpleConnection *) action->context; 528 PurpleConnection *gc = (PurpleConnection *) action->context;
524 qq_data *qd; 529 qq_data *qd;
525 GString *info; 530 GString *info;
526 531
532 537
533 g_string_append(info, "<hr>\n"); 538 g_string_append(info, "<hr>\n");
534 539
535 g_string_append_printf(info, _("<b>Server</b>: %s<br>\n"), qd->curr_server); 540 g_string_append_printf(info, _("<b>Server</b>: %s<br>\n"), qd->curr_server);
536 g_string_append_printf(info, _("<b>Connection Mode</b>: %s<br>\n"), qd->use_tcp ? "TCP" : "UDP"); 541 g_string_append_printf(info, _("<b>Connection Mode</b>: %s<br>\n"), qd->use_tcp ? "TCP" : "UDP");
537 g_string_append_printf(info, _("<b>My Public IP</b>: %s<br>\n"), inet_ntoa(qd->my_ip)); 542 g_string_append_printf(info, _("<b>My Internet Address</b>: %s<br>\n"), inet_ntoa(qd->my_ip));
543
544 g_string_append(info, "<hr>\n");
545 g_string_append(info, "<i>Network Status</i><br>\n");
546 g_string_append_printf(info, _("<b>Sent</b>: %lu<br>\n"), qd->net_stat.sent);
547 g_string_append_printf(info, _("<b>Resend</b>: %lu<br>\n"), qd->net_stat.resend);
548 g_string_append_printf(info, _("<b>Lost</b>: %lu<br>\n"), qd->net_stat.lost);
549 g_string_append_printf(info, _("<b>Received</b>: %lu<br>\n"), qd->net_stat.rcved);
550 g_string_append_printf(info, _("<b>Received Duplicate</b>: %lu<br>\n"), qd->net_stat.rcved_dup);
538 551
539 g_string_append(info, "<hr>\n"); 552 g_string_append(info, "<hr>\n");
540 g_string_append(info, "<i>Information below may not be accurate</i><br>\n"); 553 g_string_append(info, "<i>Information below may not be accurate</i><br>\n");
541 554
542 g_string_append_printf(info, _("<b>Login Time</b>: %s<br>\n"), ctime(&qd->login_time)); 555 g_string_append_printf(info, _("<b>Login Time</b>: %s<br>\n"), ctime(&qd->login_time));
625 m = g_list_append(m, act); 638 m = g_list_append(m, act);
626 639
627 act = purple_plugin_action_new(_("Change Password"), _qq_menu_change_password); 640 act = purple_plugin_action_new(_("Change Password"), _qq_menu_change_password);
628 m = g_list_append(m, act); 641 m = g_list_append(m, act);
629 642
630 act = purple_plugin_action_new(_("Show Login Information"), _qq_menu_show_login_info); 643 act = purple_plugin_action_new(_("Account Information"), _qq_menu_account_info);
631 m = g_list_append(m, act); 644 m = g_list_append(m, act);
632 645
633 /* 646 /*
634 act = purple_plugin_action_new(_("Qun: Search a permanent Qun"), _qq_menu_search_or_add_permanent_group); 647 act = purple_plugin_action_new(_("Qun: Search a permanent Qun"), _qq_menu_search_or_add_permanent_group);
635 m = g_list_append(m, act); 648 m = g_list_append(m, act);
852 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); 865 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
853 866
854 option = purple_account_option_bool_new(_("Show server news"), "show_news", TRUE); 867 option = purple_account_option_bool_new(_("Show server news"), "show_news", TRUE);
855 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); 868 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
856 869
857 option = purple_account_option_int_new(_("Resend interval(s)"), "resend_interval", 10);
858 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
859
860 option = purple_account_option_int_new(_("Keep alive interval(s)"), "keep_alive_interval", 60); 870 option = purple_account_option_int_new(_("Keep alive interval(s)"), "keep_alive_interval", 60);
861 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); 871 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
862 872
863 option = purple_account_option_int_new(_("Update interval(s)"), "update_interval", 300); 873 option = purple_account_option_int_new(_("Update interval(s)"), "update_interval", 300);
864 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); 874 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
867 877
868 purple_prefs_add_none("/plugins/prpl/qq"); 878 purple_prefs_add_none("/plugins/prpl/qq");
869 purple_prefs_add_bool("/plugins/prpl/qq/show_status_by_icon", TRUE); 879 purple_prefs_add_bool("/plugins/prpl/qq/show_status_by_icon", TRUE);
870 purple_prefs_add_bool("/plugins/prpl/qq/show_fake_video", FALSE); 880 purple_prefs_add_bool("/plugins/prpl/qq/show_fake_video", FALSE);
871 purple_prefs_add_bool("/plugins/prpl/qq/show_room_when_newin", TRUE); 881 purple_prefs_add_bool("/plugins/prpl/qq/show_room_when_newin", TRUE);
872 882 purple_prefs_add_int("/plugins/prpl/qq/resend_interval", 3);
883 purple_prefs_add_int("/plugins/prpl/qq/resend_times", 4);
873 } 884 }
874 885
875 PURPLE_INIT_PLUGIN(qq, init_plugin, info); 886 PURPLE_INIT_PLUGIN(qq, init_plugin, info);