comparison libpurple/protocols/qq/qq_process.c @ 23880:1a0caf9983fa

applied changes from 92d52eef2994d2697999177804e3665989cfa352 through 5688199e261449d33b5803dafff50d860896ebcb Reapplied 5688199e261449d33b5803dafff50d860896ebcb. 2008.09.04 - ccpaging <ccpaging(at)gmail.com> * minor code cleaned committer: Daniel Atallah <daniel.atallah@gmail.com>
author SHiNE CsyFeK <csyfek@gmail.com>
date Mon, 15 Sep 2008 03:02:06 +0000
parents 23cec4360d4a
children 69c218fd5d54
comparison
equal deleted inserted replaced
23879:23cec4360d4a 23880:1a0caf9983fa
76 ">>> [%d] %s -> [default] decrypt and dump", 76 ">>> [%d] %s -> [default] decrypt and dump",
77 seq, qq_get_cmd_desc(cmd)); 77 seq, qq_get_cmd_desc(cmd));
78 78
79 msg_utf8 = try_dump_as_gbk(data, data_len); 79 msg_utf8 = try_dump_as_gbk(data, data_len);
80 if (msg_utf8 != NULL) { 80 if (msg_utf8 != NULL) {
81 purple_notify_info(gc, title, msg_utf8, NULL); 81 purple_notify_info(gc, _("QQ Error"), title, msg_utf8);
82 g_free(msg_utf8); 82 g_free(msg_utf8);
83 } 83 }
84 } 84 }
85 85
86 void qq_proc_server_cmd(PurpleConnection *gc, guint16 cmd, guint16 seq, guint8 *rcved, gint rcved_len) 86 void qq_proc_server_cmd(PurpleConnection *gc, guint16 cmd, guint16 seq, guint8 *rcved, gint rcved_len)
128 } 128 }
129 129
130 static void process_room_cmd_notify(PurpleConnection *gc, 130 static void process_room_cmd_notify(PurpleConnection *gc,
131 guint8 room_cmd, guint8 room_id, guint8 reply, guint8 *data, gint data_len) 131 guint8 room_cmd, guint8 room_id, guint8 reply, guint8 *data, gint data_len)
132 { 132 {
133 gchar *prim;
133 gchar *msg, *msg_utf8; 134 gchar *msg, *msg_utf8;
134 g_return_if_fail(data != NULL && data_len > 0); 135 g_return_if_fail(data != NULL && data_len > 0);
135 136
136 msg = g_strndup((gchar *) data, data_len); /* it will append 0x00 */ 137 msg = g_strndup((gchar *) data, data_len); /* it will append 0x00 */
137 msg_utf8 = qq_to_utf8(msg, QQ_CHARSET_DEFAULT); 138 msg_utf8 = qq_to_utf8(msg, QQ_CHARSET_DEFAULT);
138 g_free(msg); 139 g_free(msg);
139 140
140 msg = g_strdup_printf(_("Command %s(0x%02X) id %d, reply [0x%02X]:\n%s"), 141 prim = g_strdup_printf(_("Error reply of %s(0x%02X)\nRoom %d, reply 0x%02X"),
141 qq_get_room_cmd_desc(room_cmd), room_cmd, room_id, reply, msg_utf8); 142 qq_get_room_cmd_desc(room_cmd), room_cmd, room_id, reply);
142 143
143 purple_notify_error(gc, NULL, _("Invalid QQ Qun reply"), msg); 144 purple_notify_error(gc, _("QQ Qun Command"), prim, msg_utf8);
144 g_free(msg); 145
146 g_free(prim);
145 g_free(msg_utf8); 147 g_free(msg_utf8);
146 } 148 }
147 149
148 void qq_update_room(PurpleConnection *gc, guint8 room_cmd, guint32 room_id) 150 void qq_update_room(PurpleConnection *gc, guint8 room_cmd, guint32 room_id)
149 { 151 {
341 343
342 if (room_id <= 0) { 344 if (room_id <= 0) {
343 purple_debug_warning("QQ", 345 purple_debug_warning("QQ",
344 "Invaild room id, [%05d], 0x%02X %s for %d, len %d\n", 346 "Invaild room id, [%05d], 0x%02X %s for %d, len %d\n",
345 seq, room_cmd, qq_get_room_cmd_desc(room_cmd), room_id, rcved_len); 347 seq, room_cmd, qq_get_room_cmd_desc(room_cmd), room_id, rcved_len);
346 return; 348 /* Some room cmd has no room id, like QQ_ROOM_CMD_SEARCH */
347 } 349 }
348 350
349 if (data_len <= 2) { 351 if (data_len <= 2) {
350 purple_debug_warning("QQ", 352 purple_debug_warning("QQ",
351 "Invaild len of room cmd decrypted, [%05d], 0x%02X %s for %d, len %d\n", 353 "Invaild len of room cmd decrypted, [%05d], 0x%02X %s for %d, len %d\n",