Mercurial > pidgin.yaz
annotate libpurple/protocols/qq/qq_process.c @ 24374:75545fdf8944
String changes. I'm kind of blindly making changes to the qq strings
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 14 Nov 2008 19:58:32 +0000 |
parents | 2a19984c0005 |
children | fecedf6d9ee1 |
rev | line source |
---|---|
23685
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 |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
25 #include "cipher.h" |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
26 #include "debug.h" |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
27 #include "internal.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" |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
34 #include "qq_crypt.h" |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
35 |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
36 #include "group_internal.h" |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
37 #include "group_im.h" |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
38 #include "group_info.h" |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
39 #include "group_join.h" |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
40 #include "group_opt.h" |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
41 |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
42 #include "qq_define.h" |
23685
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" |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
50 |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
51 enum { |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
52 QQ_ROOM_CMD_REPLY_OK = 0x00, |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
53 QQ_ROOM_CMD_REPLY_SEARCH_ERROR = 0x02, |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
54 QQ_ROOM_CMD_REPLY_NOT_MEMBER = 0x0a |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
55 }; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
56 |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
57 /* default process, decrypt and dump */ |
24077
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
58 static void process_unknow_cmd(PurpleConnection *gc,const gchar *title, guint8 *data, gint data_len, guint16 cmd, guint16 seq) |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
59 { |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
60 qq_data *qd; |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
61 gchar *msg; |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
62 |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
63 g_return_if_fail(data != NULL && data_len != 0); |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
64 |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
65 qq_show_packet(title, data, data_len); |
23685
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 qd = (qq_data *) gc->proto_data; |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
68 |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
69 qq_hex_dump(PURPLE_DEBUG_WARNING, "QQ", |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
70 data, data_len, |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
71 ">>> [%d] %s -> [default] decrypt and dump", |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
72 seq, qq_get_cmd_desc(cmd)); |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
73 |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
74 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:
24091
diff
changeset
|
75 purple_notify_info(gc, _("QQ Error"), title, msg); |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
76 g_free(msg); |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
77 } |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
78 |
24077
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
79 /* parse the reply to send_im */ |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
80 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:
24076
diff
changeset
|
81 { |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
82 qq_data *qd; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
83 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
84 g_return_if_fail(data != NULL && data_len != 0); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
85 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
86 qd = gc->proto_data; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
87 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
88 if (data[0] != 0) { |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
89 purple_debug_warning("QQ", "Failed sent IM\n"); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
90 purple_notify_error(gc, _("Error"), _("Failed to send IM."), NULL); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
91 return; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
92 } |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
93 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
94 purple_debug_info("QQ", "OK sent IM\n"); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
95 } |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
96 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
97 static void do_server_news(guint8 *data, gint data_len, PurpleConnection *gc) |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
98 { |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
99 qq_data *qd = (qq_data *) gc->proto_data; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
100 gint bytes; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
101 gchar *title, *brief, *url; |
24095
2a19984c0005
2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24094
diff
changeset
|
102 gchar *content; |
24077
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
103 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
104 g_return_if_fail(data != NULL && data_len != 0); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
105 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
106 /* qq_show_packet("Rcv news", data, data_len); */ |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
107 |
24095
2a19984c0005
2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24094
diff
changeset
|
108 bytes = 4; /* skip unknown 4 bytes */ |
24077
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
109 |
24095
2a19984c0005
2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24094
diff
changeset
|
110 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:
24094
diff
changeset
|
111 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:
24094
diff
changeset
|
112 bytes += qq_get_vstr(&url, QQ_CHARSET_DEFAULT, data + bytes); |
24077
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
113 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
114 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:
24076
diff
changeset
|
115 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
116 if (qd->is_show_news) { |
24095
2a19984c0005
2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24094
diff
changeset
|
117 qq_got_attention(gc, content); |
24077
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
118 } else { |
24095
2a19984c0005
2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24094
diff
changeset
|
119 purple_debug_info("QQ", "QQ Server news:\n%s\n", content); |
24077
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
120 } |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
121 g_free(title); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
122 g_free(brief); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
123 g_free(url); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
124 g_free(content); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
125 } |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
126 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
127 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:
24076
diff
changeset
|
128 { |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
129 gint len; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
130 guint8 reply; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
131 gchar **segments, *msg_utf8; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
132 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
133 g_return_if_fail(data != NULL && data_len != 0); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
134 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
135 len = data_len; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
136 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
137 if (NULL == (segments = split_data(data, len, "\x2f", 2))) |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
138 return; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
139 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
140 reply = strtol(segments[0], NULL, 10); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
141 if (reply == 1) |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
142 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:
24076
diff
changeset
|
143 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
144 msg_utf8 = qq_to_utf8(segments[1], QQ_CHARSET_DEFAULT); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
145 qq_got_attention(gc, msg_utf8); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
146 } |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
147 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
148 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:
24076
diff
changeset
|
149 { |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
150 gint bytes; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
151 gint msg_len; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
152 GString *content; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
153 gchar *msg = NULL; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
154 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
155 g_return_if_fail(data != NULL && data_len > 0); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
156 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
157 bytes = 6; /* skip 0x(06 00 01 1e 01 1c)*/ |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
158 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
159 content = g_string_new(""); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
160 while (bytes < data_len) { |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
161 msg_len = qq_get_vstr(&msg, QQ_CHARSET_DEFAULT, data + bytes); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
162 g_string_append(content, msg); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
163 g_string_append(content, "\n"); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
164 g_free(msg); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
165 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
166 if (msg_len <= 1) { |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
167 break; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
168 } |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
169 bytes += msg_len; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
170 } |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
171 if (bytes != data_len) { |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
172 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:
24076
diff
changeset
|
173 qq_show_packet("do_msg_sys_4c", data, data_len); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
174 } |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
175 qq_got_attention(gc, content->str); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
176 g_string_free(content, FALSE); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
177 } |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
178 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
179 static const gchar *get_im_type_desc(gint type) |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
180 { |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
181 switch (type) { |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
182 case QQ_MSG_TO_BUDDY: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
183 return "QQ_MSG_TO_BUDDY"; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
184 case QQ_MSG_TO_UNKNOWN: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
185 return "QQ_MSG_TO_UNKNOWN"; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
186 case QQ_MSG_UNKNOWN_QUN_IM: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
187 return "QQ_MSG_UNKNOWN_QUN_IM"; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
188 case QQ_MSG_ADD_TO_QUN: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
189 return "QQ_MSG_ADD_TO_QUN"; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
190 case QQ_MSG_DEL_FROM_QUN: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
191 return "QQ_MSG_DEL_FROM_QUN"; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
192 case QQ_MSG_APPLY_ADD_TO_QUN: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
193 return "QQ_MSG_APPLY_ADD_TO_QUN"; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
194 case QQ_MSG_CREATE_QUN: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
195 return "QQ_MSG_CREATE_QUN"; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
196 case QQ_MSG_SYS_30: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
197 return "QQ_MSG_SYS_30"; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
198 case QQ_MSG_SYS_4C: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
199 return "QQ_MSG_SYS_4C"; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
200 case QQ_MSG_APPROVE_APPLY_ADD_TO_QUN: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
201 return "QQ_MSG_APPROVE_APPLY_ADD_TO_QUN"; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
202 case QQ_MSG_REJCT_APPLY_ADD_TO_QUN: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
203 return "QQ_MSG_REJCT_APPLY_ADD_TO_QUN"; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
204 case QQ_MSG_TEMP_QUN_IM: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
205 return "QQ_MSG_TEMP_QUN_IM"; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
206 case QQ_MSG_QUN_IM: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
207 return "QQ_MSG_QUN_IM"; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
208 case QQ_MSG_NEWS: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
209 return "QQ_MSG_NEWS"; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
210 case QQ_MSG_EXTEND: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
211 return "QQ_MSG_EXTEND"; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
212 case QQ_MSG_EXTEND_85: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
213 return "QQ_MSG_EXTEND_85"; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
214 default: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
215 return "QQ_MSG_UNKNOWN"; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
216 } |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
217 } |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
218 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
219 /* I receive a message, mainly it is text msg, |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
220 * but we need to proess other types (group etc) */ |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
221 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:
24076
diff
changeset
|
222 { |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
223 qq_data *qd; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
224 gint bytes; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
225 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
226 struct { |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
227 guint32 uid_from; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
228 guint32 uid_to; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
229 guint32 seq; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
230 struct in_addr ip_from; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
231 guint16 port_from; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
232 guint16 msg_type; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
233 } header; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
234 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
235 g_return_if_fail(data != NULL && data_len != 0); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
236 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
237 qd = (qq_data *) gc->proto_data; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
238 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
239 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:
24076
diff
changeset
|
240 purple_debug_error("QQ", "MSG is too short\n"); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
241 return; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
242 } else { |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
243 /* when we receive a message, |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
244 * 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:
24076
diff
changeset
|
245 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:
24076
diff
changeset
|
246 } |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
247 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
248 /* check len first */ |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
249 if (data_len < 20) { /* length of im_header */ |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
250 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:
24076
diff
changeset
|
251 return; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
252 } |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
253 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
254 bytes = 0; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
255 bytes += qq_get32(&(header.uid_from), data + bytes); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
256 bytes += qq_get32(&(header.uid_to), data + bytes); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
257 bytes += qq_get32(&(header.seq), data + bytes); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
258 /* 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:
24076
diff
changeset
|
259 bytes += qq_getIP(&(header.ip_from), data + bytes); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
260 bytes += qq_get16(&(header.port_from), data + bytes); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
261 bytes += qq_get16(&(header.msg_type), data + bytes); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
262 /* im_header prepared */ |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
263 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
264 if (header.uid_to != qd->uid) { /* should not happen */ |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
265 purple_debug_error("QQ", "MSG to [%d], NOT me\n", header.uid_to); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
266 return; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
267 } |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
268 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
269 /* check bytes */ |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
270 if (bytes >= data_len - 1) { |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
271 purple_debug_warning("QQ", "Empty MSG\n"); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
272 return; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
273 } |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
274 |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
275 switch (header.msg_type) { |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
276 case QQ_MSG_NEWS: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
277 do_server_news(data + bytes, data_len - bytes, gc); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
278 break; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
279 case QQ_MSG_EXTEND: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
280 case QQ_MSG_EXTEND_85: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
281 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:
24076
diff
changeset
|
282 qq_process_extend_im(gc, data + bytes, data_len - bytes); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
283 break; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
284 case QQ_MSG_TO_UNKNOWN: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
285 case QQ_MSG_TO_BUDDY: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
286 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:
24076
diff
changeset
|
287 qq_process_im(gc, data + bytes, data_len - bytes); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
288 break; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
289 case QQ_MSG_UNKNOWN_QUN_IM: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
290 case QQ_MSG_TEMP_QUN_IM: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
291 case QQ_MSG_QUN_IM: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
292 purple_debug_info("QQ", "MSG from room [%d]\n", header.uid_from); |
24090
9be95f0b9472
2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24088
diff
changeset
|
293 qq_process_room_im(data + bytes, data_len - bytes, header.uid_from, gc, header.msg_type); |
24077
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
294 break; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
295 case QQ_MSG_ADD_TO_QUN: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
296 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:
24076
diff
changeset
|
297 /* uid_from is group id |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
298 * we need this to create a dummy group and add to blist */ |
24090
9be95f0b9472
2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24088
diff
changeset
|
299 qq_process_room_buddy_joined(data + bytes, data_len - bytes, header.uid_from, gc); |
24077
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
300 break; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
301 case QQ_MSG_DEL_FROM_QUN: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
302 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:
24076
diff
changeset
|
303 /* uid_from is group id */ |
24090
9be95f0b9472
2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24088
diff
changeset
|
304 qq_process_room_buddy_removed(data + bytes, data_len - bytes, header.uid_from, gc); |
24077
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
305 break; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
306 case QQ_MSG_APPLY_ADD_TO_QUN: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
307 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:
24076
diff
changeset
|
308 /* uid_from is group id */ |
24090
9be95f0b9472
2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24088
diff
changeset
|
309 qq_process_room_buddy_request_join(data + bytes, data_len - bytes, header.uid_from, gc); |
24077
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
310 break; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
311 case QQ_MSG_APPROVE_APPLY_ADD_TO_QUN: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
312 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:
24076
diff
changeset
|
313 header.uid_from); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
314 /* uid_from is group id */ |
24090
9be95f0b9472
2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24088
diff
changeset
|
315 qq_process_room_buddy_approved(data + bytes, data_len - bytes, header.uid_from, gc); |
24077
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
316 break; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
317 case QQ_MSG_REJCT_APPLY_ADD_TO_QUN: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
318 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:
24076
diff
changeset
|
319 header.uid_from); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
320 /* uid_from is group id */ |
24090
9be95f0b9472
2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24088
diff
changeset
|
321 qq_process_room_buddy_rejected(data + bytes, data_len - bytes, header.uid_from, gc); |
24077
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
322 break; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
323 case QQ_MSG_SYS_30: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
324 do_msg_sys_30(gc, data + bytes, data_len - bytes); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
325 break; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
326 case QQ_MSG_SYS_4C: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
327 do_msg_sys_4c(gc, data + bytes, data_len - bytes); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
328 break; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
329 default: |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
330 purple_debug_warning("QQ", "MSG from [%d], unknown type %s [0x%04X]\n", |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
331 header.uid_from, get_im_type_desc(header.msg_type), header.msg_type); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
332 qq_show_packet("Unknown MSG type", data, data_len); |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
333 break; |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
334 } |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
335 } |
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
336 |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
337 /* Send ACK if the sys message needs an ACK */ |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
338 static void request_server_ack(PurpleConnection *gc, gchar *funct_str, gchar *from, guint16 seq) |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
339 { |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
340 qq_data *qd; |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
341 guint8 *raw_data; |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
342 gint bytes; |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
343 guint8 bar; |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
344 |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
345 g_return_if_fail(funct_str != NULL && from != NULL); |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
346 qd = (qq_data *) gc->proto_data; |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
347 |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
348 |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
349 bar = 0x1e; |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
350 raw_data = g_newa(guint8, strlen(funct_str) + strlen(from) + 16); |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
351 |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
352 bytes = 0; |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
353 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:
24091
diff
changeset
|
354 bytes += qq_put8(raw_data + bytes, bar); |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
355 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:
24091
diff
changeset
|
356 bytes += qq_put8(raw_data + bytes, bar); |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
357 bytes += qq_put16(raw_data + bytes, seq); |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
358 |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
359 qq_send_server_reply(gc, QQ_CMD_ACK_SYS_MSG, 0, raw_data, bytes); |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
360 } |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
361 |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
362 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:
24091
diff
changeset
|
363 guint8 *data, gint data_len) |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
364 { |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
365 qq_data *qd = (qq_data *) gc->proto_data; |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
366 gchar *msg, *msg_utf8; |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
367 gchar *title, *content; |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
368 |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
369 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:
24091
diff
changeset
|
370 |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
371 msg = g_strndup((gchar *)data, data_len); |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
372 msg_utf8 = qq_to_utf8(msg, QQ_CHARSET_DEFAULT); |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
373 g_free(msg); |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
374 if (msg_utf8 == NULL) { |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
375 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:
24091
diff
changeset
|
376 from, to); |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
377 return; |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
378 } |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
379 |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
380 title = g_strdup_printf(_("From %s:"), from); |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
381 content = g_strdup_printf(_("Server notice From %s: \n%s"), from, msg_utf8); |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
382 |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
383 if (qd->is_show_notice) { |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
384 qq_got_attention(gc, content); |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
385 } else { |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
386 purple_debug_info("QQ", "QQ Server notice from %s:\n%s", from, msg_utf8); |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
387 } |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
388 g_free(msg_utf8); |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
389 g_free(title); |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
390 g_free(content); |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
391 } |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
392 |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
393 static void process_server_msg(PurpleConnection *gc, guint8 *data, gint data_len, guint16 seq) |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
394 { |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
395 qq_data *qd; |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
396 guint8 *data_str; |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
397 gchar **segments; |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
398 gchar *funct_str, *from, *to; |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
399 gint bytes, funct; |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
400 |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
401 g_return_if_fail(data != NULL && data_len != 0); |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
402 |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
403 qd = (qq_data *) gc->proto_data; |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
404 |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
405 data_str = g_newa(guint8, data_len + 1); |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
406 g_memmove(data_str, data, data_len); |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
407 data_str[data_len] = 0x00; |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
408 |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
409 segments = g_strsplit_set((gchar *) data_str, "\x1f", 0); |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
410 g_return_if_fail(segments != NULL); |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
411 if (g_strv_length(segments) < 3) { |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
412 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:
24091
diff
changeset
|
413 g_strfreev(segments); |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
414 return; |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
415 } |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
416 |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
417 bytes = 0; |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
418 funct_str = segments[0]; |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
419 bytes += strlen(funct_str) + 1; |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
420 from = segments[1]; |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
421 bytes += strlen(from) + 1; |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
422 to = segments[2]; |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
423 bytes += strlen(to) + 1; |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
424 |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
425 request_server_ack(gc, funct_str, from, seq); |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
426 |
24093
f4f29fac96c6
2008.10.20 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24092
diff
changeset
|
427 /* qq_show_packet("Server MSG", data, data_len); */ |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
428 if (strtol(to, NULL, 10) != qd->uid) { /* not to me */ |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
429 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:
24046
diff
changeset
|
430 g_strfreev(segments); |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
431 return; |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
432 } |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
433 |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
434 funct = strtol(funct_str, NULL, 10); |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
435 switch (funct) { |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
436 case QQ_SERVER_BUDDY_ADDED: |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
437 case QQ_SERVER_BUDDY_ADD_REQUEST: |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
438 case QQ_SERVER_BUDDY_ADDED_ME: |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
439 case QQ_SERVER_BUDDY_REJECTED_ME: |
24093
f4f29fac96c6
2008.10.20 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24092
diff
changeset
|
440 case QQ_SERVER_BUDDY_ADD_REQUEST_EX: |
f4f29fac96c6
2008.10.20 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24092
diff
changeset
|
441 case QQ_SERVER_BUDDY_ADDING_EX: |
f4f29fac96c6
2008.10.20 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24092
diff
changeset
|
442 case QQ_SERVER_BUDDY_ADDED_ANSWER: |
f4f29fac96c6
2008.10.20 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24092
diff
changeset
|
443 case QQ_SERVER_BUDDY_ADDED_EX: |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
444 qq_process_buddy_from_server(gc, funct, from, to, data + bytes, data_len - bytes); |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
445 break; |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
446 case QQ_SERVER_NOTICE: |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
447 do_server_notice(gc, from, to, data + bytes, data_len - bytes); |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
448 break; |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
449 case QQ_SERVER_NEW_CLIENT: |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
450 purple_debug_warning("QQ", "QQ Server has newer client version\n"); |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
451 break; |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
452 default: |
24093
f4f29fac96c6
2008.10.20 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24092
diff
changeset
|
453 qq_show_packet("Unknown sys msg", data, data_len); |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
454 purple_debug_warning("QQ", "Recv unknown sys msg code: %s\n", funct_str); |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
455 break; |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
456 } |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
457 g_strfreev(segments); |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
458 } |
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
459 |
23755
23cec4360d4a
applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23754
diff
changeset
|
460 void qq_proc_server_cmd(PurpleConnection *gc, guint16 cmd, guint16 seq, guint8 *rcved, gint rcved_len) |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
461 { |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
462 qq_data *qd; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
463 |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
464 guint8 *data; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
465 gint data_len; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
466 |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
467 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:
23686
diff
changeset
|
468 qd = (qq_data *) gc->proto_data; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
469 |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
470 data = g_newa(guint8, rcved_len); |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
471 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:
23686
diff
changeset
|
472 if (data_len < 0) { |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
473 purple_debug_warning("QQ", |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
474 "Can not decrypt server cmd by session key, [%05d], 0x%04X %s, len %d\n", |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
475 seq, cmd, qq_get_cmd_desc(cmd), rcved_len); |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
476 qq_show_packet("Can not decrypted", rcved, rcved_len); |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
477 return; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
478 } |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
479 |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
480 if (data_len <= 0) { |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
481 purple_debug_warning("QQ", |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
482 "Server cmd decrypted is empty, [%05d], 0x%04X %s, len %d\n", |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
483 seq, cmd, qq_get_cmd_desc(cmd), rcved_len); |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
484 return; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
485 } |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
486 |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
487 /* now process the packet */ |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
488 switch (cmd) { |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
489 case QQ_CMD_RECV_IM: |
24077
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
490 process_private_msg(data, data_len, seq, gc); |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
491 break; |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
492 case QQ_CMD_RECV_MSG_SYS: |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
493 process_server_msg(gc, data, data_len, seq); |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
494 break; |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
495 case QQ_CMD_BUDDY_CHANGE_STATUS: |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
496 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
|
497 break; |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
498 default: |
24077
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
499 process_unknow_cmd(gc, _("Unknow SERVER CMD"), data, data_len, cmd, seq); |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
500 break; |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
501 } |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
502 } |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
503 |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
504 static void process_room_cmd_notify(PurpleConnection *gc, |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
505 guint8 room_cmd, guint8 room_id, guint8 reply, guint8 *data, gint data_len) |
24026
25f62d21b3f8
disapproval of revision '8cebefbc6cd5d84acb69c74e69e8821f11dd225d'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24019
diff
changeset
|
506 { |
23756
1a0caf9983fa
applied changes from 92d52eef2994d2697999177804e3665989cfa352
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23755
diff
changeset
|
507 gchar *prim; |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
508 gchar *msg, *msg_utf8; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
509 g_return_if_fail(data != NULL && data_len > 0); |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
510 |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
511 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:
23686
diff
changeset
|
512 msg_utf8 = qq_to_utf8(msg, QQ_CHARSET_DEFAULT); |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
513 g_free(msg); |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
514 |
23756
1a0caf9983fa
applied changes from 92d52eef2994d2697999177804e3665989cfa352
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23755
diff
changeset
|
515 prim = g_strdup_printf(_("Error reply of %s(0x%02X)\nRoom %d, reply 0x%02X"), |
1a0caf9983fa
applied changes from 92d52eef2994d2697999177804e3665989cfa352
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23755
diff
changeset
|
516 qq_get_room_cmd_desc(room_cmd), room_cmd, room_id, reply); |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
517 |
23756
1a0caf9983fa
applied changes from 92d52eef2994d2697999177804e3665989cfa352
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23755
diff
changeset
|
518 purple_notify_error(gc, _("QQ Qun Command"), prim, msg_utf8); |
1a0caf9983fa
applied changes from 92d52eef2994d2697999177804e3665989cfa352
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23755
diff
changeset
|
519 |
1a0caf9983fa
applied changes from 92d52eef2994d2697999177804e3665989cfa352
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23755
diff
changeset
|
520 g_free(prim); |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
521 g_free(msg_utf8); |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
522 } |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
523 |
23755
23cec4360d4a
applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23754
diff
changeset
|
524 void qq_update_room(PurpleConnection *gc, guint8 room_cmd, guint32 room_id) |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
525 { |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
526 qq_data *qd; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
527 gint ret; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
528 |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
529 g_return_if_fail (gc != NULL && gc->proto_data != NULL); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
530 qd = (qq_data *) gc->proto_data; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
531 |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
532 switch (room_cmd) { |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
533 case 0: |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
534 qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_INFO, room_id, NULL, 0, |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
535 QQ_CMD_CLASS_UPDATE_ROOM, 0); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
536 break; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
537 case QQ_ROOM_CMD_GET_INFO: |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
538 ret = qq_request_room_get_buddies(gc, room_id, QQ_CMD_CLASS_UPDATE_ROOM); |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
539 if (ret <= 0) { |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
540 qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_ONLINES, room_id, NULL, 0, |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
541 QQ_CMD_CLASS_UPDATE_ROOM, 0); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
542 } |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
543 break; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
544 case QQ_ROOM_CMD_GET_BUDDIES: |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
545 qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_ONLINES, room_id, NULL, 0, |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
546 QQ_CMD_CLASS_UPDATE_ROOM, 0); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
547 break; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
548 case QQ_ROOM_CMD_GET_ONLINES: |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
549 /* last command */ |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
550 default: |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
551 break; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
552 } |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
553 } |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
554 |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
555 void qq_update_all_rooms(PurpleConnection *gc, guint8 room_cmd, guint32 room_id) |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
556 { |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
557 qq_data *qd; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
558 gboolean is_new_turn = FALSE; |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
559 guint32 next_id; |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
560 |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
561 g_return_if_fail (gc != NULL && gc->proto_data != NULL); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
562 qd = (qq_data *) gc->proto_data; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
563 |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
564 next_id = qq_room_get_next(gc, room_id); |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
565 purple_debug_info("QQ", "Update rooms, next id %d, prev id %d\n", next_id, room_id); |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
566 |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
567 if (next_id <= 0) { |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
568 if (room_id > 0) { |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
569 is_new_turn = TRUE; |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
570 next_id = qq_room_get_next(gc, 0); |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
571 purple_debug_info("QQ", "new turn, id %d\n", next_id); |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
572 } else { |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
573 purple_debug_info("QQ", "No room. Finished update\n"); |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
574 return; |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
575 } |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
576 } |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
577 |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
578 switch (room_cmd) { |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
579 case 0: |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
580 qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_INFO, next_id, NULL, 0, |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
581 QQ_CMD_CLASS_UPDATE_ALL, 0); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
582 break; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
583 case QQ_ROOM_CMD_GET_INFO: |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
584 if (!is_new_turn) { |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
585 qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_INFO, next_id, NULL, 0, |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
586 QQ_CMD_CLASS_UPDATE_ALL, 0); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
587 } else { |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
588 qq_request_room_get_buddies(gc, next_id, QQ_CMD_CLASS_UPDATE_ALL); |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
589 } |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
590 break; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
591 case QQ_ROOM_CMD_GET_BUDDIES: |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
592 /* last command */ |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
593 if (!is_new_turn) { |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
594 qq_request_room_get_buddies(gc, next_id, QQ_CMD_CLASS_UPDATE_ALL); |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
595 } else { |
23755
23cec4360d4a
applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23754
diff
changeset
|
596 purple_debug_info("QQ", "Finished update\n"); |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
597 } |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
598 break; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
599 default: |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
600 break; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
601 } |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
602 } |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
603 |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
604 void qq_update_all(PurpleConnection *gc, guint16 cmd) |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
605 { |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
606 qq_data *qd; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
607 |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
608 g_return_if_fail (gc != NULL && gc->proto_data != NULL); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
609 qd = (qq_data *) gc->proto_data; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
610 |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
611 switch (cmd) { |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
612 case 0: |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
613 qq_request_buddy_info(gc, qd->uid, QQ_CMD_CLASS_UPDATE_ALL, 0); |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
614 break; |
23755
23cec4360d4a
applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23754
diff
changeset
|
615 case QQ_CMD_GET_BUDDY_INFO: |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
616 qq_request_change_status(gc, QQ_CMD_CLASS_UPDATE_ALL); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
617 break; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
618 case QQ_CMD_CHANGE_STATUS: |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
619 qq_request_get_buddies(gc, 0, QQ_CMD_CLASS_UPDATE_ALL); |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
620 break; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
621 case QQ_CMD_GET_BUDDIES_LIST: |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
622 qq_request_get_buddies_and_rooms(gc, 0, QQ_CMD_CLASS_UPDATE_ALL); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
623 break; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
624 case QQ_CMD_GET_BUDDIES_AND_ROOMS: |
24073
df699d739b8f
2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24071
diff
changeset
|
625 if (qd->client_version >= 2007) { |
df699d739b8f
2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24071
diff
changeset
|
626 /* QQ2007/2008 can not get buddies level*/ |
df699d739b8f
2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24071
diff
changeset
|
627 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:
24071
diff
changeset
|
628 } else { |
df699d739b8f
2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24071
diff
changeset
|
629 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:
24071
diff
changeset
|
630 } |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
631 break; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
632 case QQ_CMD_GET_LEVEL: |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
633 qq_request_get_buddies_online(gc, 0, QQ_CMD_CLASS_UPDATE_ALL); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
634 break; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
635 case QQ_CMD_GET_BUDDIES_ONLINE: |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
636 /* last command */ |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
637 qq_update_all_rooms(gc, 0, 0); |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
638 break; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
639 default: |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
640 break; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
641 } |
24080
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24079
diff
changeset
|
642 qd->online_last_update = time(NULL); |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
643 } |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
644 |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
645 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:
23753
diff
changeset
|
646 { |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
647 qq_data *qd; |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
648 guint32 next_id; |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
649 |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
650 g_return_if_fail (gc != NULL && gc->proto_data != NULL); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
651 qd = (qq_data *) gc->proto_data; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
652 |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
653 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:
24086
diff
changeset
|
654 if (next_id <= 0 && room_id <= 0) { |
23755
23cec4360d4a
applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23754
diff
changeset
|
655 purple_debug_info("QQ", "No room in conversation, no update online buddies\n"); |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
656 return; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
657 } |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
658 if (next_id <= 0 ) { |
23755
23cec4360d4a
applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23754
diff
changeset
|
659 purple_debug_info("QQ", "finished update rooms' online buddies\n"); |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
660 return; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
661 } |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
662 |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
663 switch (room_cmd) { |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
664 case 0: |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
665 qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_ONLINES, next_id, NULL, 0, |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
666 QQ_CMD_CLASS_UPDATE_ALL, 0); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
667 break; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
668 case QQ_ROOM_CMD_GET_ONLINES: |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
669 qq_send_room_cmd_mess(gc, QQ_ROOM_CMD_GET_ONLINES, next_id, NULL, 0, |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
670 QQ_CMD_CLASS_UPDATE_ALL, 0); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
671 break; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
672 default: |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
673 break; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
674 } |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
675 } |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
676 |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
677 void qq_update_online(PurpleConnection *gc, guint16 cmd) |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
678 { |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
679 qq_data *qd; |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
680 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:
24048
diff
changeset
|
681 qd = (qq_data *) gc->proto_data; |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
682 |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
683 switch (cmd) { |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
684 case 0: |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
685 qq_request_get_buddies_online(gc, 0, QQ_CMD_CLASS_UPDATE_ONLINE); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
686 break; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
687 case QQ_CMD_GET_BUDDIES_ONLINE: |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
688 /* last command */ |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
689 update_all_rooms_online(gc, 0, 0); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
690 break; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
691 default: |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
692 break; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
693 } |
24080
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24079
diff
changeset
|
694 qd->online_last_update = time(NULL); |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
695 } |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
696 |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
697 void qq_proc_room_cmds(PurpleConnection *gc, guint16 seq, |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
698 guint8 room_cmd, guint32 room_id, guint8 *rcved, gint rcved_len, |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
699 gint update_class, guint32 ship32) |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
700 { |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
701 qq_data *qd; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
702 guint8 *data; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
703 gint data_len; |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
704 qq_room_data *rmd; |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
705 gint bytes; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
706 guint8 reply_cmd, reply; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
707 |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
708 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:
23686
diff
changeset
|
709 qd = (qq_data *) gc->proto_data; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
710 |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
711 data = g_newa(guint8, rcved_len); |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
712 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:
23686
diff
changeset
|
713 if (data_len < 0) { |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
714 purple_debug_warning("QQ", |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
715 "Can not decrypt room cmd by session key, [%05d], 0x%02X %s for %d, len %d\n", |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
716 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:
23686
diff
changeset
|
717 qq_show_packet("Can not decrypted", rcved, rcved_len); |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
718 return; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
719 } |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
720 |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
721 if (room_id <= 0) { |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
722 purple_debug_warning("QQ", |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
723 "Invaild room id, [%05d], 0x%02X %s for %d, len %d\n", |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
724 seq, room_cmd, qq_get_room_cmd_desc(room_cmd), room_id, rcved_len); |
23756
1a0caf9983fa
applied changes from 92d52eef2994d2697999177804e3665989cfa352
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23755
diff
changeset
|
725 /* Some room cmd has no room id, like QQ_ROOM_CMD_SEARCH */ |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
726 } |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
727 |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
728 if (data_len <= 2) { |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
729 purple_debug_warning("QQ", |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
730 "Invaild len of room cmd decrypted, [%05d], 0x%02X %s for %d, len %d\n", |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
731 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:
23686
diff
changeset
|
732 return; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
733 } |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
734 |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
735 bytes = 0; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
736 bytes += qq_get8(&reply_cmd, data + bytes); |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
737 bytes += qq_get8(&reply, data + bytes); |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
738 |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
739 if (reply_cmd != room_cmd) { |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
740 purple_debug_warning("QQ", |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
741 "Missing room cmd in reply 0x%02X %s, [%05d], 0x%02X %s for %d, len %d\n", |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
742 reply_cmd, qq_get_room_cmd_desc(reply_cmd), |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
743 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:
23686
diff
changeset
|
744 } |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
745 |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
746 /* now process the packet */ |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
747 if (reply != QQ_ROOM_CMD_REPLY_OK) { |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
748 switch (reply) { /* this should be all errors */ |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
749 case QQ_ROOM_CMD_REPLY_NOT_MEMBER: |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
750 rmd = qq_room_data_find(gc, room_id); |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
751 if (rmd == NULL) { |
24085
237e5a94e11c
2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24080
diff
changeset
|
752 purple_debug_warning("QQ", |
237e5a94e11c
2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24080
diff
changeset
|
753 "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:
24080
diff
changeset
|
754 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:
24080
diff
changeset
|
755 } else { |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
756 purple_debug_warning("QQ", |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
757 _("Not a member of room \"%s\"\n"), rmd->title_utf8); |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
758 rmd->my_role = QQ_ROOM_ROLE_NO; |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
759 } |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
760 break; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
761 case QQ_ROOM_CMD_REPLY_SEARCH_ERROR: |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
762 if (qd->roomlist != NULL) { |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
763 if (purple_roomlist_get_in_progress(qd->roomlist)) |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
764 purple_roomlist_set_in_progress(qd->roomlist, FALSE); |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
765 } |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
766 default: |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
767 process_room_cmd_notify(gc, reply_cmd, room_id, reply, data + bytes, data_len - bytes); |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
768 } |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
769 return; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
770 } |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
771 |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
772 /* 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:
23686
diff
changeset
|
773 switch (reply_cmd) { |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
774 case QQ_ROOM_CMD_GET_INFO: |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
775 qq_process_room_cmd_get_info(data + bytes, data_len - bytes, ship32, gc); |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
776 break; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
777 case QQ_ROOM_CMD_CREATE: |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
778 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:
23686
diff
changeset
|
779 break; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
780 case QQ_ROOM_CMD_CHANGE_INFO: |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
781 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:
23686
diff
changeset
|
782 break; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
783 case QQ_ROOM_CMD_MEMBER_OPT: |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
784 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:
23686
diff
changeset
|
785 break; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
786 case QQ_ROOM_CMD_ACTIVATE: |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
787 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:
23686
diff
changeset
|
788 break; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
789 case QQ_ROOM_CMD_SEARCH: |
24085
237e5a94e11c
2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24080
diff
changeset
|
790 qq_process_room_search(gc, data + bytes, data_len - bytes, ship32); |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
791 break; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
792 case QQ_ROOM_CMD_JOIN: |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
793 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:
23686
diff
changeset
|
794 break; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
795 case QQ_ROOM_CMD_AUTH: |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
796 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:
23686
diff
changeset
|
797 break; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
798 case QQ_ROOM_CMD_QUIT: |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
799 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:
23686
diff
changeset
|
800 break; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
801 case QQ_ROOM_CMD_SEND_MSG: |
24090
9be95f0b9472
2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24088
diff
changeset
|
802 qq_process_room_send_im(gc, data + bytes, data_len - bytes); |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
803 break; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
804 case QQ_ROOM_CMD_GET_ONLINES: |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
805 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:
23686
diff
changeset
|
806 break; |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
807 case QQ_ROOM_CMD_GET_BUDDIES: |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
808 qq_process_room_cmd_get_buddies(data + bytes, data_len - bytes, gc); |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
809 break; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
810 default: |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
811 purple_debug_warning("QQ", "Unknow room cmd 0x%02X %s\n", |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
812 reply_cmd, qq_get_room_cmd_desc(reply_cmd)); |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
813 } |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
814 |
23755
23cec4360d4a
applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23754
diff
changeset
|
815 if (update_class == QQ_CMD_CLASS_NONE) |
23cec4360d4a
applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23754
diff
changeset
|
816 return; |
23cec4360d4a
applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23754
diff
changeset
|
817 |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
818 if (update_class == QQ_CMD_CLASS_UPDATE_ALL) { |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
819 qq_update_all_rooms(gc, room_cmd, room_id); |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
820 return; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
821 } |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
822 if (update_class == QQ_CMD_CLASS_UPDATE_ONLINE) { |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
823 update_all_rooms_online(gc, room_cmd, room_id); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
824 return; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
825 } |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
826 if (update_class == QQ_CMD_CLASS_UPDATE_ROOM) { |
23755
23cec4360d4a
applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23754
diff
changeset
|
827 qq_update_room(gc, room_cmd, room_id); |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
828 } |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
829 } |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
830 |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
831 guint8 qq_proc_login_cmds(PurpleConnection *gc, guint16 cmd, guint16 seq, |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
832 guint8 *rcved, gint rcved_len, gint update_class, guint32 ship32) |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
833 { |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
834 qq_data *qd; |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
835 guint8 *data = NULL; |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
836 gint data_len = 0; |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
837 guint ret_8 = QQ_LOGIN_REPLY_ERR; |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
838 |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
839 g_return_val_if_fail (gc != NULL && gc->proto_data != NULL, QQ_LOGIN_REPLY_ERR); |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
840 qd = (qq_data *) gc->proto_data; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
841 |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
842 g_return_val_if_fail(rcved_len > 0, QQ_LOGIN_REPLY_ERR); |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
843 data = g_newa(guint8, rcved_len); |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
844 |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
845 switch (cmd) { |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
846 case QQ_CMD_TOKEN: |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
847 if (qq_process_token(gc, rcved, rcved_len) == QQ_LOGIN_REPLY_OK) { |
24071
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24070
diff
changeset
|
848 if (qd->client_version >= 2007) { |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
849 qq_request_token_ex(gc); |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
850 } else { |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
851 qq_request_login(gc); |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
852 } |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
853 return QQ_LOGIN_REPLY_OK; |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
854 } |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
855 return QQ_LOGIN_REPLY_ERR; |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
856 case QQ_CMD_GET_SERVER: |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
857 case QQ_CMD_TOKEN_EX: |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
858 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:
24065
diff
changeset
|
859 break; |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
860 case QQ_CMD_CHECK_PWD: |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
861 /* 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:
24065
diff
changeset
|
862 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:
24065
diff
changeset
|
863 if (data_len >= 0) { |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
864 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:
24065
diff
changeset
|
865 } else { |
24069
dc112387190f
2008.09.29 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24068
diff
changeset
|
866 data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.pwd_twice_md5); |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
867 if (data_len >= 0) { |
24069
dc112387190f
2008.09.29 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24068
diff
changeset
|
868 purple_debug_warning("QQ", "Decrypt login packet by pwd_twice_md5, %d bytes\n", data_len); |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
869 } |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
870 } |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
871 break; |
24068
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24066
diff
changeset
|
872 case QQ_CMD_LOGIN: |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
873 default: |
24071
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24070
diff
changeset
|
874 if (qd->client_version >= 2007) { |
24069
dc112387190f
2008.09.29 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24068
diff
changeset
|
875 data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.pwd_twice_md5); |
24068
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24066
diff
changeset
|
876 if (data_len >= 0) { |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
877 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:
24077
diff
changeset
|
878 } else { |
24068
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24066
diff
changeset
|
879 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:
24066
diff
changeset
|
880 if (data_len >= 0) { |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
881 purple_debug_warning("QQ", "Decrypt login packet by login_key\n"); |
24068
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24066
diff
changeset
|
882 } |
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24066
diff
changeset
|
883 } |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
884 } else { |
24068
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24066
diff
changeset
|
885 /* 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:
24066
diff
changeset
|
886 data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.random_key); |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
887 if (data_len >= 0) { |
24068
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24066
diff
changeset
|
888 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:
24066
diff
changeset
|
889 } else { |
24069
dc112387190f
2008.09.29 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24068
diff
changeset
|
890 data_len = qq_decrypt(data, rcved, rcved_len, qd->ld.pwd_twice_md5); |
24068
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24066
diff
changeset
|
891 if (data_len >= 0) { |
24069
dc112387190f
2008.09.29 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24068
diff
changeset
|
892 purple_debug_warning("QQ", "Decrypt login packet by pwd_twice_md5\n"); |
24068
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24066
diff
changeset
|
893 } |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
894 } |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
895 } |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
896 break; |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
897 } |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
898 |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
899 if (data_len < 0) { |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
900 purple_debug_warning("QQ", |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
901 "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:
24048
diff
changeset
|
902 seq, cmd, qq_get_cmd_desc(cmd), rcved_len); |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
903 qq_show_packet("Can not decrypted", rcved, rcved_len); |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
904 purple_connection_error_reason(gc, |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
905 PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
906 _("Can not decrypt login reply")); |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
907 return QQ_LOGIN_REPLY_ERR; |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
908 } |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
909 |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
910 switch (cmd) { |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
911 case QQ_CMD_GET_SERVER: |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
912 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:
24048
diff
changeset
|
913 if ( ret_8 == QQ_LOGIN_REPLY_OK) { |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
914 qq_request_token(gc); |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
915 } else if ( ret_8 == QQ_LOGIN_REPLY_REDIRECT) { |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
916 return QQ_LOGIN_REPLY_REDIRECT; |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
917 } |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
918 break; |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
919 case QQ_CMD_TOKEN_EX: |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
920 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:
24048
diff
changeset
|
921 if (ret_8 == QQ_LOGIN_REPLY_OK) { |
24070
832178d951ca
2008.09.30 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24069
diff
changeset
|
922 qq_request_check_pwd(gc); |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
923 } 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:
24048
diff
changeset
|
924 qq_request_token_ex_next(gc); |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
925 } else if (ret_8 == QQ_LOGIN_REPLY_CAPTCHA_DLG) { |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
926 qq_captcha_input_dialog(gc, &(qd->captcha)); |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
927 g_free(qd->captcha.token); |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
928 g_free(qd->captcha.data); |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
929 memset(&qd->captcha, 0, sizeof(qd->captcha)); |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
930 } |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
931 break; |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
932 case QQ_CMD_CHECK_PWD: |
24070
832178d951ca
2008.09.30 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24069
diff
changeset
|
933 ret_8 = qq_process_check_pwd(gc, data, data_len); |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
934 if (ret_8 != QQ_LOGIN_REPLY_OK) { |
24077
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
935 return ret_8; |
24066
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
936 } |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
937 if (qd->client_version == 2008) { |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
938 qq_request_login_2008(gc); |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
939 } else { |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
940 qq_request_login_2007(gc); |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
941 } |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24065
diff
changeset
|
942 break; |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
943 case QQ_CMD_LOGIN: |
24068
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24066
diff
changeset
|
944 if (qd->client_version == 2008) { |
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24066
diff
changeset
|
945 ret_8 = qq_process_login_2008(gc, data, data_len); |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
946 if ( ret_8 == QQ_LOGIN_REPLY_REDIRECT) { |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
947 qq_request_get_server(gc); |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
948 return QQ_LOGIN_REPLY_OK; |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
949 } |
24068
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24066
diff
changeset
|
950 } else if (qd->client_version == 2007) { |
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24066
diff
changeset
|
951 ret_8 = qq_process_login_2007(gc, data, data_len); |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
952 if ( ret_8 == QQ_LOGIN_REPLY_REDIRECT) { |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
953 qq_request_get_server(gc); |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
954 return QQ_LOGIN_REPLY_OK; |
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
955 } |
24068
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24066
diff
changeset
|
956 } else { |
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24066
diff
changeset
|
957 ret_8 = qq_process_login(gc, data, data_len); |
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24066
diff
changeset
|
958 } |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
959 if (ret_8 != QQ_LOGIN_REPLY_OK) { |
24077
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
960 return ret_8; |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
961 } |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
962 |
24374
75545fdf8944
String changes. I'm kind of blindly making changes to the qq strings
Mark Doliner <mark@kingant.net>
parents:
24095
diff
changeset
|
963 purple_connection_update_progress(gc, _("Logging in"), QQ_CONNECT_STEPS - 1, QQ_CONNECT_STEPS); |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
964 purple_debug_info("QQ", "Login repliess OK; everything is fine\n"); |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
965 purple_connection_set_state(gc, PURPLE_CONNECTED); |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
966 qd->is_login = TRUE; /* must be defined after sev_finish_login */ |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
967 |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
968 /* now initiate QQ Qun, do it first as it may take longer to finish */ |
24088
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24086
diff
changeset
|
969 qq_room_data_initial(gc); |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
970 |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
971 /* is_login, but we have packets before login */ |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
972 qq_trans_process_remained(gc); |
23755
23cec4360d4a
applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23754
diff
changeset
|
973 |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
974 qq_update_all(gc, 0); |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
975 break; |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
976 default: |
24077
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
977 process_unknow_cmd(gc, _("Unknow LOGIN CMD"), data, data_len, cmd, seq); |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
978 return QQ_LOGIN_REPLY_ERR; |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
979 } |
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
980 return QQ_LOGIN_REPLY_OK; |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
981 } |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
982 |
24065
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24048
diff
changeset
|
983 void qq_proc_client_cmds(PurpleConnection *gc, guint16 cmd, guint16 seq, |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
984 guint8 *rcved, gint rcved_len, gint update_class, guint32 ship32) |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
985 { |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
986 qq_data *qd; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
987 |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
988 guint8 *data; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
989 gint data_len; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
990 |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
991 guint8 ret_8 = 0; |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
992 guint16 ret_16 = 0; |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
993 guint32 ret_32 = 0; |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
994 gboolean is_unknow = FALSE; |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
995 |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
996 g_return_if_fail(rcved_len > 0); |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
997 |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
998 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:
23686
diff
changeset
|
999 qd = (qq_data *) gc->proto_data; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
1000 |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
1001 data = g_newa(guint8, rcved_len); |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1002 data_len = qq_decrypt(data, rcved, rcved_len, qd->session_key); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1003 if (data_len < 0) { |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1004 purple_debug_warning("QQ", |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1005 "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:
23753
diff
changeset
|
1006 seq, cmd, qq_get_cmd_desc(cmd), rcved_len); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1007 qq_show_packet("Can not decrypted", rcved, rcved_len); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1008 return; |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
1009 } |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1010 |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
1011 if (data_len <= 0) { |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1012 purple_debug_warning("QQ", |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1013 "Reply decrypted is empty, [%05d], 0x%04X %s, len %d\n", |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
1014 seq, cmd, qq_get_cmd_desc(cmd), rcved_len); |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
1015 return; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
1016 } |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
1017 |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1018 switch (cmd) { |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1019 case QQ_CMD_UPDATE_INFO: |
24086
3c52353b83ae
2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24085
diff
changeset
|
1020 qq_process_change_info(gc, data, data_len); |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1021 break; |
24094
7f5433ffbf8d
2008.10.22 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24093
diff
changeset
|
1022 case QQ_CMD_ADD_BUDDY_NO_AUTH: |
7f5433ffbf8d
2008.10.22 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24093
diff
changeset
|
1023 qq_process_add_buddy_no_auth(gc, data, data_len, ship32); |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1024 break; |
24094
7f5433ffbf8d
2008.10.22 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24093
diff
changeset
|
1025 case QQ_CMD_REMOVE_BUDDY: |
7f5433ffbf8d
2008.10.22 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24093
diff
changeset
|
1026 qq_process_remove_buddy(gc, data, data_len, ship32); |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1027 break; |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
1028 case QQ_CMD_REMOVE_ME: |
24091
d35672443baa
2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24090
diff
changeset
|
1029 qq_process_buddy_remove_me(gc, data, data_len, ship32); |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1030 break; |
24094
7f5433ffbf8d
2008.10.22 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24093
diff
changeset
|
1031 case QQ_CMD_ADD_BUDDY_AUTH: |
7f5433ffbf8d
2008.10.22 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24093
diff
changeset
|
1032 qq_process_add_buddy_auth(data, data_len, gc); |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1033 break; |
23755
23cec4360d4a
applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23754
diff
changeset
|
1034 case QQ_CMD_GET_BUDDY_INFO: |
24048
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24046
diff
changeset
|
1035 qq_process_get_buddy_info(data, data_len, ship32, gc); |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1036 break; |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1037 case QQ_CMD_CHANGE_STATUS: |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
1038 qq_process_change_status(data, data_len, gc); |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1039 break; |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1040 case QQ_CMD_SEND_IM: |
24077
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
1041 do_im_ack(data, data_len, gc); |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1042 break; |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1043 case QQ_CMD_KEEP_ALIVE: |
24071
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24070
diff
changeset
|
1044 if (qd->client_version >= 2008) { |
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24070
diff
changeset
|
1045 qq_process_keep_alive_2008(data, data_len, gc); |
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24070
diff
changeset
|
1046 } else if (qd->client_version >= 2007) { |
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24070
diff
changeset
|
1047 qq_process_keep_alive_2007(data, data_len, gc); |
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24070
diff
changeset
|
1048 } else { |
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24070
diff
changeset
|
1049 qq_process_keep_alive(data, data_len, gc); |
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24070
diff
changeset
|
1050 } |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1051 break; |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1052 case QQ_CMD_GET_BUDDIES_ONLINE: |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
1053 ret_8 = qq_process_get_buddies_online(data, data_len, gc); |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1054 if (ret_8 > 0 && ret_8 < 0xff) { |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1055 purple_debug_info("QQ", "Requesting for more online buddies\n"); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1056 qq_request_get_buddies_online(gc, ret_8, update_class); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1057 return; |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1058 } |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1059 purple_debug_info("QQ", "All online buddies received\n"); |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
1060 qq_update_buddyies_status(gc); |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1061 break; |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1062 case QQ_CMD_GET_LEVEL: |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1063 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
|
1064 break; |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1065 case QQ_CMD_GET_BUDDIES_LIST: |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
1066 ret_16 = qq_process_get_buddies(data, data_len, gc); |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1067 if (ret_16 > 0 && ret_16 < 0xffff) { |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1068 purple_debug_info("QQ", "Requesting for more buddies\n"); |
24079
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24077
diff
changeset
|
1069 qq_request_get_buddies(gc, ret_16, update_class); |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1070 return; |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1071 } |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1072 purple_debug_info("QQ", "All buddies received. Requesting buddies' levels\n"); |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1073 break; |
23753
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
1074 case QQ_CMD_GET_BUDDIES_AND_ROOMS: |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23686
diff
changeset
|
1075 ret_32 = qq_process_get_buddies_and_rooms(data, data_len, gc); |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1076 if (ret_32 > 0 && ret_32 < 0xffffffff) { |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1077 purple_debug_info("QQ", "Requesting for more buddies and groups\n"); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1078 qq_request_get_buddies_and_rooms(gc, ret_32, update_class); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1079 return; |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1080 } |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1081 purple_debug_info("QQ", "All buddies and groups received\n"); |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1082 break; |
24095
2a19984c0005
2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24094
diff
changeset
|
1083 case QQ_CMD_AUTH_CODE: |
2a19984c0005
2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24094
diff
changeset
|
1084 qq_process_auth_code(gc, data, data_len, ship32); |
2a19984c0005
2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24094
diff
changeset
|
1085 break; |
2a19984c0005
2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24094
diff
changeset
|
1086 case QQ_CMD_BUDDY_QUESTION: |
2a19984c0005
2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24094
diff
changeset
|
1087 qq_process_question(gc, data, data_len, ship32); |
24092
7c0a56c5fea0
2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24091
diff
changeset
|
1088 break; |
24094
7f5433ffbf8d
2008.10.22 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24093
diff
changeset
|
1089 case QQ_CMD_ADD_BUDDY_NO_AUTH_EX: |
7f5433ffbf8d
2008.10.22 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24093
diff
changeset
|
1090 qq_process_add_buddy_no_auth_ex(gc, data, data_len, ship32); |
24093
f4f29fac96c6
2008.10.20 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24092
diff
changeset
|
1091 break; |
24095
2a19984c0005
2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24094
diff
changeset
|
1092 case QQ_CMD_ADD_BUDDY_AUTH_EX: |
2a19984c0005
2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24094
diff
changeset
|
1093 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:
24094
diff
changeset
|
1094 break; |
24093
f4f29fac96c6
2008.10.20 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24092
diff
changeset
|
1095 case QQ_CMD_BUDDY_CHECK_CODE: |
24094
7f5433ffbf8d
2008.10.22 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24093
diff
changeset
|
1096 qq_process_buddy_check_code(gc, data, data_len); |
24093
f4f29fac96c6
2008.10.20 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24092
diff
changeset
|
1097 break; |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1098 default: |
24077
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24076
diff
changeset
|
1099 process_unknow_cmd(gc, _("Unknow CLIENT CMD"), data, data_len, cmd, seq); |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1100 is_unknow = TRUE; |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1101 break; |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1102 } |
23754
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1103 if (is_unknow) |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1104 return; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1105 |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1106 if (update_class == QQ_CMD_CLASS_NONE) |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1107 return; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1108 |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1109 purple_debug_info("QQ", "Update class %d\n", update_class); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1110 if (update_class == QQ_CMD_CLASS_UPDATE_ALL) { |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1111 qq_update_all(gc, cmd); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1112 return; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1113 } |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1114 if (update_class == QQ_CMD_CLASS_UPDATE_ONLINE) { |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1115 qq_update_online(gc, cmd); |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1116 return; |
967344bc404d
applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23753
diff
changeset
|
1117 } |
23685
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1118 } |
58bb7fc244e4
2008.08.03 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
diff
changeset
|
1119 |