Mercurial > pidgin
comparison libpurple/protocols/qq/qq_trans.c @ 23879:23cec4360d4a
applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
through 92d52eef2994d2697999177804e3665989cfa352
Reapplied 92d52eef2994d2697999177804e3665989cfa352 at the right time.
2008.09.02 - ccpaging <ccpaging(at)gmail.com>
* Bugfix: can not send message to the QUN blocked adding
* Tickets:
Fixes #6957
Fixes #6990
2008.09.02 - ccpaging <ccpaging(at)gmail.com>
* Use new tactics of information update:
1. send next package till the previous package received
2. fix duplicated get_room_info and get_room_buddies command
committer: Daniel Atallah <daniel.atallah@gmail.com>
author | SHiNE CsyFeK <csyfek@gmail.com> |
---|---|
date | Mon, 15 Sep 2008 03:01:03 +0000 |
parents | 967344bc404d |
children | 1a0caf9983fa 6408be948d56 |
comparison
equal
deleted
inserted
replaced
23878:967344bc404d | 23879:23cec4360d4a |
---|---|
38 #define QQ_RESEND_MAX 3 /* max resend per packet */ | 38 #define QQ_RESEND_MAX 3 /* max resend per packet */ |
39 | 39 |
40 enum { | 40 enum { |
41 QQ_TRANS_IS_SERVER = 0x01, /* Is server command or client command */ | 41 QQ_TRANS_IS_SERVER = 0x01, /* Is server command or client command */ |
42 QQ_TRANS_IS_IMPORT = 0x02, /* Only notice if not get reply; or resend, disconn if reties get 0*/ | 42 QQ_TRANS_IS_IMPORT = 0x02, /* Only notice if not get reply; or resend, disconn if reties get 0*/ |
43 QQ_TRANS_BEFORE_LOGIN = 0x04, /* server command before login*/ | 43 QQ_TRANS_REMAINED = 0x04, /* server command before login*/ |
44 }; | 44 }; |
45 | 45 |
46 struct _qq_transaction { | 46 struct _qq_transaction { |
47 guint8 flag; | 47 guint8 flag; |
48 guint16 seq; | 48 guint16 seq; |
223 trans->seq, trans->data, trans->data_len); | 223 trans->seq, trans->data, trans->data_len); |
224 #endif | 224 #endif |
225 qd->transactions = g_list_append(qd->transactions, trans); | 225 qd->transactions = g_list_append(qd->transactions, trans); |
226 } | 226 } |
227 | 227 |
228 void qq_trans_add_server_cmd(PurpleConnection *gc, | 228 void qq_trans_add_server_cmd(PurpleConnection *gc, guint16 cmd, guint16 seq, |
229 guint16 cmd, guint16 seq, guint8 *data, gint data_len) | 229 guint8 *data, gint data_len) |
230 { | 230 { |
231 qq_data *qd = (qq_data *)gc->proto_data; | 231 qq_data *qd = (qq_data *)gc->proto_data; |
232 qq_transaction *trans = trans_create(gc, qd->fd, cmd, seq, data, data_len, QQ_CMD_CLASS_NONE, 0); | 232 qq_transaction *trans = trans_create(gc, qd->fd, cmd, seq, data, data_len, QQ_CMD_CLASS_NONE, 0); |
233 | 233 |
234 trans->flag = QQ_TRANS_IS_SERVER; | 234 trans->flag = QQ_TRANS_IS_SERVER; |
235 if ( !qd->is_login ) { | |
236 trans->flag |= QQ_TRANS_BEFORE_LOGIN; | |
237 } | |
238 trans->send_retries = 0; | 235 trans->send_retries = 0; |
239 trans->rcved_times = 1; | 236 trans->rcved_times = 1; |
240 #if 0 | 237 #if 0 |
241 purple_debug_info("QQ_TRANS", "Add server cmd, seq %d, data %p, len %d\n", | 238 purple_debug_info("QQ_TRANS", "Add server cmd, seq %d, data %p, len %d\n", |
242 trans->seq, trans->data, trans->data_len); | 239 trans->seq, trans->data, trans->data_len); |
243 #endif | 240 #endif |
244 qd->transactions = g_list_append(qd->transactions, trans); | 241 qd->transactions = g_list_append(qd->transactions, trans); |
245 } | 242 } |
246 | 243 |
247 void qq_trans_process_before_login(PurpleConnection *gc) | 244 void qq_trans_add_remain(PurpleConnection *gc, guint16 cmd, guint16 seq, |
245 guint8 *data, gint data_len) | |
246 { | |
247 qq_data *qd = (qq_data *)gc->proto_data; | |
248 qq_transaction *trans = trans_create(gc, qd->fd, cmd, seq, data, data_len, QQ_CMD_CLASS_NONE, 0); | |
249 | |
250 trans->flag = QQ_TRANS_IS_SERVER; | |
251 trans->flag |= QQ_TRANS_REMAINED; | |
252 trans->send_retries = 0; | |
253 trans->rcved_times = 1; | |
254 #if 1 | |
255 purple_debug_info("QQ_TRANS", "Add server cmd and remained, seq %d, data %p, len %d\n", | |
256 trans->seq, trans->data, trans->data_len); | |
257 #endif | |
258 qd->transactions = g_list_append(qd->transactions, trans); | |
259 } | |
260 | |
261 void qq_trans_process_remained(PurpleConnection *gc) | |
248 { | 262 { |
249 qq_data *qd = (qq_data *)gc->proto_data; | 263 qq_data *qd = (qq_data *)gc->proto_data; |
250 GList *curr; | 264 GList *curr; |
251 GList *next; | 265 GList *next; |
252 qq_transaction *trans; | 266 qq_transaction *trans; |
261 purple_debug_info("QQ_TRANS", "Scan [%d]\n", trans->seq); | 275 purple_debug_info("QQ_TRANS", "Scan [%d]\n", trans->seq); |
262 #endif | 276 #endif |
263 if ( !(trans->flag & QQ_TRANS_IS_SERVER) ) { | 277 if ( !(trans->flag & QQ_TRANS_IS_SERVER) ) { |
264 continue; | 278 continue; |
265 } | 279 } |
266 if ( !(trans->flag & QQ_TRANS_BEFORE_LOGIN) ) { | 280 if ( !(trans->flag & QQ_TRANS_REMAINED) ) { |
267 continue; | 281 continue; |
268 } | 282 } |
269 /* set QQ_TRANS_BEFORE_LOGIN off */ | 283 /* set QQ_TRANS_REMAINED off */ |
270 trans->flag &= ~QQ_TRANS_BEFORE_LOGIN; | 284 trans->flag &= ~QQ_TRANS_REMAINED; |
271 | 285 |
286 #if 1 | |
272 purple_debug_info("QQ_TRANS", | 287 purple_debug_info("QQ_TRANS", |
273 "Process server cmd before login, seq %d, data %p, len %d, send_retries %d\n", | 288 "Process server cmd remained, seq %d, data %p, len %d, send_retries %d\n", |
274 trans->seq, trans->data, trans->data_len, trans->send_retries); | 289 trans->seq, trans->data, trans->data_len, trans->send_retries); |
275 | 290 #endif |
276 qq_proc_cmd_reply(gc, trans->seq, trans->cmd, trans->data, trans->data_len, trans->update_class, trans->ship32); | 291 qq_proc_server_cmd(gc, trans->cmd, trans->seq, trans->data, trans->data_len); |
277 } | 292 } |
278 | 293 |
279 /* purple_debug_info("QQ_TRANS", "Scan finished\n"); */ | 294 /* purple_debug_info("QQ_TRANS", "Scan finished\n"); */ |
280 return; | 295 return; |
281 } | 296 } |
293 while( (curr = next) ) { | 308 while( (curr = next) ) { |
294 next = curr->next; | 309 next = curr->next; |
295 trans = (qq_transaction *) (curr->data); | 310 trans = (qq_transaction *) (curr->data); |
296 /* purple_debug_info("QQ_TRANS", "Scan [%d]\n", trans->seq); */ | 311 /* purple_debug_info("QQ_TRANS", "Scan [%d]\n", trans->seq); */ |
297 | 312 |
298 if (trans->flag & QQ_TRANS_BEFORE_LOGIN) { | 313 if (trans->flag & QQ_TRANS_REMAINED) { |
299 /* keep server cmd before login*/ | 314 /* keep server cmd before login*/ |
300 continue; | 315 continue; |
301 } | 316 } |
302 | 317 |
303 trans->scan_times++; | 318 trans->scan_times++; |