Mercurial > pidgin
comparison libpurple/protocols/qq/qq.h @ 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 | 55f986ccbb6a |
children | 5f454b975a99 |
comparison
equal
deleted
inserted
replaced
23637:21e591b55339 | 23638:1c50f12b1c52 |
---|---|
32 #include "dnsquery.h" | 32 #include "dnsquery.h" |
33 #include "dnssrv.h" | 33 #include "dnssrv.h" |
34 #include "proxy.h" | 34 #include "proxy.h" |
35 #include "roomlist.h" | 35 #include "roomlist.h" |
36 | 36 |
37 #define QQ_FACES 100 | |
38 #define QQ_KEY_LENGTH 16 | 37 #define QQ_KEY_LENGTH 16 |
39 #define QQ_DEBUG 1 /* whether we are doing DEBUG */ | 38 #define QQ_DEBUG 1 /* whether we are doing DEBUG */ |
40 | 39 |
41 #ifdef _WIN32 | 40 #ifdef _WIN32 |
42 const char *qq_win32_buddy_icon_dir(void); | 41 const char *qq_win32_buddy_icon_dir(void); |
43 #define QQ_BUDDY_ICON_DIR qq_win32_buddy_icon_dir() | 42 #define QQ_BUDDY_ICON_DIR qq_win32_buddy_icon_dir() |
44 #endif | 43 #endif |
45 | 44 |
46 typedef struct _qq_data qq_data; | 45 typedef struct _qq_data qq_data; |
47 typedef struct _qq_buddy qq_buddy; | 46 typedef struct _qq_buddy qq_buddy; |
47 typedef struct _qq_interval qq_interval; | |
48 | |
49 struct _qq_interval { | |
50 gint resend; | |
51 gint keep_alive; | |
52 gint update; | |
53 }; | |
48 | 54 |
49 struct _qq_buddy { | 55 struct _qq_buddy { |
50 guint32 uid; | 56 guint32 uid; |
51 guint16 face; /* index: 0 - 299 */ | 57 guint16 face; /* index: 0 - 299 */ |
52 guint8 age; | 58 guint8 age; |
53 guint8 gender; | 59 guint8 gender; |
54 gchar *nickname; | 60 gchar *nickname; |
55 guint8 ip[4]; | 61 struct in_addr ip; |
56 guint16 port; | 62 guint16 port; |
57 guint8 status; | 63 guint8 status; |
58 guint8 flag1; | 64 guint8 ext_flag; |
59 guint8 comm_flag; /* details in qq_buddy_list.c */ | 65 guint8 comm_flag; /* details in qq_buddy_list.c */ |
60 guint16 client_version; | 66 guint16 client_version; |
61 guint8 onlineTime; | 67 guint8 onlineTime; |
62 guint16 level; | 68 guint16 level; |
63 guint16 timeRemainder; | 69 guint16 timeRemainder; |
86 | 92 |
87 PurpleProxyConnectData *connect_data; | 93 PurpleProxyConnectData *connect_data; |
88 gint fd; /* socket file handler */ | 94 gint fd; /* socket file handler */ |
89 gint tx_handler; /* socket can_write handle, use in udp connecting and tcp send out */ | 95 gint tx_handler; /* socket can_write handle, use in udp connecting and tcp send out */ |
90 | 96 |
91 GList *send_trans; /* check ack packet and resend */ | 97 qq_interval itv_config; |
92 guint resend_timeout; | 98 qq_interval itv_count; |
99 guint network_timeout; | |
100 | |
101 GList *transactions; /* check ack packet and resend */ | |
93 | 102 |
94 guint8 rcv_window[1 << 13]; /* windows for check duplicate packet */ | |
95 GQueue *rcv_trans; /* queue to store packet can not process before login */ | |
96 | |
97 /* tcp related */ | 103 /* tcp related */ |
98 PurpleCircBuffer *tcp_txbuf; | 104 PurpleCircBuffer *tcp_txbuf; |
99 guint8 *tcp_rxqueue; | 105 guint8 *tcp_rxqueue; |
100 int tcp_rxlen; | 106 int tcp_rxlen; |
101 | 107 |
102 /* udp related */ | 108 /* udp related */ |
103 PurpleDnsQueryData *udp_query_data; | 109 PurpleDnsQueryData *udp_query_data; |
104 | 110 |
105 guint32 uid; /* QQ number */ | 111 guint32 uid; /* QQ number */ |
106 guint8 *inikey; /* initial key to encrypt login packet */ | 112 guint8 *token; /* get from server*/ |
107 guint8 *pwkey; /* password in md5 (or md5' md5) */ | 113 int token_len; |
108 guint8 *session_key; /* later use this as key in this session */ | 114 guint8 inikey[QQ_KEY_LENGTH]; /* initial key to encrypt login packet */ |
109 guint8 *session_md5; /* concatenate my uid with session_key and md5 it */ | 115 guint8 password_twice_md5[QQ_KEY_LENGTH]; /* password in md5 (or md5' md5) */ |
116 guint8 session_key[QQ_KEY_LENGTH]; /* later use this as key in this session */ | |
117 guint8 session_md5[QQ_KEY_LENGTH]; /* concatenate my uid with session_key and md5 it */ | |
110 | 118 |
111 guint16 send_seq; /* send sequence number */ | 119 guint16 send_seq; /* send sequence number */ |
112 guint8 login_mode; /* online of invisible */ | 120 guint8 login_mode; /* online of invisible */ |
113 gboolean logged_in; /* used by qq-add_buddy */ | 121 gboolean logged_in; /* used by qq-add_buddy */ |
114 | 122 |
117 /* get from login reply packet */ | 125 /* get from login reply packet */ |
118 time_t login_time; | 126 time_t login_time; |
119 time_t last_login_time; | 127 time_t last_login_time; |
120 gchar *last_login_ip; | 128 gchar *last_login_ip; |
121 /* get from keep_alive packet */ | 129 /* get from keep_alive packet */ |
122 gchar *my_ip; /* my ip address detected by server */ | 130 struct in_addr my_ip; /* my ip address detected by server */ |
123 guint16 my_port; /* my port detected by server */ | 131 guint16 my_port; /* my port detected by server */ |
124 guint16 my_icon; /* my icon index */ | 132 guint16 my_icon; /* my icon index */ |
125 guint16 my_level; /* my level */ | 133 guint16 my_level; /* my level */ |
126 guint32 all_online; /* the number of online QQ users */ | 134 guint32 total_online; /* the number of online QQ users */ |
127 time_t last_get_online; /* last time send get_friends_online packet */ | 135 time_t last_get_online; /* last time send get_friends_online packet */ |
128 | 136 |
129 PurpleRoomlist *roomlist; | 137 PurpleRoomlist *roomlist; |
130 gint channel; /* the id for opened chat conversation */ | 138 gint channel; /* the id for opened chat conversation */ |
131 | 139 |