| 396 purple_debug(PURPLE_DEBUG_INFO, "QQ", |
395 purple_debug(PURPLE_DEBUG_INFO, "QQ", |
| 397 "Malformed login token reply packet. Packet specifies length of %d, actual length is %d\n", buf[1], buf_len-2); |
396 "Malformed login token reply packet. Packet specifies length of %d, actual length is %d\n", buf[1], buf_len-2); |
| 398 purple_debug(PURPLE_DEBUG_INFO, "QQ", |
397 purple_debug(PURPLE_DEBUG_INFO, "QQ", |
| 399 "Attempting to proceed with the actual packet length.\n"); |
398 "Attempting to proceed with the actual packet length.\n"); |
| 400 } |
399 } |
| 401 hex_dump = hex_dump_to_str(buf+2, buf_len-2); |
400 qq_hex_dump(PURPLE_DEBUG_INFO, "QQ", |
| 402 purple_debug(PURPLE_DEBUG_INFO, "QQ", |
401 buf+2, buf_len-2, |
| 403 "<<< got a token with %d bytes -> [default] decrypt and dump\n%s", buf_len-2, hex_dump); |
402 "<<< got a token -> [default] decrypt and dump"); |
| 404 qq_send_packet_login(gc, buf_len-2, buf+2); |
403 qq_send_packet_login(gc, buf_len-2, buf+2); |
| 405 } else { |
404 } else { |
| 406 purple_debug(PURPLE_DEBUG_ERROR, "QQ", "Unknown request login token reply code : %d\n", buf[0]); |
405 purple_debug(PURPLE_DEBUG_ERROR, "QQ", "Unknown request login token reply code : %d\n", buf[0]); |
| 407 hex_dump = hex_dump_to_str(buf, buf_len); |
406 qq_hex_dump(PURPLE_DEBUG_WARNING, "QQ", |
| 408 purple_debug(PURPLE_DEBUG_WARNING, "QQ", |
407 buf, buf_len, |
| 409 ">>> %d bytes -> [default] decrypt and dump\n%s", |
408 ">>> [default] decrypt and dump"); |
| 410 buf_len, hex_dump); |
|
| 411 try_dump_as_gbk(buf, buf_len); |
409 try_dump_as_gbk(buf, buf_len); |
| 412 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Error requesting login token")); |
410 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Error requesting login token")); |
| 413 } |
411 } |
| 414 g_free(hex_dump); |
|
| 415 } |
412 } |
| 416 |
413 |
| 417 /* send logout packets to QQ server */ |
414 /* send logout packets to QQ server */ |
| 418 void qq_send_packet_logout(PurpleConnection *gc) |
415 void qq_send_packet_logout(PurpleConnection *gc) |
| 419 { |
416 { |
| 431 void qq_process_login_reply(guint8 *buf, gint buf_len, PurpleConnection *gc) |
428 void qq_process_login_reply(guint8 *buf, gint buf_len, PurpleConnection *gc) |
| 432 { |
429 { |
| 433 gint len, ret, bytes; |
430 gint len, ret, bytes; |
| 434 guint8 *data; |
431 guint8 *data; |
| 435 qq_data *qd; |
432 qq_data *qd; |
| 436 gchar *hex_dump; |
|
| 437 |
433 |
| 438 g_return_if_fail(buf != NULL && buf_len != 0); |
434 g_return_if_fail(buf != NULL && buf_len != 0); |
| 439 |
435 |
| 440 qd = (qq_data *) gc->proto_data; |
436 qd = (qq_data *) gc->proto_data; |
| 441 len = buf_len; |
437 len = buf_len; |
| 464 case QQ_LOGIN_REPLY_PWD_ERROR: |
460 case QQ_LOGIN_REPLY_PWD_ERROR: |
| 465 ret = _qq_process_login_wrong_pwd(gc, data, len); |
461 ret = _qq_process_login_wrong_pwd(gc, data, len); |
| 466 break; |
462 break; |
| 467 default: |
463 default: |
| 468 purple_debug(PURPLE_DEBUG_ERROR, "QQ", "Unknown reply code: %d\n", data[0]); |
464 purple_debug(PURPLE_DEBUG_ERROR, "QQ", "Unknown reply code: %d\n", data[0]); |
| 469 hex_dump = hex_dump_to_str(data, len); |
465 qq_hex_dump(PURPLE_DEBUG_WARNING, "QQ", |
| 470 purple_debug(PURPLE_DEBUG_WARNING, "QQ", |
466 data, len, |
| 471 ">>> %d bytes -> [default] decrypt and dump\n%s", |
467 ">>> [default] decrypt and dump"); |
| 472 buf_len, hex_dump); |
|
| 473 g_free(hex_dump); |
|
| 474 try_dump_as_gbk(data, len); |
468 try_dump_as_gbk(data, len); |
| 475 |
469 |
| 476 ret = QQ_LOGIN_REPLY_MISC_ERROR; |
470 ret = QQ_LOGIN_REPLY_MISC_ERROR; |
| 477 } |
471 } |
| 478 } else { /* no idea how to decrypt */ |
472 } else { /* no idea how to decrypt */ |