comparison libpurple/protocols/qq/qq.c @ 24068:87e61a85f5dd

2008.09.28 - ccpaging <ccpaging(at)gmail.com> * The source is only for debug, not for user: 1. Implement new QQ protocol 2007/2008, include login and change status 2. Check 2005's login reply packet, get last 3 login time. 3. Server's notice and news is displayed in self buddy (The new buddy created in buddy list). 4. The notice messages when adding/removing QQ Qun's buddy displayed in char conversation. They are displayed as purple notify windows in the past. 5. The notice messages when adding/removing buddy displayed in self buddy's conversation. They are displayed as purple notify windows in the past. 6. Client version can be selected in account option. Now only qq2005 is working, other new version is only for debug.
author SHiNE CsyFeK <csyfek@gmail.com>
date Wed, 22 Oct 2008 14:40:04 +0000
parents dbc7a9742f8d
children 832178d951ca
comparison
equal deleted inserted replaced
24067:fc546485fae7 24068:87e61a85f5dd
553 static void action_show_account_info(PurplePluginAction *action) 553 static void action_show_account_info(PurplePluginAction *action)
554 { 554 {
555 PurpleConnection *gc = (PurpleConnection *) action->context; 555 PurpleConnection *gc = (PurpleConnection *) action->context;
556 qq_data *qd; 556 qq_data *qd;
557 GString *info; 557 GString *info;
558 struct tm *tm_local;
559 int index;
558 560
559 qd = (qq_data *) gc->proto_data; 561 qd = (qq_data *) gc->proto_data;
560 info = g_string_new("<html><body>"); 562 info = g_string_new("<html><body>");
561 563
562 g_string_append_printf(info, _("<b>This Login</b>: %s<br>\n"), ctime(&qd->login_time)); 564 tm_local = localtime(&qd->login_time);
565 g_string_append_printf(info, _("<b>Login time</b>: %d-%d-%d, %d:%d:%d<br>\n"),
566 (1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday,
567 tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec);
563 g_string_append_printf(info, _("<b>Online Buddies</b>: %d<br>\n"), qd->online_total); 568 g_string_append_printf(info, _("<b>Online Buddies</b>: %d<br>\n"), qd->online_total);
564 g_string_append_printf(info, _("<b>Last Refresh</b>: %s<br>\n"), ctime(&qd->online_last_update)); 569 tm_local = localtime(&qd->online_last_update);
570 g_string_append_printf(info, _("<b>Last Refresh</b>: %d-%d-%d, %d:%d:%d<br>\n"),
571 (1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday,
572 tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec);
565 573
566 g_string_append(info, "<hr>"); 574 g_string_append(info, "<hr>");
567 575
568 g_string_append_printf(info, _("<b>Server</b>: %s<br>\n"), qd->curr_server); 576 g_string_append_printf(info, _("<b>Server</b>: %s<br>\n"), qd->curr_server);
569 g_string_append_printf(info, _("<b>Client Tag</b>: %s<br>\n"), qq_get_ver_desc(qd->client_tag)); 577 g_string_append_printf(info, _("<b>Client Tag</b>: %s<br>\n"), qq_get_ver_desc(qd->client_tag));
577 g_string_append_printf(info, _("<b>Lost</b>: %lu<br>\n"), qd->net_stat.lost); 585 g_string_append_printf(info, _("<b>Lost</b>: %lu<br>\n"), qd->net_stat.lost);
578 g_string_append_printf(info, _("<b>Received</b>: %lu<br>\n"), qd->net_stat.rcved); 586 g_string_append_printf(info, _("<b>Received</b>: %lu<br>\n"), qd->net_stat.rcved);
579 g_string_append_printf(info, _("<b>Received Duplicate</b>: %lu<br>\n"), qd->net_stat.rcved_dup); 587 g_string_append_printf(info, _("<b>Received Duplicate</b>: %lu<br>\n"), qd->net_stat.rcved_dup);
580 588
581 g_string_append(info, "<hr>"); 589 g_string_append(info, "<hr>");
582 g_string_append(info, "<i>Information below may not be accurate</i><br>\n"); 590 g_string_append(info, "<i>Last Login Information</i><br>\n");
583 591
584 g_string_append_printf(info, _("<b>Last Login</b>: %s\n"), ctime(&qd->last_login_time)); 592 for (index = 0; index < sizeof(qd->last_login_time) / sizeof(time_t); index++) {
585 g_string_append_printf(info, _("<b>Last Login IP</b>: %s<br>\n"), qd->last_login_ip); 593 tm_local = localtime(&qd->last_login_time[index]);
594 g_string_append_printf(info, _("<b>Time</b>: %d-%d-%d, %d:%d:%d<br>\n"),
595 (1900 +tm_local->tm_year), (1 + tm_local->tm_mon), tm_local->tm_mday,
596 tm_local->tm_hour, tm_local->tm_min, tm_local->tm_sec);
597 }
598 if (qd->last_login_ip.s_addr != 0) {
599 g_string_append_printf(info, _("<b>IP</b>: %s<br>\n"), inet_ntoa(qd->last_login_ip));
600 }
586 601
587 g_string_append(info, "</body></html>"); 602 g_string_append(info, "</body></html>");
588 603
589 purple_notify_formatted(gc, NULL, _("Login Information"), NULL, info->str, NULL, NULL); 604 purple_notify_formatted(gc, NULL, _("Login Information"), NULL, info->str, NULL, NULL);
590 605