| 90 data = g_newa(guint8, len); |
90 data = g_newa(guint8, len); |
| 91 msg_utf8 = NULL; |
91 msg_utf8 = NULL; |
| 92 |
92 |
| 93 _qq_show_packet("Processing unknown packet", buf, len); |
93 _qq_show_packet("Processing unknown packet", buf, len); |
| 94 if (qq_decrypt(buf, buf_len, qd->session_key, data, &len)) { |
94 if (qq_decrypt(buf, buf_len, qd->session_key, data, &len)) { |
| 95 gchar *hex_dump = hex_dump_to_str(data, len); |
95 qq_hex_dump(PURPLE_DEBUG_WARNING, "QQ", |
| 96 purple_debug(PURPLE_DEBUG_WARNING, "QQ", |
96 data, len, |
| 97 ">>> [%d] %s, %d bytes -> [default] decrypt and dump\n%s", |
97 ">>> [%d] %s -> [default] decrypt and dump", |
| 98 seq, qq_get_cmd_desc(cmd), buf_len, hex_dump); |
98 seq, qq_get_cmd_desc(cmd)); |
| 99 g_free(hex_dump); |
|
| 100 try_dump_as_gbk(data, len); |
99 try_dump_as_gbk(data, len); |
| 101 } else { |
100 } else { |
| 102 purple_debug(PURPLE_DEBUG_ERROR, "QQ", "Fail decrypt packet with default process\n"); |
101 purple_debug(PURPLE_DEBUG_ERROR, "QQ", "Fail decrypt packet with default process\n"); |
| 103 } |
102 } |
| 104 } |
103 } |
| 116 |
115 |
| 117 qd = (qq_data *) gc->proto_data; |
116 qd = (qq_data *) gc->proto_data; |
| 118 bytes_expected = qd->use_tcp ? QQ_TCP_HEADER_LENGTH : QQ_UDP_HEADER_LENGTH; |
117 bytes_expected = qd->use_tcp ? QQ_TCP_HEADER_LENGTH : QQ_UDP_HEADER_LENGTH; |
| 119 |
118 |
| 120 if (buf_len < bytes_expected) { |
119 if (buf_len < bytes_expected) { |
| 121 gchar *hex_dump = hex_dump_to_str(buf, buf_len); |
120 qq_hex_dump(PURPLE_DEBUG_ERROR, "QQ", |
| 122 purple_debug(PURPLE_DEBUG_ERROR, |
121 buf, buf_len, |
| 123 "QQ", "Received packet is too short, dump and drop\n%s", hex_dump); |
122 "Received packet is too short, dump and drop"); |
| 124 g_free(hex_dump); |
|
| 125 return; |
123 return; |
| 126 } |
124 } |
| 127 |
125 |
| 128 /* initialize */ |
126 /* initialize */ |
| 129 bytes = 0; |
127 bytes = 0; |
| 151 bytes_expected, bytes); |
149 bytes_expected, bytes); |
| 152 return; |
150 return; |
| 153 } |
151 } |
| 154 |
152 |
| 155 if ((buf[buf_len - 1] != QQ_PACKET_TAIL) || (header.header_tag != QQ_PACKET_TAG)) { |
153 if ((buf[buf_len - 1] != QQ_PACKET_TAIL) || (header.header_tag != QQ_PACKET_TAG)) { |
| 156 gchar *hex_dump = hex_dump_to_str(buf, buf_len); |
154 qq_hex_dump(PURPLE_DEBUG_ERROR, "QQ", |
| 157 purple_debug(PURPLE_DEBUG_ERROR, |
155 buf, buf_len, |
| 158 "QQ", "Unknown QQ proctocol, dump and drop\n%s", hex_dump); |
156 "Unknown QQ proctocol, dump and drop"); |
| 159 g_free(hex_dump); |
|
| 160 return; |
157 return; |
| 161 } |
158 } |
| 162 |
159 |
| 163 if (QQ_DEBUG) |
160 if (QQ_DEBUG) |
| 164 purple_debug(PURPLE_DEBUG_INFO, "QQ", |
161 purple_debug(PURPLE_DEBUG_INFO, "QQ", |