comparison libpurple/protocols/qq/send_file.c @ 23638:1c50f12b1c52

2008.08.02 - csyfek <csyfek(at)gmail.com> * Commit to Pidgin * Tickets: Fixes #1861 Fixes #1902 References #5112 2008.08.02 - ccpaging <ecc_hy(at)hotmail.com> * Store all keys and md5 values of qq_data in char[QQ_KEY_LENGTH] * Use random value in inikey * TEA header padding in crypt.c * Rewrite login part of qq_process 2008.07.31 - ccpaging <ecc_hy(at)hotmail.com> * Fixed: send reply when get duplicate server command. The server may not get our reply before. * Tag custom picture as text "(Broken)" 2008.07.30 - ccpaging <ecc_hy(at)hotmail.com>, csyfek <csyfek(at)gmail.com> * Change some debug message * Modify buddy status flag according to eva for QQ2006 * Modify buddy status parse and correspond to eva2 * Add getIP/putIP functions to packet_parse.c, and replace some gen_ip_str * Replace guint32 *ip with struct in_addr, and reduce g_new/g_free operation * Source file changed: Merge buddy_status into buddy_list Change login_logout to qq_base Merge keep_alive into qq_base New qq_process extract from qq_network * Fixed: Byte alignment bug in crypt.c, tested in ARM PDA * Fixed: group chat message may get in before getting group info, and so group info is empty * Add qq_send_cmd_group_get_group_info when joined a group chat in group_im.c * Add some new group command identify according eva but further program * Add some new QQ client version identify * Fixed: Identify buddy's client version by IM packet, and not by status * Add some new info in buddy's tooltip text * Add video falg to buddy's emblem. But those flag in buddy status may not prasing correctly * Use new timeout function to handle send keep_alive, resend packet, update buddy status * Add new advanced options: The end user may change interval of keep_alive, resend packet, update buddy status to feed their need. For example, saving network flow when use mobile phone. Keep alive packet must be sent in 60-120 seconds whatever client rcved data of not. The intervals of keep alive and update status should be multiple of resend's interval, Since we use counter not time() in a single timeout function for efficiency. * Rewrite qq_trans.c, and use one g_list to manage: Store server packet before login, and prase all of them when get login Store client send packet for resend scanning, confirm server reply, filter duplicate server reply Store server packet for filter out duplicate * Add QQ_MSG_SYS_NOTICE = 0x06 in sys_msg.c * Rewrite qq_proc_cmd_reply and qq_proc_cmd_server: In QQ protocol, one packet reply may need a new packet send later. We may call it packet trigger. The triggers always is hided in every qq_process_reply. Now we try to extract those triggers and put into a single function, and then every trigger should be obviously and easy to manage.
author SHiNE CsyFeK <csyfek@gmail.com>
date Sat, 02 Aug 2008 15:00:46 +0000
parents bdb38a8bf721
children 5f454b975a99
comparison
equal deleted inserted replaced
23637:21e591b55339 23638:1c50f12b1c52
27 #include "send_file.h" 27 #include "send_file.h"
28 #include "debug.h" 28 #include "debug.h"
29 #include "network.h" 29 #include "network.h"
30 #include "notify.h" 30 #include "notify.h"
31 31
32 #include "buddy_status.h" 32 #include "buddy_list.h"
33 #include "crypt.h" 33 #include "crypt.h"
34 #include "file_trans.h" 34 #include "file_trans.h"
35 #include "header_info.h" 35 #include "header_info.h"
36 #include "im.h" 36 #include "im.h"
37 #include "keep_alive.h" 37 #include "qq_base.h"
38 #include "packet_parse.h" 38 #include "packet_parse.h"
39 #include "qq_network.h" 39 #include "qq_network.h"
40 #include "utils.h" 40 #include "utils.h"
41 41
42 enum 42 enum
445 qd = (qq_data *) gc->proto_data; 445 qd = (qq_data *) gc->proto_data;
446 446
447 info = g_new0(ft_info, 1); 447 info = g_new0(ft_info, 1);
448 info->to_uid = to_uid; 448 info->to_uid = to_uid;
449 info->send_seq = qd->send_seq; 449 info->send_seq = qd->send_seq;
450 info->local_internet_ip = g_ntohl(inet_addr(qd->my_ip)); 450 info->local_internet_ip = qd->my_ip.s_addr;
451 info->local_internet_port = qd->my_port; 451 info->local_internet_port = qd->my_port;
452 info->local_real_ip = 0x00000000; 452 info->local_real_ip = 0x00000000;
453 info->conn_method = 0x00; 453 info->conn_method = 0x00;
454 qd->xfer->data = info; 454 qd->xfer->data = info;
455 455
782 782
783 g_return_if_fail (data != NULL && data_len != 0); 783 g_return_if_fail (data != NULL && data_len != 0);
784 qd = (qq_data *) gc->proto_data; 784 qd = (qq_data *) gc->proto_data;
785 785
786 info = g_newa(ft_info, 1); 786 info = g_newa(ft_info, 1);
787 info->local_internet_ip = g_ntohl(inet_addr(qd->my_ip)); 787 info->local_internet_ip = qd->my_ip.s_addr;
788 info->local_internet_port = qd->my_port; 788 info->local_internet_port = qd->my_port;
789 info->local_real_ip = 0x00000000; 789 info->local_real_ip = 0x00000000;
790 info->to_uid = sender_uid; 790 info->to_uid = sender_uid;
791 791
792 if (data_len <= 2 + 30 + QQ_CONN_INFO_LEN) { 792 if (data_len <= 2 + 30 + QQ_CONN_INFO_LEN) {
812 812
813 b = purple_find_buddy(gc->account, sender_name); 813 b = purple_find_buddy(gc->account, sender_name);
814 q_bud = (b == NULL) ? NULL : (qq_buddy *) b->proto_data; 814 q_bud = (b == NULL) ? NULL : (qq_buddy *) b->proto_data;
815 if (q_bud) { 815 if (q_bud) {
816 if(0 != info->remote_real_ip) { 816 if(0 != info->remote_real_ip) {
817 g_memmove(q_bud->ip, &info->remote_real_ip, 4); 817 g_memmove(&(q_bud->ip), &info->remote_real_ip, sizeof(q_bud->ip));
818 q_bud->port = info->remote_minor_port; 818 q_bud->port = info->remote_minor_port;
819 } 819 }
820 else if (0 != info->remote_internet_ip) { 820 else if (0 != info->remote_internet_ip) {
821 g_memmove(q_bud->ip, &info->remote_internet_ip, 4); 821 g_memmove(&(q_bud->ip), &info->remote_internet_ip, sizeof(q_bud->ip));
822 q_bud->port = info->remote_major_port; 822 q_bud->port = info->remote_major_port;
823 } 823 }
824 824
825 if(!is_online(q_bud->status)) { 825 if(!is_online(q_bud->status)) {
826 q_bud->status = QQ_BUDDY_ONLINE_INVISIBLE; 826 q_bud->status = QQ_BUDDY_ONLINE_INVISIBLE;
829 else 829 else
830 purple_debug(PURPLE_DEBUG_INFO, "QQ", "buddy %d is already online\n", sender_uid); 830 purple_debug(PURPLE_DEBUG_INFO, "QQ", "buddy %d is already online\n", sender_uid);
831 831
832 } 832 }
833 else 833 else
834 purple_debug(PURPLE_DEBUG_WARNING, "QQ", "buddy %d is not in my friendlist\n", sender_uid); 834 purple_debug(PURPLE_DEBUG_WARNING, "QQ", "buddy %d is not in list\n", sender_uid);
835 835
836 g_free(sender_name); 836 g_free(sender_name);
837 g_strfreev(fileinfo); 837 g_strfreev(fileinfo);
838 return; 838 return;
839 } 839 }