annotate libpurple/protocols/qq/qq_process.c @ 31460:c62dc6d25802

Add the DigiCert High Assurance CA-3 intermediate CA. For Facebook. Paul already added the other changes required for this but not the cert itself.
author Stu Tomlinson <stu@nosnilmot.com>
date Sun, 10 Apr 2011 02:35:17 +0000
parents 4deef745de87
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1 /**
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
2 * @file qq_network.c
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
3 *
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
4 * purple
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
5 *
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
6 * Purple is the legal property of its developers, whose names are too numerous
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
7 * to list here. Please refer to the COPYRIGHT file distributed with this
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
8 * source distribution.
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
9 *
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
13 * (at your option) any later version.
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
14 *
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
18 * GNU General Public License for more details.
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
19 *
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
23 */
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
24
28647
f1437342cc0e Include 'internal.h' before all other headers to make some non-gcc compilers happy.
Paul Aurich <paul@darkrain42.org>
parents: 28212
diff changeset
25 #include "internal.h"
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
26 #include "cipher.h"
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
27 #include "debug.h"
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
28
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
29 #include "buddy_info.h"
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
30 #include "buddy_list.h"
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
31 #include "buddy_opt.h"
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
32 #include "group_info.h"
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
33 #include "char_conv.h"
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
34 #include "qq_crypt.h"
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
35
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
36 #include "group_internal.h"
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
37 #include "group_im.h"
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
38 #include "group_info.h"
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
39 #include "group_join.h"
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
40 #include "group_opt.h"
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
41
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
42 #include "qq_define.h"
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
43 #include "qq_base.h"
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
44 #include "im.h"
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
45 #include "qq_process.h"
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
46 #include "packet_parse.h"
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
47 #include "qq_network.h"
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
48 #include "qq_trans.h"
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
49 #include "utils.h"
25515
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24925
diff changeset
50 #include "buddy_memo.h"
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
51
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
52 enum {
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
53 QQ_ROOM_CMD_REPLY_OK = 0x00,
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
54 QQ_ROOM_CMD_REPLY_SEARCH_ERROR = 0x02,
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
55 QQ_ROOM_CMD_REPLY_NOT_MEMBER = 0x0a
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
56 };
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
57
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
58 /* default process, decrypt and dump */
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
59 static void process_unknow_cmd(PurpleConnection *gc,const gchar *title, guint8 *data, gint data_len, guint16 cmd, guint16 seq)
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
60 {
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
61 gchar *msg;
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
62
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
63 g_return_if_fail(data != NULL && data_len != 0);
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
64
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
65 qq_show_packet(title, data, data_len);
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
66
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
67 qq_hex_dump(PURPLE_DEBUG_WARNING, "QQ",
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
68 data, data_len,
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
69 ">>> [%d] %s -> [default] decrypt and dump",
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
70 seq, qq_get_cmd_desc(cmd));
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
71
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
72 msg = g_strdup_printf("Unknow command 0x%02X, %s", cmd, qq_get_cmd_desc(cmd));
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
73 purple_notify_info(gc, _("QQ Error"), title, msg);
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
74 g_free(msg);
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
75 }
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
76
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
77 /* parse the reply to send_im */
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
78 static void do_im_ack(guint8 *data, gint data_len, PurpleConnection *gc)
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
79 {
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
80 g_return_if_fail(data != NULL && data_len != 0);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
81
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
82 if (data[0] != 0) {
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
83 purple_debug_warning("QQ", "Failed sent IM\n");
24682
8f757b2139d2 String changes (a few of which I had already made, grumble grumble).
Mark Doliner <mark@kingant.net>
parents: 24679
diff changeset
84 purple_notify_error(gc, _("Error"), _("Unable to send message."), NULL);
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
85 return;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
86 }
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
87
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
88 purple_debug_info("QQ", "OK sent IM\n");
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
89 }
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
90
24624
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
91 static void do_server_news(PurpleConnection *gc, guint8 *data, gint data_len)
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
92 {
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
93 qq_data *qd = (qq_data *) gc->proto_data;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
94 gint bytes;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
95 gchar *title, *brief, *url;
24164
2a19984c0005 2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24163
diff changeset
96 gchar *content;
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
97
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
98 g_return_if_fail(data != NULL && data_len != 0);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
99
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
100 /* qq_show_packet("Rcv news", data, data_len); */
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
101
24164
2a19984c0005 2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24163
diff changeset
102 bytes = 4; /* skip unknown 4 bytes */
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
103
24164
2a19984c0005 2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24163
diff changeset
104 bytes += qq_get_vstr(&title, QQ_CHARSET_DEFAULT, data + bytes);
2a19984c0005 2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24163
diff changeset
105 bytes += qq_get_vstr(&brief, QQ_CHARSET_DEFAULT, data + bytes);
2a19984c0005 2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24163
diff changeset
106 bytes += qq_get_vstr(&url, QQ_CHARSET_DEFAULT, data + bytes);
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
107
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
108 content = g_strdup_printf(_("Server News:\n%s\n%s\n%s"), title, brief, url);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
109
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
110 if (qd->is_show_news) {
24624
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
111 qq_got_message(gc, content);
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
112 } else {
24164
2a19984c0005 2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24163
diff changeset
113 purple_debug_info("QQ", "QQ Server news:\n%s\n", content);
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
114 }
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
115 g_free(title);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
116 g_free(brief);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
117 g_free(url);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
118 g_free(content);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
119 }
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
120
24624
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
121 static void do_got_sms(PurpleConnection *gc, guint8 *data, gint data_len)
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
122 {
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
123 gint bytes;
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
124 gchar *mobile = NULL;
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
125 gchar *msg = NULL;
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
126 gchar *msg_utf8 = NULL;
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
127 gchar *msg_formated;
24639
9f2149adcac2 Clean debug info
Hu Yong <ccpaging@gmail.com>
parents: 24624
diff changeset
128
24624
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
129 g_return_if_fail(data != NULL && data_len > 26);
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
130
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
131 qq_show_packet("Rcv sms", data, data_len);
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
132
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
133 bytes = 0;
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
134 bytes += 1; /* skip 0x00 */
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
135 mobile = g_strndup((gchar *)data + bytes, 20);
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
136 bytes += 20;
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
137 bytes += 5; /* skip 0x(49 11 98 d5 03)*/
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
138 if (bytes < data_len) {
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
139 msg = g_strndup((gchar *)data + bytes, data_len - bytes);
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
140 msg_utf8 = qq_to_utf8(msg, QQ_CHARSET_DEFAULT);
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
141 g_free(msg);
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
142 } else {
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
143 msg_utf8 = g_strdup("");
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
144 }
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
145
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
146 msg_formated = g_strdup_printf(_("%s:%s"), mobile, msg_utf8);
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
147
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
148 qq_got_message(gc, msg_formated);
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
149
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
150 g_free(msg_formated);
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
151 g_free(msg_utf8);
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
152 g_free(mobile);
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
153 }
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
154
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
155 static void do_msg_sys_30(PurpleConnection *gc, guint8 *data, gint data_len)
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
156 {
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
157 gint len;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
158 guint8 reply;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
159 gchar **segments, *msg_utf8;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
160
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
161 g_return_if_fail(data != NULL && data_len != 0);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
162
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
163 len = data_len;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
164
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
165 if (NULL == (segments = split_data(data, len, "\x2f", 2)))
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
166 return;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
167
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
168 reply = strtol(segments[0], NULL, 10);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
169 if (reply == 1)
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
170 purple_debug_warning("QQ", "We are kicked out by QQ server\n");
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
171
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
172 msg_utf8 = qq_to_utf8(segments[1], QQ_CHARSET_DEFAULT);
24624
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
173 qq_got_message(gc, msg_utf8);
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
174 }
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
175
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
176 static void do_msg_sys_4c(PurpleConnection *gc, guint8 *data, gint data_len)
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
177 {
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
178 gint bytes;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
179 gint msg_len;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
180 GString *content;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
181 gchar *msg = NULL;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
182
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
183 g_return_if_fail(data != NULL && data_len > 0);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
184
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
185 bytes = 6; /* skip 0x(06 00 01 1e 01 1c)*/
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
186
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
187 content = g_string_new("");
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
188 while (bytes < data_len) {
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
189 msg_len = qq_get_vstr(&msg, QQ_CHARSET_DEFAULT, data + bytes);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
190 g_string_append(content, msg);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
191 g_string_append(content, "\n");
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
192 g_free(msg);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
193
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
194 if (msg_len <= 1) {
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
195 break;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
196 }
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
197 bytes += msg_len;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
198 }
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
199 if (bytes != data_len) {
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
200 purple_debug_warning("QQ", "Failed to read QQ_MSG_SYS_4C\n");
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
201 qq_show_packet("do_msg_sys_4c", data, data_len);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
202 }
24624
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
203 qq_got_message(gc, content->str);
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
204 g_string_free(content, FALSE);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
205 }
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
206
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
207 static const gchar *get_im_type_desc(gint type)
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
208 {
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
209 switch (type) {
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
210 case QQ_MSG_TO_BUDDY:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
211 return "QQ_MSG_TO_BUDDY";
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
212 case QQ_MSG_TO_UNKNOWN:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
213 return "QQ_MSG_TO_UNKNOWN";
24648
c9a71b032496 Code clean
Hu Yong <ccpaging@gmail.com>
parents: 24639
diff changeset
214 case QQ_MSG_QUN_IM_UNKNOWN:
c9a71b032496 Code clean
Hu Yong <ccpaging@gmail.com>
parents: 24639
diff changeset
215 return "QQ_MSG_QUN_IM_UNKNOWN";
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
216 case QQ_MSG_ADD_TO_QUN:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
217 return "QQ_MSG_ADD_TO_QUN";
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
218 case QQ_MSG_DEL_FROM_QUN:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
219 return "QQ_MSG_DEL_FROM_QUN";
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
220 case QQ_MSG_APPLY_ADD_TO_QUN:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
221 return "QQ_MSG_APPLY_ADD_TO_QUN";
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
222 case QQ_MSG_CREATE_QUN:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
223 return "QQ_MSG_CREATE_QUN";
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
224 case QQ_MSG_SYS_30:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
225 return "QQ_MSG_SYS_30";
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
226 case QQ_MSG_SYS_4C:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
227 return "QQ_MSG_SYS_4C";
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
228 case QQ_MSG_APPROVE_APPLY_ADD_TO_QUN:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
229 return "QQ_MSG_APPROVE_APPLY_ADD_TO_QUN";
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
230 case QQ_MSG_REJCT_APPLY_ADD_TO_QUN:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
231 return "QQ_MSG_REJCT_APPLY_ADD_TO_QUN";
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
232 case QQ_MSG_TEMP_QUN_IM:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
233 return "QQ_MSG_TEMP_QUN_IM";
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
234 case QQ_MSG_QUN_IM:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
235 return "QQ_MSG_QUN_IM";
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
236 case QQ_MSG_NEWS:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
237 return "QQ_MSG_NEWS";
24624
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
238 case QQ_MSG_SMS:
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
239 return "QQ_MSG_SMS";
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
240 case QQ_MSG_EXTEND:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
241 return "QQ_MSG_EXTEND";
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
242 case QQ_MSG_EXTEND_85:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
243 return "QQ_MSG_EXTEND_85";
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
244 default:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
245 return "QQ_MSG_UNKNOWN";
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
246 }
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
247 }
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
248
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
249 /* I receive a message, mainly it is text msg,
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
250 * but we need to proess other types (group etc) */
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
251 static void process_private_msg(guint8 *data, gint data_len, guint16 seq, PurpleConnection *gc)
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
252 {
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
253 qq_data *qd;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
254 gint bytes;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
255
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
256 struct {
31191
4deef745de87 2010.01.23 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 30430
diff changeset
257 UID uid_from;
4deef745de87 2010.01.23 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 30430
diff changeset
258 UID uid_to;
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
259 guint32 seq;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
260 struct in_addr ip_from;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
261 guint16 port_from;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
262 guint16 msg_type;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
263 } header;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
264
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
265 g_return_if_fail(data != NULL && data_len != 0);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
266
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
267 qd = (qq_data *) gc->proto_data;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
268
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
269 if (data_len < 16) { /* we need to ack with the first 16 bytes */
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
270 purple_debug_error("QQ", "MSG is too short\n");
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
271 return;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
272 } else {
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
273 /* when we receive a message,
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
274 * we send an ACK which is the first 16 bytes of incoming packet */
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
275 qq_send_server_reply(gc, QQ_CMD_RECV_IM, seq, data, 16);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
276 }
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
277
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
278 /* check len first */
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
279 if (data_len < 20) { /* length of im_header */
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
280 purple_debug_error("QQ", "Invald MSG header, len %d < 20\n", data_len);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
281 return;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
282 }
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
283
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
284 bytes = 0;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
285 bytes += qq_get32(&(header.uid_from), data + bytes);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
286 bytes += qq_get32(&(header.uid_to), data + bytes);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
287 bytes += qq_get32(&(header.seq), data + bytes);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
288 /* if the message is delivered via server, it is server IP/port */
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
289 bytes += qq_getIP(&(header.ip_from), data + bytes);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
290 bytes += qq_get16(&(header.port_from), data + bytes);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
291 bytes += qq_get16(&(header.msg_type), data + bytes);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
292 /* im_header prepared */
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
293
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
294 if (header.uid_to != qd->uid) { /* should not happen */
24624
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
295 purple_debug_error("QQ", "MSG to %u, NOT me\n", header.uid_to);
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
296 return;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
297 }
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
298
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
299 /* check bytes */
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
300 if (bytes >= data_len - 1) {
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
301 purple_debug_warning("QQ", "Empty MSG\n");
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
302 return;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
303 }
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
304
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
305 switch (header.msg_type) {
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
306 case QQ_MSG_NEWS:
24624
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
307 do_server_news(gc, data + bytes, data_len - bytes);
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
308 break;
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
309 case QQ_MSG_SMS:
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
310 do_got_sms(gc, data + bytes, data_len - bytes);
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
311 break;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
312 case QQ_MSG_EXTEND:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
313 case QQ_MSG_EXTEND_85:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
314 purple_debug_info("QQ", "MSG from buddy [%d]\n", header.uid_from);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
315 qq_process_extend_im(gc, data + bytes, data_len - bytes);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
316 break;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
317 case QQ_MSG_TO_UNKNOWN:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
318 case QQ_MSG_TO_BUDDY:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
319 purple_debug_info("QQ", "MSG from buddy [%d]\n", header.uid_from);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
320 qq_process_im(gc, data + bytes, data_len - bytes);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
321 break;
24648
c9a71b032496 Code clean
Hu Yong <ccpaging@gmail.com>
parents: 24639
diff changeset
322 case QQ_MSG_QUN_IM_UNKNOWN:
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
323 case QQ_MSG_TEMP_QUN_IM:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
324 case QQ_MSG_QUN_IM:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
325 purple_debug_info("QQ", "MSG from room [%d]\n", header.uid_from);
24159
9be95f0b9472 2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24157
diff changeset
326 qq_process_room_im(data + bytes, data_len - bytes, header.uid_from, gc, header.msg_type);
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
327 break;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
328 case QQ_MSG_ADD_TO_QUN:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
329 purple_debug_info("QQ", "Notice from [%d], Added\n", header.uid_from);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
330 /* uid_from is group id
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
331 * we need this to create a dummy group and add to blist */
24159
9be95f0b9472 2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24157
diff changeset
332 qq_process_room_buddy_joined(data + bytes, data_len - bytes, header.uid_from, gc);
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
333 break;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
334 case QQ_MSG_DEL_FROM_QUN:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
335 purple_debug_info("QQ", "Notice from room [%d], Removed\n", header.uid_from);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
336 /* uid_from is group id */
24159
9be95f0b9472 2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24157
diff changeset
337 qq_process_room_buddy_removed(data + bytes, data_len - bytes, header.uid_from, gc);
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
338 break;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
339 case QQ_MSG_APPLY_ADD_TO_QUN:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
340 purple_debug_info("QQ", "Notice from room [%d], Joined\n", header.uid_from);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
341 /* uid_from is group id */
24159
9be95f0b9472 2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24157
diff changeset
342 qq_process_room_buddy_request_join(data + bytes, data_len - bytes, header.uid_from, gc);
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
343 break;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
344 case QQ_MSG_APPROVE_APPLY_ADD_TO_QUN:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
345 purple_debug_info("QQ", "Notice from room [%d], Confirm add in\n",
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
346 header.uid_from);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
347 /* uid_from is group id */
24159
9be95f0b9472 2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24157
diff changeset
348 qq_process_room_buddy_approved(data + bytes, data_len - bytes, header.uid_from, gc);
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
349 break;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
350 case QQ_MSG_REJCT_APPLY_ADD_TO_QUN:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
351 purple_debug_info("QQ", "Notice from room [%d], Refuse add in\n",
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
352 header.uid_from);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
353 /* uid_from is group id */
24159
9be95f0b9472 2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24157
diff changeset
354 qq_process_room_buddy_rejected(data + bytes, data_len - bytes, header.uid_from, gc);
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
355 break;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
356 case QQ_MSG_SYS_30:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
357 do_msg_sys_30(gc, data + bytes, data_len - bytes);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
358 break;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
359 case QQ_MSG_SYS_4C:
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
360 do_msg_sys_4c(gc, data + bytes, data_len - bytes);
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
361 break;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
362 default:
24624
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
363 purple_debug_warning("QQ", "MSG from %u, unknown type %s [0x%04X]\n",
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
364 header.uid_from, get_im_type_desc(header.msg_type), header.msg_type);
24624
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
365 qq_show_packet("MSG header", data, bytes);
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
366 if (data_len - bytes > 0) {
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
367 qq_show_packet("MSG data", data + bytes, data_len - bytes);
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
368 }
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
369 break;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
370 }
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
371 }
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
372
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
373 /* Send ACK if the sys message needs an ACK */
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
374 static void request_server_ack(PurpleConnection *gc, gchar *funct_str, gchar *from, guint16 seq)
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
375 {
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
376 guint8 *raw_data;
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
377 gint bytes;
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
378 guint8 bar;
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
379
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
380 g_return_if_fail(funct_str != NULL && from != NULL);
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
381
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
382 bar = 0x1e;
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
383 raw_data = g_newa(guint8, strlen(funct_str) + strlen(from) + 16);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
384
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
385 bytes = 0;
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
386 bytes += qq_putdata(raw_data + bytes, (guint8 *)funct_str, strlen(funct_str));
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
387 bytes += qq_put8(raw_data + bytes, bar);
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
388 bytes += qq_putdata(raw_data + bytes, (guint8 *)from, strlen(from));
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
389 bytes += qq_put8(raw_data + bytes, bar);
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
390 bytes += qq_put16(raw_data + bytes, seq);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
391
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
392 qq_send_server_reply(gc, QQ_CMD_ACK_SYS_MSG, 0, raw_data, bytes);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
393 }
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
394
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
395 static void do_server_notice(PurpleConnection *gc, gchar *from, gchar *to,
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
396 guint8 *data, gint data_len)
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
397 {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
398 qq_data *qd = (qq_data *) gc->proto_data;
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
399 gchar *msg, *msg_utf8;
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
400 gchar *title, *content;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
401
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
402 g_return_if_fail(from != NULL && to != NULL && data_len > 0);
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
403
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
404 msg = g_strndup((gchar *)data, data_len);
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
405 msg_utf8 = qq_to_utf8(msg, QQ_CHARSET_DEFAULT);
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
406 g_free(msg);
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
407 if (msg_utf8 == NULL) {
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
408 purple_debug_error("QQ", "Recv NULL sys msg from %s to %s, discard\n",
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
409 from, to);
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
410 return;
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
411 }
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
412
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
413 title = g_strdup_printf(_("From %s:"), from);
24135
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
414 content = g_strdup_printf(_("Server notice From %s: \n%s"), from, msg_utf8);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
415
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
416 if (qd->is_show_notice) {
24624
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
417 qq_got_message(gc, content);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
418 } else {
28212
73a30365c293 Add newline at end of debug messages.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27381
diff changeset
419 purple_debug_info("QQ", "QQ Server notice from %s:\n%s\n", from, msg_utf8);
24135
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
420 }
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
421 g_free(msg_utf8);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
422 g_free(title);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
423 g_free(content);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
424 }
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
425
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
426 static void process_server_msg(PurpleConnection *gc, guint8 *data, gint data_len, guint16 seq)
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
427 {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
428 qq_data *qd;
24925
1300601041ac g_strsplit_set is new in glib 2.4
Stu Tomlinson <stu@nosnilmot.com>
parents: 24682
diff changeset
429 guint8 *data_str, i = 0;
1300601041ac g_strsplit_set is new in glib 2.4
Stu Tomlinson <stu@nosnilmot.com>
parents: 24682
diff changeset
430 gchar **segments, **seg;
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
431 gchar *funct_str, *from, *to;
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
432 gint bytes, funct;
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
433
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
434 g_return_if_fail(data != NULL && data_len != 0);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
435
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
436 qd = (qq_data *) gc->proto_data;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
437
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
438 data_str = g_newa(guint8, data_len + 1);
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
439 g_memmove(data_str, data, data_len);
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
440 data_str[data_len] = 0x00;
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
441
24925
1300601041ac g_strsplit_set is new in glib 2.4
Stu Tomlinson <stu@nosnilmot.com>
parents: 24682
diff changeset
442 segments = g_strsplit((gchar *) data_str, "\x1f", 0);
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
443 g_return_if_fail(segments != NULL);
24925
1300601041ac g_strsplit_set is new in glib 2.4
Stu Tomlinson <stu@nosnilmot.com>
parents: 24682
diff changeset
444 for (seg = segments; *seg != NULL; seg++)
1300601041ac g_strsplit_set is new in glib 2.4
Stu Tomlinson <stu@nosnilmot.com>
parents: 24682
diff changeset
445 i++;
1300601041ac g_strsplit_set is new in glib 2.4
Stu Tomlinson <stu@nosnilmot.com>
parents: 24682
diff changeset
446 if (i < 3) {
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
447 purple_debug_warning("QQ", "Server message segments is less than 3\n");
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
448 g_strfreev(segments);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
449 return;
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
450 }
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
451
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
452 bytes = 0;
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
453 funct_str = segments[0];
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
454 bytes += strlen(funct_str) + 1;
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
455 from = segments[1];
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
456 bytes += strlen(from) + 1;
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
457 to = segments[2];
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
458 bytes += strlen(to) + 1;
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
459
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
460 request_server_ack(gc, funct_str, from, seq);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
461
24162
f4f29fac96c6 2008.10.20 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24161
diff changeset
462 /* qq_show_packet("Server MSG", data, data_len); */
24624
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
463 if (strtoul(to, NULL, 10) != qd->uid) { /* not to me */
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
464 purple_debug_error("QQ", "Recv sys msg to [%s], not me!, discard\n", to);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
465 g_strfreev(segments);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
466 return;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
467 }
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
468
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
469 funct = strtol(funct_str, NULL, 10);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
470 switch (funct) {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
471 case QQ_SERVER_BUDDY_ADDED:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
472 case QQ_SERVER_BUDDY_ADD_REQUEST:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
473 case QQ_SERVER_BUDDY_ADDED_ME:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
474 case QQ_SERVER_BUDDY_REJECTED_ME:
24162
f4f29fac96c6 2008.10.20 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24161
diff changeset
475 case QQ_SERVER_BUDDY_ADD_REQUEST_EX:
f4f29fac96c6 2008.10.20 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24161
diff changeset
476 case QQ_SERVER_BUDDY_ADDING_EX:
f4f29fac96c6 2008.10.20 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24161
diff changeset
477 case QQ_SERVER_BUDDY_ADDED_ANSWER:
f4f29fac96c6 2008.10.20 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24161
diff changeset
478 case QQ_SERVER_BUDDY_ADDED_EX:
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
479 qq_process_buddy_from_server(gc, funct, from, to, data + bytes, data_len - bytes);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
480 break;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
481 case QQ_SERVER_NOTICE:
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
482 do_server_notice(gc, from, to, data + bytes, data_len - bytes);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
483 break;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
484 case QQ_SERVER_NEW_CLIENT:
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
485 purple_debug_warning("QQ", "QQ Server has newer client version\n");
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
486 break;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
487 default:
24162
f4f29fac96c6 2008.10.20 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24161
diff changeset
488 qq_show_packet("Unknown sys msg", data, data_len);
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
489 purple_debug_warning("QQ", "Recv unknown sys msg code: %s\n", funct_str);
24135
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
490 break;
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
491 }
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
492 g_strfreev(segments);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
493 }
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
494
23879
23cec4360d4a applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23878
diff changeset
495 void qq_proc_server_cmd(PurpleConnection *gc, guint16 cmd, guint16 seq, guint8 *rcved, gint rcved_len)
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
496 {
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
497 qq_data *qd;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
498
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
499 guint8 *data;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
500 gint data_len;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
501
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
502 g_return_if_fail (gc != NULL && gc->proto_data != NULL);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
503 qd = (qq_data *) gc->proto_data;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
504
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
505 data = g_newa(guint8, rcved_len);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
506 data_len = qq_decrypt(data, rcved, rcved_len, qd->session_key);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
507 if (data_len < 0) {
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
508 purple_debug_warning("QQ",
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
509 "Can not decrypt server cmd by session key, [%05d], 0x%04X %s, len %d\n",
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
510 seq, cmd, qq_get_cmd_desc(cmd), rcved_len);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
511 qq_show_packet("Can not decrypted", rcved, rcved_len);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
512 return;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
513 }
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
514
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
515 if (data_len <= 0) {
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
516 purple_debug_warning("QQ",
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
517 "Server cmd decrypted is empty, [%05d], 0x%04X %s, len %d\n",
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
518 seq, cmd, qq_get_cmd_desc(cmd), rcved_len);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
519 return;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
520 }
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
521
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
522 /* now process the packet */
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
523 switch (cmd) {
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
524 case QQ_CMD_RECV_IM:
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
525 process_private_msg(data, data_len, seq, gc);
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
526 break;
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
527 case QQ_CMD_RECV_MSG_SYS:
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
528 process_server_msg(gc, data, data_len, seq);
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
529 break;
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
530 case QQ_CMD_BUDDY_CHANGE_STATUS:
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
531 qq_process_buddy_change_status(data, data_len, gc);
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
532 break;
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
533 default:
24678
2f84f888d3db fixed some spelling errors in QQ protocol plugin:
Björn Voigt <bjoern@cs.tu-berlin.de>
parents: 24653
diff changeset
534 process_unknow_cmd(gc, _("Unknown SERVER CMD"), data, data_len, cmd, seq);
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
535 break;
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
536 }
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
537 }
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
538
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
539 static void process_room_cmd_notify(PurpleConnection *gc,
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
540 guint8 room_cmd, guint8 room_id, guint8 reply, guint8 *data, gint data_len)
24095
25f62d21b3f8 disapproval of revision '8cebefbc6cd5d84acb69c74e69e8821f11dd225d'
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24088
diff changeset
541 {
23880
1a0caf9983fa applied changes from 92d52eef2994d2697999177804e3665989cfa352
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23879
diff changeset
542 gchar *prim;
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
543 gchar *msg, *msg_utf8;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
544 g_return_if_fail(data != NULL && data_len > 0);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
545
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
546 msg = g_strndup((gchar *) data, data_len); /* it will append 0x00 */
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
547 msg_utf8 = qq_to_utf8(msg, QQ_CHARSET_DEFAULT);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
548 g_free(msg);
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
549
24624
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
550 prim = g_strdup_printf(_("Error reply of %s(0x%02X)\nRoom %u, reply 0x%02X"),
23880
1a0caf9983fa applied changes from 92d52eef2994d2697999177804e3665989cfa352
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23879
diff changeset
551 qq_get_room_cmd_desc(room_cmd), room_cmd, room_id, reply);
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
552
23880
1a0caf9983fa applied changes from 92d52eef2994d2697999177804e3665989cfa352
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23879
diff changeset
553 purple_notify_error(gc, _("QQ Qun Command"), prim, msg_utf8);
1a0caf9983fa applied changes from 92d52eef2994d2697999177804e3665989cfa352
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23879
diff changeset
554
1a0caf9983fa applied changes from 92d52eef2994d2697999177804e3665989cfa352
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23879
diff changeset
555 g_free(prim);
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
556 g_free(msg_utf8);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
557 }
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
558
23879
23cec4360d4a applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23878
diff changeset
559 void qq_update_room(PurpleConnection *gc, guint8 room_cmd, guint32 room_id)
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
560 {
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
561 gint ret;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
562
30430
351d07aefb09 Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28647
diff changeset
563 g_return_if_fail (gc != NULL);
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
564
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
565 switch (room_cmd) {
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
566 case 0:
24157
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
567 qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_INFO, room_id, NULL, 0,
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
568 QQ_CMD_CLASS_UPDATE_ROOM, 0);
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
569 break;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
570 case QQ_ROOM_CMD_GET_INFO:
24157
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
571 ret = qq_request_room_get_buddies(gc, room_id, QQ_CMD_CLASS_UPDATE_ROOM);
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
572 if (ret <= 0) {
24157
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
573 qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_ONLINES, room_id, NULL, 0,
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
574 QQ_CMD_CLASS_UPDATE_ROOM, 0);
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
575 }
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
576 break;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
577 case QQ_ROOM_CMD_GET_BUDDIES:
24157
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
578 qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_ONLINES, room_id, NULL, 0,
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
579 QQ_CMD_CLASS_UPDATE_ROOM, 0);
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
580 break;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
581 case QQ_ROOM_CMD_GET_ONLINES:
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
582 /* last command */
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
583 default:
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
584 break;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
585 }
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
586 }
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
587
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
588 void qq_update_all_rooms(PurpleConnection *gc, guint8 room_cmd, guint32 room_id)
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
589 {
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
590 gboolean is_new_turn = FALSE;
24157
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
591 guint32 next_id;
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
592
30430
351d07aefb09 Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28647
diff changeset
593 g_return_if_fail(gc != NULL);
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
594
24157
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
595 next_id = qq_room_get_next(gc, room_id);
24624
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
596 purple_debug_info("QQ", "Update rooms, next id %u, prev id %u\n", next_id, room_id);
24157
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
597
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
598 if (next_id <= 0) {
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
599 if (room_id > 0) {
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
600 is_new_turn = TRUE;
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
601 next_id = qq_room_get_next(gc, 0);
24639
9f2149adcac2 Clean debug info
Hu Yong <ccpaging@gmail.com>
parents: 24624
diff changeset
602 purple_debug_info("QQ", "New turn, id %u\n", next_id);
24157
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
603 } else {
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
604 purple_debug_info("QQ", "No room. Finished update\n");
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
605 return;
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
606 }
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
607 }
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
608
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
609 switch (room_cmd) {
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
610 case 0:
24157
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
611 qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_INFO, next_id, NULL, 0,
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
612 QQ_CMD_CLASS_UPDATE_ALL, 0);
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
613 break;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
614 case QQ_ROOM_CMD_GET_INFO:
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
615 if (!is_new_turn) {
24157
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
616 qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_INFO, next_id, NULL, 0,
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
617 QQ_CMD_CLASS_UPDATE_ALL, 0);
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
618 } else {
24157
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
619 qq_request_room_get_buddies(gc, next_id, QQ_CMD_CLASS_UPDATE_ALL);
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
620 }
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
621 break;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
622 case QQ_ROOM_CMD_GET_BUDDIES:
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
623 /* last command */
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
624 if (!is_new_turn) {
24157
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
625 qq_request_room_get_buddies(gc, next_id, QQ_CMD_CLASS_UPDATE_ALL);
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
626 } else {
23879
23cec4360d4a applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23878
diff changeset
627 purple_debug_info("QQ", "Finished update\n");
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
628 }
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
629 break;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
630 default:
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
631 break;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
632 }
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
633 }
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
634
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
635 void qq_update_all(PurpleConnection *gc, guint16 cmd)
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
636 {
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
637 qq_data *qd;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
638
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
639 g_return_if_fail (gc != NULL && gc->proto_data != NULL);
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
640 qd = (qq_data *) gc->proto_data;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
641
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
642 switch (cmd) {
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
643 case 0:
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
644 qq_request_buddy_info(gc, qd->uid, QQ_CMD_CLASS_UPDATE_ALL, 0);
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
645 break;
23879
23cec4360d4a applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23878
diff changeset
646 case QQ_CMD_GET_BUDDY_INFO:
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
647 qq_request_change_status(gc, QQ_CMD_CLASS_UPDATE_ALL);
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
648 break;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
649 case QQ_CMD_CHANGE_STATUS:
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
650 qq_request_get_buddies(gc, 0, QQ_CMD_CLASS_UPDATE_ALL);
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
651 break;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
652 case QQ_CMD_GET_BUDDIES_LIST:
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
653 qq_request_get_buddies_and_rooms(gc, 0, QQ_CMD_CLASS_UPDATE_ALL);
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
654 break;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
655 case QQ_CMD_GET_BUDDIES_AND_ROOMS:
24142
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24140
diff changeset
656 if (qd->client_version >= 2007) {
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24140
diff changeset
657 /* QQ2007/2008 can not get buddies level*/
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24140
diff changeset
658 qq_request_get_buddies_online(gc, 0, QQ_CMD_CLASS_UPDATE_ALL);
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24140
diff changeset
659 } else {
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24140
diff changeset
660 qq_request_get_buddies_level(gc, QQ_CMD_CLASS_UPDATE_ALL);
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24140
diff changeset
661 }
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
662 break;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
663 case QQ_CMD_GET_LEVEL:
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
664 qq_request_get_buddies_online(gc, 0, QQ_CMD_CLASS_UPDATE_ALL);
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
665 break;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
666 case QQ_CMD_GET_BUDDIES_ONLINE:
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
667 /* last command */
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
668 qq_update_all_rooms(gc, 0, 0);
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
669 break;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
670 default:
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
671 break;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
672 }
24149
818ab62006f5 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24148
diff changeset
673 qd->online_last_update = time(NULL);
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
674 }
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
675
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
676 static void update_all_rooms_online(PurpleConnection *gc, guint8 room_cmd, guint32 room_id)
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
677 {
24157
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
678 guint32 next_id;
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
679
30430
351d07aefb09 Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28647
diff changeset
680 g_return_if_fail (gc != NULL);
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
681
24157
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
682 next_id = qq_room_get_next_conv(gc, room_id);
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
683 if (next_id <= 0 && room_id <= 0) {
23879
23cec4360d4a applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23878
diff changeset
684 purple_debug_info("QQ", "No room in conversation, no update online buddies\n");
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
685 return;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
686 }
24157
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
687 if (next_id <= 0 ) {
23879
23cec4360d4a applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23878
diff changeset
688 purple_debug_info("QQ", "finished update rooms' online buddies\n");
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
689 return;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
690 }
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
691
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
692 switch (room_cmd) {
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
693 case 0:
24157
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
694 qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_ONLINES, next_id, NULL, 0,
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
695 QQ_CMD_CLASS_UPDATE_ALL, 0);
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
696 break;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
697 case QQ_ROOM_CMD_GET_ONLINES:
24157
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
698 qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_ONLINES, next_id, NULL, 0,
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
699 QQ_CMD_CLASS_UPDATE_ALL, 0);
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
700 break;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
701 default:
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
702 break;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
703 }
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
704 }
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
705
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
706 void qq_update_online(PurpleConnection *gc, guint16 cmd)
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
707 {
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
708 qq_data *qd;
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
709 g_return_if_fail (gc != NULL && gc->proto_data != NULL);
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
710 qd = (qq_data *) gc->proto_data;
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
711
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
712 switch (cmd) {
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
713 case 0:
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
714 qq_request_get_buddies_online(gc, 0, QQ_CMD_CLASS_UPDATE_ONLINE);
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
715 break;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
716 case QQ_CMD_GET_BUDDIES_ONLINE:
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
717 /* last command */
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
718 update_all_rooms_online(gc, 0, 0);
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
719 break;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
720 default:
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
721 break;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
722 }
24149
818ab62006f5 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24148
diff changeset
723 qd->online_last_update = time(NULL);
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
724 }
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
725
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
726 void qq_proc_room_cmds(PurpleConnection *gc, guint16 seq,
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
727 guint8 room_cmd, guint32 room_id, guint8 *rcved, gint rcved_len,
31191
4deef745de87 2010.01.23 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 30430
diff changeset
728 UPDCLS update_class, guint32 ship32)
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
729 {
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
730 qq_data *qd;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
731 guint8 *data;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
732 gint data_len;
24157
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
733 qq_room_data *rmd;
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
734 gint bytes;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
735 guint8 reply_cmd, reply;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
736
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
737 g_return_if_fail (gc != NULL && gc->proto_data != NULL);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
738 qd = (qq_data *) gc->proto_data;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
739
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
740 data = g_newa(guint8, rcved_len);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
741 data_len = qq_decrypt(data, rcved, rcved_len, qd->session_key);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
742 if (data_len < 0) {
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
743 purple_debug_warning("QQ",
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
744 "Can not decrypt room cmd by session key, [%05d], 0x%02X %s for %d, len %d\n",
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
745 seq, room_cmd, qq_get_room_cmd_desc(room_cmd), room_id, rcved_len);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
746 qq_show_packet("Can not decrypted", rcved, rcved_len);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
747 return;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
748 }
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
749
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
750 if (room_id <= 0) {
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
751 purple_debug_warning("QQ",
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
752 "Invaild room id, [%05d], 0x%02X %s for %d, len %d\n",
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
753 seq, room_cmd, qq_get_room_cmd_desc(room_cmd), room_id, rcved_len);
23880
1a0caf9983fa applied changes from 92d52eef2994d2697999177804e3665989cfa352
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23879
diff changeset
754 /* Some room cmd has no room id, like QQ_ROOM_CMD_SEARCH */
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
755 }
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
756
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
757 if (data_len <= 2) {
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
758 purple_debug_warning("QQ",
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
759 "Invaild len of room cmd decrypted, [%05d], 0x%02X %s for %d, len %d\n",
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
760 seq, room_cmd, qq_get_room_cmd_desc(room_cmd), room_id, rcved_len);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
761 return;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
762 }
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
763
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
764 bytes = 0;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
765 bytes += qq_get8(&reply_cmd, data + bytes);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
766 bytes += qq_get8(&reply, data + bytes);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
767
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
768 if (reply_cmd != room_cmd) {
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
769 purple_debug_warning("QQ",
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
770 "Missing room cmd in reply 0x%02X %s, [%05d], 0x%02X %s for %d, len %d\n",
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
771 reply_cmd, qq_get_room_cmd_desc(reply_cmd),
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
772 seq, room_cmd, qq_get_room_cmd_desc(room_cmd), room_id, rcved_len);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
773 }
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
774
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
775 /* now process the packet */
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
776 if (reply != QQ_ROOM_CMD_REPLY_OK) {
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
777 switch (reply) { /* this should be all errors */
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
778 case QQ_ROOM_CMD_REPLY_NOT_MEMBER:
24157
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
779 rmd = qq_room_data_find(gc, room_id);
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
780 if (rmd == NULL) {
24154
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
781 purple_debug_warning("QQ",
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
782 "Missing room id in [%05d], 0x%02X %s for %d, len %d\n",
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
783 seq, room_cmd, qq_get_room_cmd_desc(room_cmd), room_id, rcved_len);
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
784 } else {
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
785 purple_debug_warning("QQ",
24679
55b7371eadf4 Fix some English in the QQ plugin. And remove some translated phrases that are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24678
diff changeset
786 "Not a member of room \"%s\"\n", rmd->title_utf8);
24157
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
787 rmd->my_role = QQ_ROOM_ROLE_NO;
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
788 }
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
789 break;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
790 case QQ_ROOM_CMD_REPLY_SEARCH_ERROR:
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
791 if (qd->roomlist != NULL) {
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
792 if (purple_roomlist_get_in_progress(qd->roomlist))
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
793 purple_roomlist_set_in_progress(qd->roomlist, FALSE);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
794 }
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
795 default:
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
796 process_room_cmd_notify(gc, reply_cmd, room_id, reply, data + bytes, data_len - bytes);
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
797 }
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
798 return;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
799 }
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
800
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
801 /* seems ok so far, so we process the reply according to sub_cmd */
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
802 switch (reply_cmd) {
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
803 case QQ_ROOM_CMD_GET_INFO:
24135
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
804 qq_process_room_cmd_get_info(data + bytes, data_len - bytes, ship32, gc);
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
805 break;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
806 case QQ_ROOM_CMD_CREATE:
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
807 qq_group_process_create_group_reply(data + bytes, data_len - bytes, gc);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
808 break;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
809 case QQ_ROOM_CMD_CHANGE_INFO:
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
810 qq_group_process_modify_info_reply(data + bytes, data_len - bytes, gc);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
811 break;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
812 case QQ_ROOM_CMD_MEMBER_OPT:
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
813 qq_group_process_modify_members_reply(data + bytes, data_len - bytes, gc);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
814 break;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
815 case QQ_ROOM_CMD_ACTIVATE:
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
816 qq_group_process_activate_group_reply(data + bytes, data_len - bytes, gc);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
817 break;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
818 case QQ_ROOM_CMD_SEARCH:
24154
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
819 qq_process_room_search(gc, data + bytes, data_len - bytes, ship32);
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
820 break;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
821 case QQ_ROOM_CMD_JOIN:
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
822 qq_process_group_cmd_join_group(data + bytes, data_len - bytes, gc);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
823 break;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
824 case QQ_ROOM_CMD_AUTH:
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
825 qq_process_group_cmd_join_group_auth(data + bytes, data_len - bytes, gc);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
826 break;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
827 case QQ_ROOM_CMD_QUIT:
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
828 qq_process_group_cmd_exit_group(data + bytes, data_len - bytes, gc);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
829 break;
24648
c9a71b032496 Code clean
Hu Yong <ccpaging@gmail.com>
parents: 24639
diff changeset
830 case QQ_ROOM_CMD_SEND_IM:
24159
9be95f0b9472 2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24157
diff changeset
831 qq_process_room_send_im(gc, data + bytes, data_len - bytes);
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
832 break;
24648
c9a71b032496 Code clean
Hu Yong <ccpaging@gmail.com>
parents: 24639
diff changeset
833 case QQ_ROOM_CMD_SEND_IM_EX:
c9a71b032496 Code clean
Hu Yong <ccpaging@gmail.com>
parents: 24639
diff changeset
834 qq_process_room_send_im_ex(gc, data + bytes, data_len - bytes);
c9a71b032496 Code clean
Hu Yong <ccpaging@gmail.com>
parents: 24639
diff changeset
835 break;
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
836 case QQ_ROOM_CMD_GET_ONLINES:
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
837 qq_process_room_cmd_get_onlines(data + bytes, data_len - bytes, gc);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
838 break;
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
839 case QQ_ROOM_CMD_GET_BUDDIES:
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
840 qq_process_room_cmd_get_buddies(data + bytes, data_len - bytes, gc);
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
841 break;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
842 default:
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
843 purple_debug_warning("QQ", "Unknow room cmd 0x%02X %s\n",
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
844 reply_cmd, qq_get_room_cmd_desc(reply_cmd));
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
845 }
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
846
23879
23cec4360d4a applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23878
diff changeset
847 if (update_class == QQ_CMD_CLASS_NONE)
23cec4360d4a applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23878
diff changeset
848 return;
23cec4360d4a applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23878
diff changeset
849
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
850 if (update_class == QQ_CMD_CLASS_UPDATE_ALL) {
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
851 qq_update_all_rooms(gc, room_cmd, room_id);
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
852 return;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
853 }
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
854 if (update_class == QQ_CMD_CLASS_UPDATE_ONLINE) {
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
855 update_all_rooms_online(gc, room_cmd, room_id);
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
856 return;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
857 }
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
858 if (update_class == QQ_CMD_CLASS_UPDATE_ROOM) {
23879
23cec4360d4a applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23878
diff changeset
859 qq_update_room(gc, room_cmd, room_id);
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
860 }
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
861 }
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
862
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
863 guint8 qq_proc_login_cmds(PurpleConnection *gc, guint16 cmd, guint16 seq,
31191
4deef745de87 2010.01.23 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 30430
diff changeset
864 guint8 *rcved, gint rcved_len, UPDCLS update_class, guint32 ship32)
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
865 {
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
866 qq_data *qd;
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
867 guint8 *data = NULL;
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
868 gint data_len = 0;
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
869 guint ret_8 = QQ_LOGIN_REPLY_ERR;
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
870
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
871 g_return_val_if_fail (gc != NULL && gc->proto_data != NULL, QQ_LOGIN_REPLY_ERR);
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
872 qd = (qq_data *) gc->proto_data;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
873
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
874 g_return_val_if_fail(rcved_len > 0, QQ_LOGIN_REPLY_ERR);
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
875 data = g_newa(guint8, rcved_len);
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
876
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
877 switch (cmd) {
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
878 case QQ_CMD_TOKEN:
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
879 if (qq_process_token(gc, rcved, rcved_len) == QQ_LOGIN_REPLY_OK) {
24140
619ac2303c46 2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24139
diff changeset
880 if (qd->client_version >= 2007) {
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
881 qq_request_token_ex(gc);
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
882 } else {
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
883 qq_request_login(gc);
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
884 }
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
885 return QQ_LOGIN_REPLY_OK;
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
886 }
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
887 return QQ_LOGIN_REPLY_ERR;
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
888 case QQ_CMD_GET_SERVER:
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
889 case QQ_CMD_TOKEN_EX:
24135
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
890 data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.random_key);
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
891 break;
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
892 case QQ_CMD_CHECK_PWD:
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
893 /* May use password_twice_md5 in the past version like QQ2005 */
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
894 data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.random_key);
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
895 if (data_len >= 0) {
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
896 purple_debug_warning("QQ", "Decrypt login packet by random_key, %d bytes\n", data_len);
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
897 } else {
24138
dc112387190f 2008.09.29 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24137
diff changeset
898 data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.pwd_twice_md5);
24135
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
899 if (data_len >= 0) {
24138
dc112387190f 2008.09.29 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24137
diff changeset
900 purple_debug_warning("QQ", "Decrypt login packet by pwd_twice_md5, %d bytes\n", data_len);
24135
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
901 }
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
902 }
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
903 break;
24137
87e61a85f5dd 2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
904 case QQ_CMD_LOGIN:
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
905 default:
24140
619ac2303c46 2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24139
diff changeset
906 if (qd->client_version >= 2007) {
24138
dc112387190f 2008.09.29 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24137
diff changeset
907 data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.pwd_twice_md5);
24137
87e61a85f5dd 2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
908 if (data_len >= 0) {
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
909 purple_debug_warning("QQ", "Decrypt login packet by pwd_twice_md5\n");
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
910 } else {
24137
87e61a85f5dd 2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
911 data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.login_key);
87e61a85f5dd 2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
912 if (data_len >= 0) {
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
913 purple_debug_warning("QQ", "Decrypt login packet by login_key\n");
24137
87e61a85f5dd 2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
914 }
87e61a85f5dd 2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
915 }
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
916 } else {
24137
87e61a85f5dd 2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
917 /* May use password_twice_md5 in the past version like QQ2005 */
87e61a85f5dd 2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
918 data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.random_key);
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
919 if (data_len >= 0) {
24137
87e61a85f5dd 2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
920 purple_debug_warning("QQ", "Decrypt login packet by random_key\n");
87e61a85f5dd 2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
921 } else {
24138
dc112387190f 2008.09.29 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24137
diff changeset
922 data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.pwd_twice_md5);
24137
87e61a85f5dd 2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
923 if (data_len >= 0) {
24138
dc112387190f 2008.09.29 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24137
diff changeset
924 purple_debug_warning("QQ", "Decrypt login packet by pwd_twice_md5\n");
24137
87e61a85f5dd 2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
925 }
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
926 }
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
927 }
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
928 break;
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
929 }
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
930
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
931 if (data_len < 0) {
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
932 purple_debug_warning("QQ",
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
933 "Can not decrypt login cmd, [%05d], 0x%04X %s, len %d\n",
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
934 seq, cmd, qq_get_cmd_desc(cmd), rcved_len);
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
935 qq_show_packet("Can not decrypted", rcved, rcved_len);
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
936 purple_connection_error_reason(gc,
24135
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
937 PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR,
27381
f541583e31bd More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents: 25519
diff changeset
938 _("Unable to decrypt login reply"));
24135
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
939 return QQ_LOGIN_REPLY_ERR;
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
940 }
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
941
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
942 switch (cmd) {
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
943 case QQ_CMD_GET_SERVER:
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
944 ret_8 = qq_process_get_server(gc, data, data_len);
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
945 if ( ret_8 == QQ_LOGIN_REPLY_OK) {
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
946 qq_request_token(gc);
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
947 } else if ( ret_8 == QQ_LOGIN_REPLY_REDIRECT) {
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
948 return QQ_LOGIN_REPLY_REDIRECT;
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
949 }
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
950 break;
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
951 case QQ_CMD_TOKEN_EX:
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
952 ret_8 = qq_process_token_ex(gc, data, data_len);
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
953 if (ret_8 == QQ_LOGIN_REPLY_OK) {
24139
832178d951ca 2008.09.30 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24138
diff changeset
954 qq_request_check_pwd(gc);
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
955 } else if (ret_8 == QQ_LOGIN_REPLY_NEXT_TOKEN_EX) {
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
956 qq_request_token_ex_next(gc);
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
957 } else if (ret_8 == QQ_LOGIN_REPLY_CAPTCHA_DLG) {
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
958 qq_captcha_input_dialog(gc, &(qd->captcha));
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
959 g_free(qd->captcha.token);
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
960 g_free(qd->captcha.data);
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
961 memset(&qd->captcha, 0, sizeof(qd->captcha));
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
962 }
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
963 break;
24135
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
964 case QQ_CMD_CHECK_PWD:
24139
832178d951ca 2008.09.30 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24138
diff changeset
965 ret_8 = qq_process_check_pwd(gc, data, data_len);
24135
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
966 if (ret_8 != QQ_LOGIN_REPLY_OK) {
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
967 return ret_8;
24135
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
968 }
24639
9f2149adcac2 Clean debug info
Hu Yong <ccpaging@gmail.com>
parents: 24624
diff changeset
969 if (qd->client_version >= 2008) {
24135
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
970 qq_request_login_2008(gc);
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
971 } else {
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
972 qq_request_login_2007(gc);
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
973 }
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
974 break;
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
975 case QQ_CMD_LOGIN:
24639
9f2149adcac2 Clean debug info
Hu Yong <ccpaging@gmail.com>
parents: 24624
diff changeset
976 if (qd->client_version >= 2008) {
24137
87e61a85f5dd 2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
977 ret_8 = qq_process_login_2008(gc, data, data_len);
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
978 if ( ret_8 == QQ_LOGIN_REPLY_REDIRECT) {
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
979 qq_request_get_server(gc);
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
980 return QQ_LOGIN_REPLY_OK;
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
981 }
24639
9f2149adcac2 Clean debug info
Hu Yong <ccpaging@gmail.com>
parents: 24624
diff changeset
982 } else if (qd->client_version >= 2007) {
24137
87e61a85f5dd 2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
983 ret_8 = qq_process_login_2007(gc, data, data_len);
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
984 if ( ret_8 == QQ_LOGIN_REPLY_REDIRECT) {
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
985 qq_request_get_server(gc);
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
986 return QQ_LOGIN_REPLY_OK;
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
987 }
24137
87e61a85f5dd 2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
988 } else {
87e61a85f5dd 2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
989 ret_8 = qq_process_login(gc, data, data_len);
87e61a85f5dd 2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
990 }
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
991 if (ret_8 != QQ_LOGIN_REPLY_OK) {
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
992 return ret_8;
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
993 }
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
994
24431
75545fdf8944 String changes. I'm kind of blindly making changes to the qq strings
Mark Doliner <mark@kingant.net>
parents: 24164
diff changeset
995 purple_connection_update_progress(gc, _("Logging in"), QQ_CONNECT_STEPS - 1, QQ_CONNECT_STEPS);
24624
2457411cc613 Support new SMS MSG
Hu Yong <ccpaging@gmail.com>
parents: 24164
diff changeset
996 purple_debug_info("QQ", "Login replies OK; everything is fine\n");
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
997 purple_connection_set_state(gc, PURPLE_CONNECTED);
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
998 qd->is_login = TRUE; /* must be defined after sev_finish_login */
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
999
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
1000 /* now initiate QQ Qun, do it first as it may take longer to finish */
24157
1ee91ff0d5fe 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
1001 qq_room_data_initial(gc);
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1002
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
1003 /* is_login, but we have packets before login */
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
1004 qq_trans_process_remained(gc);
23879
23cec4360d4a applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23878
diff changeset
1005
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
1006 qq_update_all(gc, 0);
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
1007 break;
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
1008 default:
24678
2f84f888d3db fixed some spelling errors in QQ protocol plugin:
Björn Voigt <bjoern@cs.tu-berlin.de>
parents: 24653
diff changeset
1009 process_unknow_cmd(gc, _("Unknown LOGIN CMD"), data, data_len, cmd, seq);
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
1010 return QQ_LOGIN_REPLY_ERR;
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
1011 }
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
1012 return QQ_LOGIN_REPLY_OK;
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1013 }
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1014
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
1015 void qq_proc_client_cmds(PurpleConnection *gc, guint16 cmd, guint16 seq,
31191
4deef745de87 2010.01.23 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 30430
diff changeset
1016 guint8 *rcved, gint rcved_len, UPDCLS update_class, guint32 ship32)
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1017 {
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
1018 qq_data *qd;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
1019
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
1020 guint8 *data;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
1021 gint data_len;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
1022
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1023 guint8 ret_8 = 0;
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1024 guint16 ret_16 = 0;
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1025 guint32 ret_32 = 0;
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1026 gboolean is_unknow = FALSE;
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1027
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
1028 g_return_if_fail(rcved_len > 0);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
1029
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
1030 g_return_if_fail (gc != NULL && gc->proto_data != NULL);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
1031 qd = (qq_data *) gc->proto_data;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
1032
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
1033 data = g_newa(guint8, rcved_len);
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1034 data_len = qq_decrypt(data, rcved, rcved_len, qd->session_key);
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1035 if (data_len < 0) {
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1036 purple_debug_warning("QQ",
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1037 "Reply can not be decrypted by session key, [%05d], 0x%04X %s, len %d\n",
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1038 seq, cmd, qq_get_cmd_desc(cmd), rcved_len);
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1039 qq_show_packet("Can not decrypted", rcved, rcved_len);
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1040 return;
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
1041 }
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1042
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
1043 if (data_len <= 0) {
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1044 purple_debug_warning("QQ",
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1045 "Reply decrypted is empty, [%05d], 0x%04X %s, len %d\n",
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
1046 seq, cmd, qq_get_cmd_desc(cmd), rcved_len);
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
1047 return;
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
1048 }
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
1049
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1050 switch (cmd) {
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1051 case QQ_CMD_UPDATE_INFO:
24155
3c52353b83ae 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24154
diff changeset
1052 qq_process_change_info(gc, data, data_len);
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1053 break;
24163
7f5433ffbf8d 2008.10.22 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24162
diff changeset
1054 case QQ_CMD_ADD_BUDDY_NO_AUTH:
7f5433ffbf8d 2008.10.22 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24162
diff changeset
1055 qq_process_add_buddy_no_auth(gc, data, data_len, ship32);
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1056 break;
24163
7f5433ffbf8d 2008.10.22 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24162
diff changeset
1057 case QQ_CMD_REMOVE_BUDDY:
7f5433ffbf8d 2008.10.22 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24162
diff changeset
1058 qq_process_remove_buddy(gc, data, data_len, ship32);
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1059 break;
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
1060 case QQ_CMD_REMOVE_ME:
24160
d35672443baa 2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24159
diff changeset
1061 qq_process_buddy_remove_me(gc, data, data_len, ship32);
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1062 break;
24163
7f5433ffbf8d 2008.10.22 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24162
diff changeset
1063 case QQ_CMD_ADD_BUDDY_AUTH:
7f5433ffbf8d 2008.10.22 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24162
diff changeset
1064 qq_process_add_buddy_auth(data, data_len, gc);
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1065 break;
23879
23cec4360d4a applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23878
diff changeset
1066 case QQ_CMD_GET_BUDDY_INFO:
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
1067 qq_process_get_buddy_info(data, data_len, ship32, gc);
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1068 break;
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1069 case QQ_CMD_CHANGE_STATUS:
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
1070 qq_process_change_status(data, data_len, gc);
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1071 break;
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1072 case QQ_CMD_SEND_IM:
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
1073 do_im_ack(data, data_len, gc);
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1074 break;
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1075 case QQ_CMD_KEEP_ALIVE:
24140
619ac2303c46 2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24139
diff changeset
1076 if (qd->client_version >= 2008) {
619ac2303c46 2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24139
diff changeset
1077 qq_process_keep_alive_2008(data, data_len, gc);
619ac2303c46 2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24139
diff changeset
1078 } else if (qd->client_version >= 2007) {
619ac2303c46 2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24139
diff changeset
1079 qq_process_keep_alive_2007(data, data_len, gc);
619ac2303c46 2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24139
diff changeset
1080 } else {
619ac2303c46 2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24139
diff changeset
1081 qq_process_keep_alive(data, data_len, gc);
619ac2303c46 2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24139
diff changeset
1082 }
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1083 break;
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1084 case QQ_CMD_GET_BUDDIES_ONLINE:
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
1085 ret_8 = qq_process_get_buddies_online(data, data_len, gc);
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1086 if (ret_8 > 0 && ret_8 < 0xff) {
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1087 purple_debug_info("QQ", "Requesting for more online buddies\n");
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1088 qq_request_get_buddies_online(gc, ret_8, update_class);
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1089 return;
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1090 }
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1091 purple_debug_info("QQ", "All online buddies received\n");
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
1092 qq_update_buddyies_status(gc);
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1093 break;
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1094 case QQ_CMD_GET_LEVEL:
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1095 qq_process_get_level_reply(data, data_len, gc);
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1096 break;
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1097 case QQ_CMD_GET_BUDDIES_LIST:
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
1098 ret_16 = qq_process_get_buddies(data, data_len, gc);
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1099 if (ret_16 > 0 && ret_16 < 0xffff) {
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1100 purple_debug_info("QQ", "Requesting for more buddies\n");
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
1101 qq_request_get_buddies(gc, ret_16, update_class);
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1102 return;
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1103 }
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1104 purple_debug_info("QQ", "All buddies received. Requesting buddies' levels\n");
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1105 break;
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
1106 case QQ_CMD_GET_BUDDIES_AND_ROOMS:
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23641
diff changeset
1107 ret_32 = qq_process_get_buddies_and_rooms(data, data_len, gc);
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1108 if (ret_32 > 0 && ret_32 < 0xffffffff) {
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1109 purple_debug_info("QQ", "Requesting for more buddies and groups\n");
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1110 qq_request_get_buddies_and_rooms(gc, ret_32, update_class);
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1111 return;
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1112 }
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1113 purple_debug_info("QQ", "All buddies and groups received\n");
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1114 break;
24164
2a19984c0005 2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24163
diff changeset
1115 case QQ_CMD_AUTH_CODE:
2a19984c0005 2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24163
diff changeset
1116 qq_process_auth_code(gc, data, data_len, ship32);
2a19984c0005 2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24163
diff changeset
1117 break;
2a19984c0005 2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24163
diff changeset
1118 case QQ_CMD_BUDDY_QUESTION:
2a19984c0005 2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24163
diff changeset
1119 qq_process_question(gc, data, data_len, ship32);
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24160
diff changeset
1120 break;
24163
7f5433ffbf8d 2008.10.22 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24162
diff changeset
1121 case QQ_CMD_ADD_BUDDY_NO_AUTH_EX:
7f5433ffbf8d 2008.10.22 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24162
diff changeset
1122 qq_process_add_buddy_no_auth_ex(gc, data, data_len, ship32);
24162
f4f29fac96c6 2008.10.20 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24161
diff changeset
1123 break;
24164
2a19984c0005 2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24163
diff changeset
1124 case QQ_CMD_ADD_BUDDY_AUTH_EX:
2a19984c0005 2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24163
diff changeset
1125 qq_process_add_buddy_auth_ex(gc, data, data_len, ship32);
2a19984c0005 2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24163
diff changeset
1126 break;
24162
f4f29fac96c6 2008.10.20 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24161
diff changeset
1127 case QQ_CMD_BUDDY_CHECK_CODE:
24163
7f5433ffbf8d 2008.10.22 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24162
diff changeset
1128 qq_process_buddy_check_code(gc, data, data_len);
24162
f4f29fac96c6 2008.10.20 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24161
diff changeset
1129 break;
25517
59ed7712be5e 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25515
diff changeset
1130 case QQ_CMD_BUDDY_MEMO:
25515
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24925
diff changeset
1131 purple_debug_info("QQ", "Receive memo from server!\n");
25519
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25518
diff changeset
1132 qq_process_get_buddy_memo(gc, data, data_len, update_class, ship32);
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25518
diff changeset
1133 return;
d673ccc44a6e 2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25518
diff changeset
1134 purple_debug_info("QQ", "Should NOT be here...\n");
25515
7f903e67a995 2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24925
diff changeset
1135 break;
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1136 default:
24678
2f84f888d3db fixed some spelling errors in QQ protocol plugin:
Björn Voigt <bjoern@cs.tu-berlin.de>
parents: 24653
diff changeset
1137 process_unknow_cmd(gc, _("Unknown CLIENT CMD"), data, data_len, cmd, seq);
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1138 is_unknow = TRUE;
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1139 break;
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1140 }
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1141 if (is_unknow)
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1142 return;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1143
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1144 if (update_class == QQ_CMD_CLASS_NONE)
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1145 return;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1146
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1147 purple_debug_info("QQ", "Update class %d\n", update_class);
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1148 if (update_class == QQ_CMD_CLASS_UPDATE_ALL) {
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1149 qq_update_all(gc, cmd);
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1150 return;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1151 }
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1152 if (update_class == QQ_CMD_CLASS_UPDATE_ONLINE) {
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1153 qq_update_online(gc, cmd);
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1154 return;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
1155 }
23640
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1156 }
58bb7fc244e4 2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff changeset
1157