Mercurial > pidgin
annotate libpurple/protocols/qq/buddy_list.c @ 30488:c8a5c09df242
Auto-parent the Plugins dialog.
Fixes #12404.
committer: Elliott Sales de Andrade <qulogic@pidgin.im>
author | Gabriel Schulhof <nix@go-nix.ca> |
---|---|
date | Fri, 03 Sep 2010 20:56:29 +0000 |
parents | 351d07aefb09 |
children | 4deef745de87 |
rev | line source |
---|---|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2 * @file buddy_list.c |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
15822 | 4 * purple |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * |
15822 | 6 * Purple is the legal property of its developers, whose names are too numerous |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * source distribution. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * along with this program; if not, write to the Free Software |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18210
diff
changeset
|
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
24 |
18210
b8572b937c09
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents:
16208
diff
changeset
|
25 #include "qq.h" |
b8572b937c09
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents:
16208
diff
changeset
|
26 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #include "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include "utils.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 #include "packet_parse.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "buddy_info.h" |
25515
7f903e67a995
2009.02.09 - Chengming Wang <tiger2007532246(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24631
diff
changeset
|
32 #include "buddy_memo.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include "buddy_list.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "buddy_opt.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include "char_conv.h" |
24134
bdfcfd71449c
patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24117
diff
changeset
|
36 #include "qq_define.h" |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
37 #include "qq_base.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 #include "group.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 #include "group_internal.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 #include "group_info.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 |
23050 | 42 #include "qq_network.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 #define QQ_GET_ONLINE_BUDDY_02 0x02 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 #define QQ_GET_ONLINE_BUDDY_03 0x03 /* unknown function */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
47 typedef struct _qq_buddy_online { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 guint16 unknown1; |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
49 guint8 ext_flag; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 guint8 comm_flag; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 guint16 unknown2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 guint8 ending; /* 0x00 */ |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
53 } qq_buddy_online; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 /* get a list of online_buddies */ |
25518
7da3cf2530b7
2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
25517
diff
changeset
|
56 void qq_request_get_buddies_online(PurpleConnection *gc, guint8 position, guint32 update_class) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 { |
23048 | 58 guint8 *raw_data; |
59 gint bytes = 0; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 raw_data = g_newa(guint8, 5); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 /* 000-000 get online friends cmd |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
64 * only 0x02 and 0x03 returns info from server, other valuse all return 0xff |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 * I can also only send the first byte (0x02, or 0x03) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 * and the result is the same */ |
23048 | 67 bytes += qq_put8(raw_data + bytes, QQ_GET_ONLINE_BUDDY_02); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
68 /* 001-001 seems it supports 255 online buddies at most */ |
23048 | 69 bytes += qq_put8(raw_data + bytes, position); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
70 /* 002-002 */ |
23048 | 71 bytes += qq_put8(raw_data + bytes, 0x00); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 /* 003-004 */ |
23048 | 73 bytes += qq_put16(raw_data + bytes, 0x0000); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
74 |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
75 qq_send_cmd_mess(gc, QQ_CMD_GET_BUDDIES_ONLINE, raw_data, 5, update_class, 0); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
76 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
78 /* position starts with 0x0000, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 * server may return a position tag if list is too long for one packet */ |
25518
7da3cf2530b7
2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
25517
diff
changeset
|
80 void qq_request_get_buddies(PurpleConnection *gc, guint16 position, guint32 update_class) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 { |
24140
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24137
diff
changeset
|
82 qq_data *qd; |
23048 | 83 guint8 raw_data[16] = {0}; |
84 gint bytes = 0; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 |
24140
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24137
diff
changeset
|
86 qd = (qq_data *) gc->proto_data; |
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24137
diff
changeset
|
87 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 /* 000-001 starting position, can manually specify */ |
23048 | 89 bytes += qq_put16(raw_data + bytes, position); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 /* before Mar 18, 2004, any value can work, and we sent 00 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 * I do not know what data QQ server is expecting, as QQ2003iii 0304 itself |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 * even can sending packets 00 and get no response. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 * Now I tested that 00,00,00,00,00,01 work perfectly |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 * March 22, found the 00,00,00 starts to work as well */ |
23048 | 95 bytes += qq_put8(raw_data + bytes, 0x00); |
24140
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24137
diff
changeset
|
96 if (qd->client_version >= 2007) { |
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24137
diff
changeset
|
97 bytes += qq_put16(raw_data + bytes, 0x0000); |
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24137
diff
changeset
|
98 } |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
99 |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
100 qq_send_cmd_mess(gc, QQ_CMD_GET_BUDDIES_LIST, raw_data, bytes, update_class, 0); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
102 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
103 /* get all list, buddies & Quns with groupsid support */ |
25518
7da3cf2530b7
2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
25517
diff
changeset
|
104 void qq_request_get_buddies_and_rooms(PurpleConnection *gc, guint32 position, guint32 update_class) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 { |
23048 | 106 guint8 raw_data[16] = {0}; |
107 gint bytes = 0; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 /* 0x01 download, 0x02, upload */ |
23048 | 110 bytes += qq_put8(raw_data + bytes, 0x01); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 /* unknown 0x02 */ |
23048 | 112 bytes += qq_put8(raw_data + bytes, 0x02); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 /* unknown 00 00 00 00 */ |
23048 | 114 bytes += qq_put32(raw_data + bytes, 0x00000000); |
115 bytes += qq_put32(raw_data + bytes, position); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
117 qq_send_cmd_mess(gc, QQ_CMD_GET_BUDDIES_AND_ROOMS, raw_data, bytes, update_class, 0); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
120 /* parse the data into qq_buddy_status */ |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
121 static gint get_buddy_status(qq_buddy_status *bs, guint8 *data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 { |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
123 gint bytes = 0; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
125 g_return_val_if_fail(data != NULL && bs != NULL, -1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
127 /* 000-003: uid */ |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
128 bytes += qq_get32(&bs->uid, data + bytes); |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
129 /* 004-004: 0x01 */ |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
130 bytes += qq_get8(&bs->unknown1, data + bytes); |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
131 /* this is no longer the IP, it seems QQ (as of 2006) no longer sends |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
132 * the buddy's IP in this packet. all 0s */ |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
133 /* 005-008: ip */ |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
134 bytes += qq_getIP(&bs->ip, data + bytes); |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
135 /* port info is no longer here either */ |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
136 /* 009-010: port */ |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
137 bytes += qq_get16(&bs->port, data + bytes); |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
138 /* 011-011: 0x00 */ |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
139 bytes += qq_get8(&bs->unknown2, data + bytes); |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
140 /* 012-012: status */ |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
141 bytes += qq_get8(&bs->status, data + bytes); |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
142 /* 013-014: client tag */ |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
143 bytes += qq_get16(&bs->unknown3, data + bytes); |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
144 /* 015-030: unknown key */ |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
145 bytes += qq_getdata(&(bs->unknown_key[0]), QQ_KEY_LENGTH, data + bytes); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 |
24631 | 147 purple_debug_info("QQ", "Status:%d, uid: %u, ip: %s:%d, U: %d - %d - %04X\n", |
148 bs->status, bs->uid, inet_ntoa(bs->ip), bs->port, | |
149 bs->unknown1, bs->unknown2, bs->unknown3); | |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
150 |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
151 return bytes; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
154 /* process the reply packet for get_buddies_online packet */ |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
155 guint8 qq_process_get_buddies_online(guint8 *data, gint data_len, PurpleConnection *gc) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 qq_data *qd; |
24142
df699d739b8f
2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24140
diff
changeset
|
158 gint bytes, bytes_start; |
23052
ebad75b719f5
Sun Jun 29 22:00:12 CST 2008 csyfek@gmail.com
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23051
diff
changeset
|
159 gint count; |
23695
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
160 guint8 position; |
24608
b22f6fb98cca
Change QQ number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24160
diff
changeset
|
161 gchar *who; |
b22f6fb98cca
Change QQ number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24160
diff
changeset
|
162 PurpleBuddy *buddy; |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
163 qq_buddy_data *bd; |
24142
df699d739b8f
2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24140
diff
changeset
|
164 int entry_len = 38; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
166 qq_buddy_status bs; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
167 struct { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
168 guint16 unknown1; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
169 guint8 ext_flag; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
170 guint8 comm_flag; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
171 guint16 unknown2; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
172 guint8 ending; /* 0x00 */ |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
173 } packet; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
174 |
23695
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
175 g_return_val_if_fail(data != NULL && data_len != 0, -1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
177 qd = (qq_data *) gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
178 |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
179 /* qq_show_packet("Get buddies online reply packet", data, len); */ |
24142
df699d739b8f
2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24140
diff
changeset
|
180 if (qd->client_version >= 2007) entry_len += 4; |
23048 | 181 |
182 bytes = 0; | |
183 bytes += qq_get8(&position, data + bytes); | |
184 | |
23052
ebad75b719f5
Sun Jun 29 22:00:12 CST 2008 csyfek@gmail.com
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23051
diff
changeset
|
185 count = 0; |
23695
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
186 while (bytes < data_len) { |
24142
df699d739b8f
2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24140
diff
changeset
|
187 if (data_len - bytes < entry_len) { |
24140
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24137
diff
changeset
|
188 purple_debug_error("QQ", "[buddies online] only %d, need %d\n", |
24142
df699d739b8f
2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24140
diff
changeset
|
189 (data_len - bytes), entry_len); |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
190 break; |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
191 } |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
192 memset(&bs, 0 ,sizeof(bs)); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
193 memset(&packet, 0 ,sizeof(packet)); |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
194 |
23048 | 195 /* set flag */ |
24142
df699d739b8f
2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24140
diff
changeset
|
196 bytes_start = bytes; |
23048 | 197 /* based on one online buddy entry */ |
198 /* 000-030 qq_buddy_status */ | |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
199 bytes += get_buddy_status(&bs, data + bytes); |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
200 /* 031-032: */ |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
201 bytes += qq_get16(&packet.unknown1, data + bytes); |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
202 /* 033-033: ext_flag */ |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
203 bytes += qq_get8(&packet.ext_flag, data + bytes); |
23048 | 204 /* 034-034: comm_flag */ |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
205 bytes += qq_get8(&packet.comm_flag, data + bytes); |
23048 | 206 /* 035-036: */ |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
207 bytes += qq_get16(&packet.unknown2, data + bytes); |
23048 | 208 /* 037-037: */ |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
209 bytes += qq_get8(&packet.ending, data + bytes); /* 0x00 */ |
24142
df699d739b8f
2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24140
diff
changeset
|
210 /* skip 4 bytes in qq2007 */ |
df699d739b8f
2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24140
diff
changeset
|
211 if (qd->client_version >= 2007) bytes += 4; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
212 |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
213 if (bs.uid == 0 || (bytes - bytes_start) != entry_len) { |
28212
73a30365c293
Add newline at end of debug messages.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26233
diff
changeset
|
214 purple_debug_error("QQ", "uid=0 or entry complete len(%d) != %d\n", |
24142
df699d739b8f
2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24140
diff
changeset
|
215 (bytes - bytes_start), entry_len); |
23048 | 216 continue; |
217 } /* check if it is a valid entry */ | |
218 | |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
219 if (bs.uid == qd->uid) { |
24608
b22f6fb98cca
Change QQ number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24160
diff
changeset
|
220 purple_debug_warning("QQ", "I am in online list %u\n", bs.uid); |
23695
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
221 } |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
222 |
23048 | 223 /* update buddy information */ |
24608
b22f6fb98cca
Change QQ number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24160
diff
changeset
|
224 who = uid_to_purple_name(bs.uid); |
b22f6fb98cca
Change QQ number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24160
diff
changeset
|
225 buddy = purple_find_buddy(gc->account, who); |
b22f6fb98cca
Change QQ number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24160
diff
changeset
|
226 g_free(who); |
b22f6fb98cca
Change QQ number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24160
diff
changeset
|
227 if (buddy == NULL) { |
b22f6fb98cca
Change QQ number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24160
diff
changeset
|
228 /* create no-auth buddy */ |
b22f6fb98cca
Change QQ number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24160
diff
changeset
|
229 buddy = qq_buddy_new(gc, bs.uid); |
b22f6fb98cca
Change QQ number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24160
diff
changeset
|
230 } |
25906
716b14deee97
a few struct hiding clean ups
Gary Kramlich <grim@reaperworld.com>
parents:
25871
diff
changeset
|
231 bd = (buddy == NULL) ? NULL : (qq_buddy_data *)purple_buddy_get_protocol_data(buddy); |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
232 if (bd == NULL) { |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
233 purple_debug_error("QQ", |
24608
b22f6fb98cca
Change QQ number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24160
diff
changeset
|
234 "Got an online buddy %u, but not in my buddy list\n", bs.uid); |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
235 continue; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 } |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
237 /* |
24135
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
238 if(0 != fe->s->client_tag) |
dbc7a9742f8d
2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24134
diff
changeset
|
239 q_bud->client_tag = fe->s->client_tag; |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
240 */ |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24156
diff
changeset
|
241 if (bd->status != bs.status || bd->comm_flag != packet.comm_flag) { |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24156
diff
changeset
|
242 bd->status = bs.status; |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24156
diff
changeset
|
243 bd->comm_flag = packet.comm_flag; |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24156
diff
changeset
|
244 qq_update_buddy_status(gc, bd->uid, bd->status, bd->comm_flag); |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24156
diff
changeset
|
245 } |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
246 bd->ip.s_addr = bs.ip.s_addr; |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
247 bd->port = bs.port; |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
248 bd->ext_flag = packet.ext_flag; |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
249 bd->last_update = time(NULL); |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
250 count++; |
23048 | 251 } |
252 | |
23695
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
253 if(bytes > data_len) { |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
254 purple_debug_error("QQ", |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
255 "qq_process_get_buddies_online: Dangerous error! maybe protocol changed, notify developers!\n"); |
23048 | 256 } |
257 | |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
258 purple_debug_info("QQ", "Received %d online buddies, nextposition=%u\n", |
24156
147f1b17b6ce
2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24154
diff
changeset
|
259 count, (guint) position); |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
260 return position; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
261 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
262 |
23048 | 263 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
264 /* process reply for get_buddies_list */ |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
265 guint16 qq_process_get_buddies(guint8 *data, gint data_len, PurpleConnection *gc) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
266 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
267 qq_data *qd; |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
268 qq_buddy_data bd; |
23695
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
269 gint bytes_expected, count; |
23048 | 270 gint bytes, buddy_bytes; |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
271 gint nickname_len; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 guint16 position, unknown; |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
273 PurpleBuddy *buddy; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 |
23695
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
275 g_return_val_if_fail(data != NULL && data_len != 0, -1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
276 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
277 qd = (qq_data *) gc->proto_data; |
23048 | 278 |
23695
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
279 if (data_len <= 2) { |
28212
73a30365c293
Add newline at end of debug messages.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26233
diff
changeset
|
280 purple_debug_error("QQ", "empty buddies list\n"); |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
281 return -1; |
23048 | 282 } |
23695
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
283 /* qq_show_packet("QQ get buddies list", data, data_len); */ |
23048 | 284 bytes = 0; |
285 bytes += qq_get16(&position, data + bytes); | |
286 /* the following data is buddy list in this packet */ | |
23052
ebad75b719f5
Sun Jun 29 22:00:12 CST 2008 csyfek@gmail.com
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23051
diff
changeset
|
287 count = 0; |
23695
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
288 while (bytes < data_len) { |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
289 memset(&bd, 0, sizeof(bd)); |
23048 | 290 /* set flag */ |
291 buddy_bytes = bytes; | |
292 /* 000-003: uid */ | |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
293 bytes += qq_get32(&bd.uid, data + bytes); |
23048 | 294 /* 004-005: icon index (1-255) */ |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
295 bytes += qq_get16(&bd.face, data + bytes); |
23048 | 296 /* 006-006: age */ |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
297 bytes += qq_get8(&bd.age, data + bytes); |
23048 | 298 /* 007-007: gender */ |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
299 bytes += qq_get8(&bd.gender, data + bytes); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
301 nickname_len = qq_get_vstr(&bd.nickname, QQ_CHARSET_DEFAULT, data + bytes); |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
302 bytes += nickname_len; |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
303 qq_filter_str(bd.nickname); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 |
24140
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24137
diff
changeset
|
305 /* Fixme: merge following as 32bit flag */ |
23048 | 306 bytes += qq_get16(&unknown, data + bytes); |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
307 bytes += qq_get8(&bd.ext_flag, data + bytes); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
308 bytes += qq_get8(&bd.comm_flag, data + bytes); |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
309 |
24140
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24137
diff
changeset
|
310 if (qd->client_version >= 2007) { |
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24137
diff
changeset
|
311 bytes += 4; /* skip 4 bytes */ |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
312 bytes_expected = 16 + nickname_len; |
24140
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24137
diff
changeset
|
313 } else { |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
314 bytes_expected = 12 + nickname_len; |
24140
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24137
diff
changeset
|
315 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
316 |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
317 if (bd.uid == 0 || (bytes - buddy_bytes) != bytes_expected) { |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
318 purple_debug_info("QQ", |
24608
b22f6fb98cca
Change QQ number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24160
diff
changeset
|
319 "Buddy entry, expect %d bytes, read %d bytes\n", |
b22f6fb98cca
Change QQ number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24160
diff
changeset
|
320 bytes_expected, bytes - buddy_bytes); |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
321 g_free(bd.nickname); |
23048 | 322 continue; |
323 } else { | |
23052
ebad75b719f5
Sun Jun 29 22:00:12 CST 2008 csyfek@gmail.com
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23051
diff
changeset
|
324 count++; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 |
23695
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
327 #if 1 |
24117
d57928c9dd8f
2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24115
diff
changeset
|
328 purple_debug_info("QQ", "buddy [%09d]: ext_flag=0x%02x, comm_flag=0x%02x, nick=%s\n", |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
329 bd.uid, bd.ext_flag, bd.comm_flag, bd.nickname); |
23695
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
330 #endif |
23048 | 331 |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
332 buddy = qq_buddy_find_or_new(gc, bd.uid); |
25807
e35115192593
Finished struct hiding in bonjour and qq
Gary Kramlich <grim@reaperworld.com>
parents:
24160
diff
changeset
|
333 if (buddy == NULL || purple_buddy_get_protocol_data(buddy) == NULL) { |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
334 g_free(bd.nickname); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
335 continue; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
336 } |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
337 purple_blist_server_alias_buddy(buddy, bd.nickname); |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
338 bd.last_update = time(NULL); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
339 qq_update_buddy_status(gc, bd.uid, bd.status, bd.comm_flag); |
23048 | 340 |
25807
e35115192593
Finished struct hiding in bonjour and qq
Gary Kramlich <grim@reaperworld.com>
parents:
24160
diff
changeset
|
341 g_memmove(purple_buddy_get_protocol_data(buddy), &bd, sizeof(qq_buddy_data)); |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
342 /* nickname has been copy to buddy_data do not free |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
343 g_free(bd.nickname); |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
344 */ |
25519
d673ccc44a6e
2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
25518
diff
changeset
|
345 /*qq_request_buddy_memo(gc, ((qq_buddy_data*)buddy->proto_data)->uid, 0, QQ_BUDDY_MEMO_GET);*/ |
d673ccc44a6e
2009.02.24 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
25518
diff
changeset
|
346 qq_request_buddy_memo(gc, bd.uid, bd.uid, QQ_BUDDY_MEMO_GET); |
23048 | 347 } |
348 | |
23695
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
349 if(bytes > data_len) { |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
350 purple_debug_error("QQ", |
28212
73a30365c293
Add newline at end of debug messages.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26233
diff
changeset
|
351 "qq_process_get_buddies: Dangerous error! maybe protocol changed, notify developers!\n"); |
23048 | 352 } |
23052
ebad75b719f5
Sun Jun 29 22:00:12 CST 2008 csyfek@gmail.com
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23051
diff
changeset
|
353 |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
354 purple_debug_info("QQ", "Received %d buddies, nextposition=%u\n", |
23052
ebad75b719f5
Sun Jun 29 22:00:12 CST 2008 csyfek@gmail.com
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23051
diff
changeset
|
355 count, (guint) position); |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
356 return position; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
357 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
358 |
23695
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
359 guint32 qq_process_get_buddies_and_rooms(guint8 *data, gint data_len, PurpleConnection *gc) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
360 { |
23695
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
361 gint i, j; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
362 gint bytes; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
363 guint8 sub_cmd, reply_code; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
364 guint32 unknown, position; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
365 guint32 uid; |
24156
147f1b17b6ce
2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24154
diff
changeset
|
366 guint8 type; |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24156
diff
changeset
|
367 qq_room_data *rmd; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
368 |
23695
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
369 g_return_val_if_fail(data != NULL && data_len != 0, -1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
370 |
23695
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
371 bytes = 0; |
23048 | 372 bytes += qq_get8(&sub_cmd, data + bytes); |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
373 g_return_val_if_fail(sub_cmd == 0x01, -1); |
23048 | 374 |
375 bytes += qq_get8(&reply_code, data + bytes); | |
376 if(0 != reply_code) { | |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
377 purple_debug_warning("QQ", "qq_process_get_buddies_and_rooms, %d\n", reply_code); |
23048 | 378 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
379 |
23048 | 380 bytes += qq_get32(&unknown, data + bytes); |
381 bytes += qq_get32(&position, data + bytes); | |
382 /* the following data is all list in this packet */ | |
383 i = 0; | |
384 j = 0; | |
23695
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
385 while (bytes < data_len) { |
23048 | 386 /* 00-03: uid */ |
387 bytes += qq_get32(&uid, data + bytes); | |
388 /* 04: type 0x1:buddy 0x4:Qun */ | |
389 bytes += qq_get8(&type, data + bytes); | |
24156
147f1b17b6ce
2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24154
diff
changeset
|
390 /* 05: skip unknow 0x00 */ |
147f1b17b6ce
2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24154
diff
changeset
|
391 bytes += 1; |
23048 | 392 if (uid == 0 || (type != 0x1 && type != 0x4)) { |
28212
73a30365c293
Add newline at end of debug messages.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26233
diff
changeset
|
393 purple_debug_info("QQ", "Buddy entry, uid=%u, type=%d\n", uid, type); |
23048 | 394 continue; |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
395 } |
23048 | 396 if(0x1 == type) { /* a buddy */ |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
397 /* don't do anything but count - buddies are handled by |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
398 * qq_request_get_buddies */ |
23048 | 399 ++i; |
400 } else { /* a group */ | |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24156
diff
changeset
|
401 rmd = qq_room_data_find(gc, uid); |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24156
diff
changeset
|
402 if(rmd == NULL) { |
28212
73a30365c293
Add newline at end of debug messages.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26233
diff
changeset
|
403 purple_debug_info("QQ", "Unknown room id %u\n", uid); |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24156
diff
changeset
|
404 qq_send_room_cmd_only(gc, QQ_ROOM_CMD_GET_INFO, uid); |
23048 | 405 } else { |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24156
diff
changeset
|
406 rmd->my_role = QQ_ROOM_ROLE_YES; |
23048 | 407 } |
408 ++j; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
409 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
410 } |
23048 | 411 |
23695
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
412 if(bytes > data_len) { |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
413 purple_debug_error("QQ", |
28212
73a30365c293
Add newline at end of debug messages.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26233
diff
changeset
|
414 "qq_process_get_buddies_and_rooms: Dangerous error! maybe protocol changed, notify developers!\n"); |
23048 | 415 } |
416 | |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
417 purple_debug_info("QQ", "Received %d buddies and %d groups, nextposition=%u\n", i, j, (guint) position); |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
418 return position; |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
419 } |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
420 |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
421 #define QQ_MISC_STATUS_HAVING_VIIDEO 0x00000001 |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
422 #define QQ_CHANGE_ONLINE_STATUS_REPLY_OK 0x30 /* ASCII value of "0" */ |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
423 |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
424 /* TODO: figure out what's going on with the IP region. Sometimes I get valid IP addresses, |
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
425 * but the port number's weird, other times I get 0s. I get these simultaneously on the same buddy, |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
426 * using different accounts to get info. */ |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
427 static guint8 get_status_from_purple(PurpleConnection *gc) |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
428 { |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
429 qq_data *qd; |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
430 PurpleAccount *account; |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
431 PurplePresence *presence; |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
432 guint8 ret; |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
433 |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
434 qd = (qq_data *) gc->proto_data; |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
435 account = purple_connection_get_account(gc); |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
436 presence = purple_account_get_presence(account); |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
437 |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
438 if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_INVISIBLE)) { |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
439 ret = QQ_BUDDY_ONLINE_INVISIBLE; |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
440 } else if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_UNAVAILABLE)) |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
441 { |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
442 if (qd->client_version >= 2007) { |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
443 ret = QQ_BUDDY_ONLINE_BUSY; |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
444 } else { |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
445 ret = QQ_BUDDY_ONLINE_INVISIBLE; |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
446 } |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
447 } else if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_AWAY) |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
448 || purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_EXTENDED_AWAY) |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
449 || purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_UNAVAILABLE)) { |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
450 ret = QQ_BUDDY_ONLINE_AWAY; |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
451 } else { |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
452 ret = QQ_BUDDY_ONLINE_NORMAL; |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
453 } |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
454 return ret; |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
455 } |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
456 |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
457 /* send a packet to change my online status */ |
25518
7da3cf2530b7
2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
25517
diff
changeset
|
458 void qq_request_change_status(PurpleConnection *gc, guint32 update_class) |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
459 { |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
460 qq_data *qd; |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
461 guint8 raw_data[16] = {0}; |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
462 gint bytes = 0; |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
463 guint8 away_cmd; |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
464 guint32 misc_status; |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
465 gboolean fake_video; |
23561
bdb38a8bf721
20080717-05-1-fix-keep-alive ccpaging <ecc_hy(at)hotmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23052
diff
changeset
|
466 |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
467 qd = (qq_data *) gc->proto_data; |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
468 if (!qd->is_login) |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
469 return; |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
470 |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
471 away_cmd = get_status_from_purple(gc); |
24146
ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24145
diff
changeset
|
472 |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
473 misc_status = 0x00000000; |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
474 fake_video = purple_prefs_get_bool("/plugins/prpl/qq/show_fake_video"); |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
475 if (fake_video) |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
476 misc_status |= QQ_MISC_STATUS_HAVING_VIIDEO; |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
477 |
24140
619ac2303c46
2009.10.02 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24137
diff
changeset
|
478 if (qd->client_version >= 2007) { |
24137
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24135
diff
changeset
|
479 bytes = 0; |
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24135
diff
changeset
|
480 bytes += qq_put8(raw_data + bytes, away_cmd); |
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24135
diff
changeset
|
481 /* status version */ |
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24135
diff
changeset
|
482 bytes += qq_put16(raw_data + bytes, 0); |
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24135
diff
changeset
|
483 bytes += qq_put16(raw_data + bytes, 0); |
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24135
diff
changeset
|
484 bytes += qq_put32(raw_data + bytes, misc_status); |
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24135
diff
changeset
|
485 /* Fixme: custom status message, now is empty */ |
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24135
diff
changeset
|
486 bytes += qq_put16(raw_data + bytes, 0); |
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24135
diff
changeset
|
487 } else { |
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24135
diff
changeset
|
488 bytes = 0; |
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24135
diff
changeset
|
489 bytes += qq_put8(raw_data + bytes, away_cmd); |
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24135
diff
changeset
|
490 bytes += qq_put32(raw_data + bytes, misc_status); |
87e61a85f5dd
2008.09.28 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24135
diff
changeset
|
491 } |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
492 qq_send_cmd_mess(gc, QQ_CMD_CHANGE_STATUS, raw_data, bytes, update_class, 0); |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
493 } |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
494 |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
495 /* parse the reply packet for change_status */ |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
496 void qq_process_change_status(guint8 *data, gint data_len, PurpleConnection *gc) |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
497 { |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
498 qq_data *qd; |
23695
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
499 gint bytes; |
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
500 guint8 reply; |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
501 qq_buddy_data *bd; |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
502 |
23695
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
503 g_return_if_fail(data != NULL && data_len != 0); |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
504 |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
505 qd = (qq_data *) gc->proto_data; |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
506 |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
507 bytes = 0; |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
508 bytes = qq_get8(&reply, data + bytes); |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
509 if (reply != QQ_CHANGE_ONLINE_STATUS_REPLY_OK) { |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
510 purple_debug_warning("QQ", "Change status fail 0x%02X\n", reply); |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
511 return; |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
512 } |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
513 |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
514 /* purple_debug_info("QQ", "Change status OK\n"); */ |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
515 bd = qq_buddy_data_find(gc, qd->uid); |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
516 if (bd != NULL) { |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
517 bd->status = get_status_from_purple(gc); |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
518 bd->last_update = time(NULL); |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
519 qq_update_buddy_status(gc, bd->uid, bd->status, bd->comm_flag); |
23052
ebad75b719f5
Sun Jun 29 22:00:12 CST 2008 csyfek@gmail.com
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23051
diff
changeset
|
520 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
521 } |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
522 |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
523 /* it is a server message indicating that one of my buddies has changed its status */ |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
524 void qq_process_buddy_change_status(guint8 *data, gint data_len, PurpleConnection *gc) |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
525 { |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
526 qq_data *qd; |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
527 gint bytes; |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
528 guint32 my_uid; |
24608
b22f6fb98cca
Change QQ number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24160
diff
changeset
|
529 gchar *who; |
b22f6fb98cca
Change QQ number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24160
diff
changeset
|
530 PurpleBuddy *buddy; |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
531 qq_buddy_data *bd; |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
532 qq_buddy_status bs; |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
533 |
23695
5f454b975a99
2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23638
diff
changeset
|
534 g_return_if_fail(data != NULL && data_len != 0); |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
535 |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
536 qd = (qq_data *) gc->proto_data; |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
537 |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
538 if (data_len < 35) { |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
539 purple_debug_error("QQ", "[buddy status change] only %d, need 35 bytes\n", data_len); |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
540 return; |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
541 } |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
542 |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
543 memset(&bs, 0, sizeof(bs)); |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
544 bytes = 0; |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
545 /* 000-030: qq_buddy_status */ |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
546 bytes += get_buddy_status(&bs, data + bytes); |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
547 /* 031-034: Unknow, maybe my uid */ |
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
548 /* This has a value of 0 when we've changed our status to |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
549 * QQ_BUDDY_ONLINE_INVISIBLE */ |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
550 bytes += qq_get32(&my_uid, data + bytes); |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
551 |
24608
b22f6fb98cca
Change QQ number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24160
diff
changeset
|
552 /* update buddy information */ |
b22f6fb98cca
Change QQ number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24160
diff
changeset
|
553 who = uid_to_purple_name(bs.uid); |
b22f6fb98cca
Change QQ number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24160
diff
changeset
|
554 buddy = purple_find_buddy(gc->account, who); |
b22f6fb98cca
Change QQ number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24160
diff
changeset
|
555 g_free(who); |
b22f6fb98cca
Change QQ number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24160
diff
changeset
|
556 if (buddy == NULL) { |
b22f6fb98cca
Change QQ number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24160
diff
changeset
|
557 /* create no-auth buddy */ |
b22f6fb98cca
Change QQ number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24160
diff
changeset
|
558 buddy = qq_buddy_new(gc, bs.uid); |
b22f6fb98cca
Change QQ number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24160
diff
changeset
|
559 } |
25906
716b14deee97
a few struct hiding clean ups
Gary Kramlich <grim@reaperworld.com>
parents:
25871
diff
changeset
|
560 bd = (buddy == NULL) ? NULL : (qq_buddy_data *)purple_buddy_get_protocol_data(buddy); |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
561 if (bd == NULL) { |
24631 | 562 purple_debug_warning("QQ", "Got status of no-auth buddy %u\n", bs.uid); |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
563 return; |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
564 } |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
565 |
24115
bcfc98c7a55f
merge of '546bf87105ac5b97c3962c083dfab015d37d9b05'
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24114
diff
changeset
|
566 if(bs.ip.s_addr != 0) { |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
567 bd->ip.s_addr = bs.ip.s_addr; |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
568 bd->port = bs.port; |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
569 } |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24156
diff
changeset
|
570 if (bd->status != bs.status) { |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24156
diff
changeset
|
571 bd->status = bs.status; |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24156
diff
changeset
|
572 qq_update_buddy_status(gc, bd->uid, bd->status, bd->comm_flag); |
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24156
diff
changeset
|
573 } |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
574 bd->last_update = time(NULL); |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
575 |
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
576 if (bd->status == QQ_BUDDY_ONLINE_NORMAL && bd->level <= 0) { |
24142
df699d739b8f
2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24140
diff
changeset
|
577 if (qd->client_version >= 2007) { |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
578 qq_request_get_level_2007(gc, bd->uid); |
24142
df699d739b8f
2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24140
diff
changeset
|
579 } else { |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
580 qq_request_get_level(gc, bd->uid); |
24142
df699d739b8f
2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24140
diff
changeset
|
581 } |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
582 } |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
583 } |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
584 |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
585 /*TODO: maybe this should be qq_update_buddy_status() ?*/ |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
586 void qq_update_buddy_status(PurpleConnection *gc, guint32 uid, guint8 status, guint8 flag) |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
587 { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
588 gchar *who; |
30430
351d07aefb09
Kill off many dead assignments and any useless remaining variables.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28647
diff
changeset
|
589 const gchar *status_id; |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
590 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
591 g_return_if_fail(uid != 0); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
592 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
593 /* purple supports signon and idle time |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
594 * but it is not much use for QQ, I do not use them */ |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
595 /* serv_got_update(gc, name, online, 0, q_bud->signon, q_bud->idle, bud->uc); */ |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
596 switch(status) { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
597 case QQ_BUDDY_OFFLINE: |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
598 status_id = "offline"; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
599 break; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
600 case QQ_BUDDY_ONLINE_NORMAL: |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
601 status_id = "available"; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
602 break; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
603 case QQ_BUDDY_CHANGE_TO_OFFLINE: |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
604 status_id = "offline"; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
605 break; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
606 case QQ_BUDDY_ONLINE_AWAY: |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
607 status_id = "away"; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
608 break; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
609 case QQ_BUDDY_ONLINE_INVISIBLE: |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
610 status_id = "invisible"; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
611 break; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
612 case QQ_BUDDY_ONLINE_BUSY: |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
613 status_id = "busy"; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
614 break; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
615 default: |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
616 status_id = "invisible"; |
24160
d35672443baa
2008.10.10 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24157
diff
changeset
|
617 purple_debug_error("QQ", "unknown status: 0x%X\n", status); |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
618 break; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
619 } |
24608
b22f6fb98cca
Change QQ number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24160
diff
changeset
|
620 |
24631 | 621 purple_debug_info("QQ", "buddy %u status = %s\n", uid, status_id); |
24608
b22f6fb98cca
Change QQ number to unsigned long
Hu Yong <ccpaging@gmail.com>
parents:
24160
diff
changeset
|
622 who = uid_to_purple_name(uid); |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
623 purple_prpl_got_user_status(gc->account, who, status_id, NULL); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
624 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
625 if (flag & QQ_COMM_FLAG_MOBILE && status != QQ_BUDDY_OFFLINE) |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
626 purple_prpl_got_user_status(gc->account, who, "mobile", NULL); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
627 else |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
628 purple_prpl_got_user_status_deactive(gc->account, who, "mobile"); |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
629 |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
630 g_free(who); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
631 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
632 |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
633 /* refresh all buddies online/offline, |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
634 * after receiving reply for get_buddies_online packet */ |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
635 void qq_update_buddyies_status(PurpleConnection *gc) |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
636 { |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
637 qq_data *qd; |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
638 PurpleBuddy *buddy; |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
639 qq_buddy_data *bd; |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
640 GSList *buddies, *it; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
641 time_t tm_limit = time(NULL); |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
642 |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
643 qd = (qq_data *) (gc->proto_data); |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
644 |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
645 tm_limit -= QQ_UPDATE_ONLINE_INTERVAL; |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
646 |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
647 buddies = purple_find_buddies(purple_connection_get_account(gc), NULL); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
648 for (it = buddies; it; it = it->next) { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
649 buddy = it->data; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
650 if (buddy == NULL) continue; |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
651 |
25807
e35115192593
Finished struct hiding in bonjour and qq
Gary Kramlich <grim@reaperworld.com>
parents:
24160
diff
changeset
|
652 bd = purple_buddy_get_protocol_data(buddy); |
e35115192593
Finished struct hiding in bonjour and qq
Gary Kramlich <grim@reaperworld.com>
parents:
24160
diff
changeset
|
653 if (bd == NULL) continue; |
e35115192593
Finished struct hiding in bonjour and qq
Gary Kramlich <grim@reaperworld.com>
parents:
24160
diff
changeset
|
654 |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
655 if (bd->uid == 0) continue; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
656 if (bd->uid == qd->uid) continue; /* my status is always online in my buddy list */ |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
657 if (tm_limit < bd->last_update) continue; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
658 if (bd->status == QQ_BUDDY_ONLINE_INVISIBLE) continue; |
24157
1ee91ff0d5fe
2008.10.09 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24156
diff
changeset
|
659 if (bd->status == QQ_BUDDY_CHANGE_TO_OFFLINE) continue; |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
660 |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
661 bd->status = QQ_BUDDY_CHANGE_TO_OFFLINE; |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
662 bd->last_update = time(NULL); |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
663 qq_update_buddy_status(gc, bd->uid, bd->status, bd->comm_flag); |
23638
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
664 } |
1c50f12b1c52
2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
23561
diff
changeset
|
665 } |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
666 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
667 void qq_buddy_data_free_all(PurpleConnection *gc) |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
668 { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
669 PurpleBuddy *buddy; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
670 GSList *buddies, *it; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
671 gint count = 0; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
672 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
673 buddies = purple_find_buddies(purple_connection_get_account(gc), NULL); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
674 for (it = buddies; it; it = it->next) { |
25807
e35115192593
Finished struct hiding in bonjour and qq
Gary Kramlich <grim@reaperworld.com>
parents:
24160
diff
changeset
|
675 qq_buddy_data *qbd = NULL; |
e35115192593
Finished struct hiding in bonjour and qq
Gary Kramlich <grim@reaperworld.com>
parents:
24160
diff
changeset
|
676 |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
677 buddy = it->data; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
678 if (buddy == NULL) continue; |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
679 |
25807
e35115192593
Finished struct hiding in bonjour and qq
Gary Kramlich <grim@reaperworld.com>
parents:
24160
diff
changeset
|
680 qbd = purple_buddy_get_protocol_data(buddy); |
e35115192593
Finished struct hiding in bonjour and qq
Gary Kramlich <grim@reaperworld.com>
parents:
24160
diff
changeset
|
681 if (qbd == NULL) continue; |
e35115192593
Finished struct hiding in bonjour and qq
Gary Kramlich <grim@reaperworld.com>
parents:
24160
diff
changeset
|
682 |
e35115192593
Finished struct hiding in bonjour and qq
Gary Kramlich <grim@reaperworld.com>
parents:
24160
diff
changeset
|
683 qq_buddy_data_free(qbd); |
e35115192593
Finished struct hiding in bonjour and qq
Gary Kramlich <grim@reaperworld.com>
parents:
24160
diff
changeset
|
684 purple_buddy_set_protocol_data(buddy, NULL); |
24149
818ab62006f5
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24148
diff
changeset
|
685 |
24148
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
686 count++; |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
687 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
688 |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
689 if (count > 0) { |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
690 purple_debug_info("QQ", "%d buddies' data are freed\n", count); |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
691 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
692 } |
1bdf7b602684
2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents:
24146
diff
changeset
|
693 |