annotate libpurple/protocols/qq/buddy_info.c @ 30351:381a63e79b7e

Fix malformed win32 installer strings
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 10 Aug 2010 14:14:10 +0000
parents a5628ba3c83c
children 351d07aefb09 1e5654e2928d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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_info.c
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 *
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15482
diff changeset
4 * purple
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 *
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15482
diff changeset
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: 16817
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 #include "internal.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 #include "debug.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 #include "notify.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 #include "request.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include "utils.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 #include "packet_parse.h"
23638
1c50f12b1c52 2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23561
diff changeset
32 #include "buddy_list.h"
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 #include "buddy_info.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 #include "char_conv.h"
24135
dbc7a9742f8d 2008.09.26 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24134
diff changeset
35 #include "im.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"
23050
51dbe83ebbd3 patch-04-tcp-pending
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23048
diff changeset
38 #include "qq_network.h"
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 #define QQ_HOROSCOPE_SIZE 13
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 static const gchar *horoscope_names[] = {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 "-", N_("Aquarius"), N_("Pisces"), N_("Aries"), N_("Taurus"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 N_("Gemini"), N_("Cancer"), N_("Leo"), N_("Virgo"), N_("Libra"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 N_("Scorpio"), N_("Sagittarius"), N_("Capricorn")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 #define QQ_ZODIAC_SIZE 13
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 static const gchar *zodiac_names[] = {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 "-", N_("Rat"), N_("Ox"), N_("Tiger"), N_("Rabbit"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 N_("Dragon"), N_("Snake"), N_("Horse"), N_("Goat"), N_("Monkey"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 N_("Rooster"), N_("Dog"), N_("Pig")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 #define QQ_BLOOD_SIZE 6
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 static const gchar *blood_types[] = {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56 "-", "A", "B", "O", "AB", N_("Other")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
59 #define QQ_PUBLISH_SIZE 3
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
60 static const gchar *publish_types[] = {
24678
2f84f888d3db fixed some spelling errors in QQ protocol plugin:
Björn Voigt <bjoern@cs.tu-berlin.de>
parents: 24654
diff changeset
61 N_("Visible"), N_("Friend Only"), N_("Private")
15373
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
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
64 #define QQ_GENDER_SIZE 3
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
65 static const gchar *genders[] = {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
66 N_("Private"),
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
67 N_("Male"),
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
68 N_("Female"),
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
69 };
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
70
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
71 static const gchar *genders_zh[] = {
24322
d971d5369b43 2008.10.30 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24165
diff changeset
72 "-",
d971d5369b43 2008.10.30 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24165
diff changeset
73 "\xc4\xd0",
d971d5369b43 2008.10.30 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24165
diff changeset
74 "\xc5\xae",
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
75 };
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
76
24152
d3811bdb6b07 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24150
diff changeset
77 #define QQ_FACES 134
24154
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
78 #define QQ_ICON_PREFIX "qq_"
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
79 #define QQ_ICON_SUFFIX ".png"
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
81 enum {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
82 QQ_INFO_UID = 0, QQ_INFO_NICK, QQ_INFO_COUNTRY, QQ_INFO_PROVINCE, QQ_INFO_ZIPCODE,
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
83 QQ_INFO_ADDR, QQ_INFO_TEL, QQ_INFO_AGE, QQ_INFO_GENDER, QQ_INFO_NAME, QQ_INFO_EMAIL,
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
84 QQ_INFO_PG_SN, QQ_INFO_PG_NUM, QQ_INFO_PG_SP, QQ_INFO_PG_BASE_NUM, QQ_INFO_PG_TYPE,
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
85 QQ_INFO_OCCU, QQ_INFO_HOME_PAGE, QQ_INFO_AUTH_TYPE, QQ_INFO_UNKNOW1, QQ_INFO_UNKNOW2,
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
86 QQ_INFO_FACE, QQ_INFO_MOBILE, QQ_INFO_MOBILE_TYPE, QQ_INFO_INTRO, QQ_INFO_CITY,
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
87 QQ_INFO_UNKNOW3, QQ_INFO_UNKNOW4, QQ_INFO_UNKNOW5,
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
88 QQ_INFO_IS_PUB_MOBILE, QQ_INFO_IS_PUB_CONTACT, QQ_INFO_COLLEGE, QQ_INFO_HOROSCOPE,
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
89 QQ_INFO_ZODIAC, QQ_INFO_BLOOD, QQ_INFO_SHOW, QQ_INFO_UNKNOW6,
24687
d8452c0bec7b Remove the commas at the end of enumerator lists. This resolves warnings
Florian Quèze <florian@instantbird.org>
parents: 24678
diff changeset
90 QQ_INFO_LAST_2007, QQ_INFO_LAST
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
91 };
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
93 enum {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
94 QQ_FIELD_UNUSED = 0, QQ_FIELD_BASE, QQ_FIELD_EXT, QQ_FIELD_CONTACT, QQ_FIELD_ADDR
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
95 };
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
96
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
97 enum {
24687
d8452c0bec7b Remove the commas at the end of enumerator lists. This resolves warnings
Florian Quèze <florian@instantbird.org>
parents: 24678
diff changeset
98 QQ_FIELD_LABEL = 0, QQ_FIELD_STRING, QQ_FIELD_MULTI, QQ_FIELD_BOOL, QQ_FIELD_CHOICE
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
99 };
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
100
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
101 typedef struct {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
102 int iclass;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
103 int type;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
104 char *id;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
105 char *text;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
106 const gchar **choice;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
107 int choice_size;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
108 } QQ_FIELD_INFO;
23048
9a5d140400f1 patch-02-fix-multiarch
SHiNE CsyFeK <csyfek@gmail.com>
parents: 22544
diff changeset
109
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
110 static const QQ_FIELD_INFO field_infos[] = {
25232
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
111 { QQ_FIELD_BASE, QQ_FIELD_STRING, "uid", N_("QQ Number"), NULL, 0 },
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
112 { QQ_FIELD_BASE, QQ_FIELD_STRING, "nick", N_("Nickname"), NULL, 0 },
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
113 { QQ_FIELD_ADDR, QQ_FIELD_STRING, "country", N_("Country/Region"), NULL, 0 },
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
114 { QQ_FIELD_ADDR, QQ_FIELD_STRING, "province", N_("Province/State"), NULL, 0 },
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
115 { QQ_FIELD_ADDR, QQ_FIELD_STRING, "zipcode", N_("Zipcode"), NULL, 0 },
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
116 { QQ_FIELD_ADDR, QQ_FIELD_STRING, "address", N_("Address"), NULL, 0 },
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
117 { QQ_FIELD_CONTACT, QQ_FIELD_STRING, "tel", N_("Phone Number"), NULL, 0 },
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
118 { QQ_FIELD_BASE, QQ_FIELD_STRING, "age", N_("Age"), NULL, 0 },
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
119 { QQ_FIELD_BASE, QQ_FIELD_CHOICE, "gender", N_("Gender"), genders, QQ_GENDER_SIZE },
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
120 { QQ_FIELD_BASE, QQ_FIELD_STRING, "name", N_("Name"), NULL, 0 },
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
121 { QQ_FIELD_CONTACT, QQ_FIELD_STRING, "email", N_("Email"), NULL, 0 },
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
122 { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "pg_sn", "Pager Serial Num", NULL, 0 },
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
123 { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "pg_num", "Pager Num", NULL, 0 },
25232
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
124 { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "pg_sp", "Pager Serivce Provider", NULL, 0 },
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
125 { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "pg_sta", "Pager Station Num", NULL, 0 },
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
126 { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "pg_type", "Pager Type", NULL, 0 },
25232
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
127 { QQ_FIELD_BASE, QQ_FIELD_STRING, "occupation", N_("Occupation"), NULL, 0 },
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
128 { QQ_FIELD_CONTACT, QQ_FIELD_STRING, "homepage", N_("Homepage"), NULL, 0 },
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
129 { QQ_FIELD_BASE, QQ_FIELD_BOOL, "auth", N_("Authorize adding"), NULL, 0 },
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
130 { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "unknow1", "Unknow1", NULL, 0 },
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
131 { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "unknow2", "Unknow2", NULL, 0 },
25232
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
132 { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "face", "Face", NULL, 0 },
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
133 { QQ_FIELD_CONTACT, QQ_FIELD_STRING, "mobile", N_("Cellphone Number"), NULL, 0 },
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
134 { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "mobile_type", "Cellphone Type", NULL, 0 },
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
135 { QQ_FIELD_BASE, QQ_FIELD_MULTI, "intro", N_("Personal Introduction"), NULL, 0 },
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
136 { QQ_FIELD_ADDR, QQ_FIELD_STRING, "city", N_("City/Area"), NULL, 0 },
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
137 { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "unknow3", "Unknow3", NULL, 0 },
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
138 { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "unknow4", "Unknow4", NULL, 0 },
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
139 { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "unknow5", "Unknow5", NULL, 0 },
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
140 { QQ_FIELD_UNUSED, QQ_FIELD_CHOICE, "pub_mobile", N_("Publish Mobile"), publish_types, QQ_PUBLISH_SIZE },
25232
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
141 { QQ_FIELD_CONTACT, QQ_FIELD_CHOICE, "pub_contact", N_("Publish Contact"), publish_types, QQ_PUBLISH_SIZE },
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
142 { QQ_FIELD_EXT, QQ_FIELD_STRING, "college", N_("College"), NULL, 0 },
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
143 { QQ_FIELD_EXT, QQ_FIELD_CHOICE, "horoscope", N_("Horoscope"), horoscope_names, QQ_HOROSCOPE_SIZE },
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
144 { QQ_FIELD_EXT, QQ_FIELD_CHOICE, "zodiac", N_("Zodiac"), zodiac_names, QQ_ZODIAC_SIZE },
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
145 { QQ_FIELD_EXT, QQ_FIELD_CHOICE, "blood", N_("Blood"), blood_types, QQ_BLOOD_SIZE },
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
146 { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "qq_show", "QQ Show", NULL, 0 },
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
147 { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "unknow6", "Unknow6", NULL, 0 },
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
148 { QQ_FIELD_UNUSED, QQ_FIELD_STRING, "LAST_2005", "LAST_2005", NULL, 0 }
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
149 };
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
151 typedef struct _modify_info_request {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
152 PurpleConnection *gc;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
153 int iclass;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
154 gchar **segments;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
155 } modify_info_request;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
157 #ifdef DEBUG
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
158 static void info_debug(gchar **segments)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159 {
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24156
diff changeset
160 #if 0
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
161 int index;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
162 gchar *utf8_str;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
163 for (index = 0; segments[index] != NULL && index < QQ_INFO_LAST; index++) {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
164 if (field_infos[index].type == QQ_FIELD_STRING
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
165 || field_infos[index].type == QQ_FIELD_LABEL
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
166 || field_infos[index].type == QQ_FIELD_MULTI
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
167 || index == QQ_INFO_GENDER) {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
168 utf8_str = qq_to_utf8(segments[index], QQ_CHARSET_DEFAULT);
24156
147f1b17b6ce 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
169 purple_debug_info("QQ_BUDDY_INFO", "%s: %s\n", field_infos[index].text, utf8_str);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
170 g_free(utf8_str);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
171 continue;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
172 }
24156
147f1b17b6ce 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
173 purple_debug_info("QQ_BUDDY_INFO", "%s: %s\n", field_infos[index].text, segments[index]);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
174 }
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24156
diff changeset
175 #endif
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
176 }
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
177 #endif
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
178
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
179 static void info_display_only(PurpleConnection *gc, gchar **segments)
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
180 {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
181 PurpleNotifyUserInfo *user_info;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
182 gchar *utf8_value;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
183 int index;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
184 int choice_num;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
186 user_info = purple_notify_user_info_new();
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
187
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
188 for (index = 1; segments[index] != NULL && index < QQ_INFO_LAST; index++) {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
189 if (field_infos[index].iclass == QQ_FIELD_UNUSED) {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
190 continue;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191 }
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
192 switch (field_infos[index].type) {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
193 case QQ_FIELD_BOOL:
26715
e0d739a002b4 correctly use some text marked by N_(), and mark one more string as
Ka-Hing Cheung <khc@hxbc.us>
parents: 26648
diff changeset
194 purple_notify_user_info_add_pair(user_info, _(field_infos[index].text),
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
195 strtol(segments[index], NULL, 10) ? _("True") : _("False"));
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
196 break;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
197 case QQ_FIELD_CHOICE:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
198 choice_num = strtol(segments[index], NULL, 10);
25232
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
199 if (choice_num < 0 || choice_num >= field_infos[index].choice_size) {
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
200 choice_num = 0;
effbf24b39b1 2009.02.08 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24873
diff changeset
201 }
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
202
26715
e0d739a002b4 correctly use some text marked by N_(), and mark one more string as
Ka-Hing Cheung <khc@hxbc.us>
parents: 26648
diff changeset
203 purple_notify_user_info_add_pair(user_info, _(field_infos[index].text), field_infos[index].choice[choice_num]);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
204 break;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
205 case QQ_FIELD_LABEL:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
206 case QQ_FIELD_STRING:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
207 case QQ_FIELD_MULTI:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
208 default:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
209 if (strlen(segments[index]) != 0) {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
210 utf8_value = qq_to_utf8(segments[index], QQ_CHARSET_DEFAULT);
26715
e0d739a002b4 correctly use some text marked by N_(), and mark one more string as
Ka-Hing Cheung <khc@hxbc.us>
parents: 26648
diff changeset
211 purple_notify_user_info_add_pair(user_info, _(field_infos[index].text), utf8_value);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
212 g_free(utf8_value);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
213 }
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
214 break;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
218 purple_notify_userinfo(gc, segments[0], user_info, NULL, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
220 purple_notify_user_info_destroy(user_info);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
221 g_strfreev(segments);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
224 void qq_request_buddy_info(PurpleConnection *gc, guint32 uid,
25518
7da3cf2530b7 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25232
diff changeset
225 guint32 update_class, int action)
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
226 {
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
227 qq_data *qd;
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
228 gchar raw_data[16] = {0};
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
229
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
230 g_return_if_fail(uid != 0);
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
231
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
232 qd = (qq_data *) gc->proto_data;
24606
16434c2b52f4 Change QQ number as unsigned long
Hu Yong <ccpaging@gmail.com>
parents: 24322
diff changeset
233 g_snprintf(raw_data, sizeof(raw_data), "%u", uid);
23879
23cec4360d4a applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23878
diff changeset
234 qq_send_cmd_mess(gc, QQ_CMD_GET_BUDDY_INFO, (guint8 *) raw_data, strlen(raw_data),
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
235 update_class, action);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238 /* send packet to modify personal information */
24155
3c52353b83ae 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24154
diff changeset
239 static void request_change_info(PurpleConnection *gc, gchar **segments)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240 {
23048
9a5d140400f1 patch-02-fix-multiarch
SHiNE CsyFeK <csyfek@gmail.com>
parents: 22544
diff changeset
241 gint bytes = 0;
9a5d140400f1 patch-02-fix-multiarch
SHiNE CsyFeK <csyfek@gmail.com>
parents: 22544
diff changeset
242 guint8 raw_data[MAX_PACKET_SIZE - 128] = {0};
9a5d140400f1 patch-02-fix-multiarch
SHiNE CsyFeK <csyfek@gmail.com>
parents: 22544
diff changeset
243 guint8 bar;
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
244 gchar *join;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
246 g_return_if_fail(segments != NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
247
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248 bar = 0x1f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249
23048
9a5d140400f1 patch-02-fix-multiarch
SHiNE CsyFeK <csyfek@gmail.com>
parents: 22544
diff changeset
250 bytes += qq_put8(raw_data + bytes, bar);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
251 bytes += qq_put8(raw_data + bytes, bar);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
252
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
253 /* important! skip the first uid entry */
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
254 join = g_strjoinv("\x1f", segments + 1);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
255 bytes += qq_putdata(raw_data + bytes, (guint8 *)join, strlen(join));
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
256 g_free(join);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257
23048
9a5d140400f1 patch-02-fix-multiarch
SHiNE CsyFeK <csyfek@gmail.com>
parents: 22544
diff changeset
258 bytes += qq_put8(raw_data + bytes, bar);
9a5d140400f1 patch-02-fix-multiarch
SHiNE CsyFeK <csyfek@gmail.com>
parents: 22544
diff changeset
259
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
260 /* qq_show_packet("request_modify_info", raw_data, bytes); */
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
261 qq_send_cmd(gc, QQ_CMD_UPDATE_INFO, raw_data, bytes);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
264 static void info_modify_cancel_cb(modify_info_request *info_request)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265 {
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
266 g_strfreev(info_request->segments);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
267 g_free(info_request);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 /* parse fields and send info packet */
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
271 static void info_modify_ok_cb(modify_info_request *info_request, PurpleRequestFields *fields)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15482
diff changeset
273 PurpleConnection *gc;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274 qq_data *qd;
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
275 gchar **segments;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
276 int index;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
277 const char *utf8_str;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
278 gchar *value;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
279 int choice_num;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
280
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
281 gc = info_request->gc;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
282 g_return_if_fail(gc != NULL && info_request->gc);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
283 qd = (qq_data *) gc->proto_data;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
284 segments = info_request->segments;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
285 g_return_if_fail(segments != NULL);
20339
136ded231700 applied changes from 582eb3d8206e0fbe1023e9ce7f3bdf833a1c0db2
Luke Schierer <lschiere@pidgin.im>
parents: 20336
diff changeset
286
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
287 for (index = 1; segments[index] != NULL && index < QQ_INFO_LAST; index++) {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
288 if (field_infos[index].iclass == QQ_FIELD_UNUSED) {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
289 continue;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
290 }
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
291 if (!purple_request_fields_exists(fields, field_infos[index].id)) {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
292 continue;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
293 }
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
294 switch (field_infos[index].type) {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
295 case QQ_FIELD_BOOL:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
296 value = purple_request_fields_get_bool(fields, field_infos[index].id)
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
297 ? g_strdup("1") : g_strdup("0");
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
298 g_free(segments[index]);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
299 segments[index] = value;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
300 break;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
301 case QQ_FIELD_CHOICE:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
302 choice_num = purple_request_fields_get_choice(fields, field_infos[index].id);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
303 if (choice_num < 0 || choice_num >= field_infos[index].choice_size) choice_num = 0;
20336
b93e7be3847b applied changes from 9d35dde0c779cca73548172223ba557f27d61882
Luke Schierer <lschiere@pidgin.im>
parents: 19681
diff changeset
304
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
305 if (index == QQ_INFO_GENDER) {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
306 /* QQ Server only recept gender in Chinese */
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
307 value = g_strdup(genders_zh[choice_num]);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
308 } else {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
309 value = g_strdup_printf("%d", choice_num);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
310 }
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
311 g_free(segments[index]);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
312 segments[index] = value;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
313 break;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
314 case QQ_FIELD_LABEL:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
315 case QQ_FIELD_STRING:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
316 case QQ_FIELD_MULTI:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
317 default:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
318 utf8_str = purple_request_fields_get_string(fields, field_infos[index].id);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
319 if (utf8_str == NULL) {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
320 value = g_strdup("-");
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
321 } else {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
322 value = utf8_to_qq(utf8_str, QQ_CHARSET_DEFAULT);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
323 if (value == NULL) value = g_strdup("-");
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
324 }
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
325 g_free(segments[index]);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
326 segments[index] = value;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
327 break;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
328 }
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
329 }
24155
3c52353b83ae 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24154
diff changeset
330 request_change_info(gc, segments);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
331
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
332 g_strfreev(segments);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
333 g_free(info_request);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
334 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
335
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
336 static void field_request_new(PurpleRequestFieldGroup *group, gint index, gchar **segments)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
337 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15482
diff changeset
338 PurpleRequestField *field;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
339 gchar *utf8_value;
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
340 int choice_num;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
341 int i;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
342
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
343 g_return_if_fail(index >=0 && segments[index] != NULL && index < QQ_INFO_LAST);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
344
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
345 switch (field_infos[index].type) {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
346 case QQ_FIELD_STRING:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
347 case QQ_FIELD_MULTI:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
348 utf8_value = qq_to_utf8(segments[index], QQ_CHARSET_DEFAULT);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
349 if (field_infos[index].type == QQ_FIELD_STRING) {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
350 field = purple_request_field_string_new(
26715
e0d739a002b4 correctly use some text marked by N_(), and mark one more string as
Ka-Hing Cheung <khc@hxbc.us>
parents: 26648
diff changeset
351 field_infos[index].id, _(field_infos[index].text), utf8_value, FALSE);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
352 } else {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
353 field = purple_request_field_string_new(
26715
e0d739a002b4 correctly use some text marked by N_(), and mark one more string as
Ka-Hing Cheung <khc@hxbc.us>
parents: 26648
diff changeset
354 field_infos[index].id, _(field_infos[index].text), utf8_value, TRUE);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
355 }
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
356 purple_request_field_group_add_field(group, field);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
357 g_free(utf8_value);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
358 break;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
359 case QQ_FIELD_BOOL:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
360 field = purple_request_field_bool_new(
26715
e0d739a002b4 correctly use some text marked by N_(), and mark one more string as
Ka-Hing Cheung <khc@hxbc.us>
parents: 26648
diff changeset
361 field_infos[index].id, _(field_infos[index].text),
e0d739a002b4 correctly use some text marked by N_(), and mark one more string as
Ka-Hing Cheung <khc@hxbc.us>
parents: 26648
diff changeset
362 strtol(segments[index], NULL, 10) ? TRUE : FALSE);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
363 purple_request_field_group_add_field(group, field);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
364 break;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
365 case QQ_FIELD_CHOICE:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
366 choice_num = strtol(segments[index], NULL, 10);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
367 if (choice_num < 0 || choice_num >= field_infos[index].choice_size) choice_num = 0;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
368
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
369 if (index == QQ_INFO_GENDER && strlen(segments[index]) != 0) {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
370 for (i = 0; i < QQ_GENDER_SIZE; i++) {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
371 if (strcmp(segments[index], genders_zh[i]) == 0) {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
372 choice_num = i;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
373 }
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
374 }
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
375 }
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
376 field = purple_request_field_choice_new(
26715
e0d739a002b4 correctly use some text marked by N_(), and mark one more string as
Ka-Hing Cheung <khc@hxbc.us>
parents: 26648
diff changeset
377 field_infos[index].id, _(field_infos[index].text), choice_num);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
378 for (i = 0; i < field_infos[index].choice_size; i++) {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
379 purple_request_field_choice_add(field, field_infos[index].choice[i]);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
380 }
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
381 purple_request_field_group_add_field(group, field);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
382 break;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
383 case QQ_FIELD_LABEL:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
384 default:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
385 field = purple_request_field_label_new(field_infos[index].id, segments[index]);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
386 purple_request_field_group_add_field(group, field);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
387 break;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
388 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
389 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
390
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
391 static void info_modify_dialogue(PurpleConnection *gc, gchar **segments, int iclass)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
392 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393 qq_data *qd;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15482
diff changeset
394 PurpleRequestFieldGroup *group;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15482
diff changeset
395 PurpleRequestFields *fields;
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
396 modify_info_request *info_request;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
397 gchar *utf8_title, *utf8_prim;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
398 int index;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
399
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
400 qd = (qq_data *) gc->proto_data;
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
401 /* Keep one dialog once a time */
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
402 purple_request_close_with_handle(gc);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
403
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
404 fields = purple_request_fields_new();
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
405 group = purple_request_field_group_new(NULL);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
406 purple_request_fields_add_group(fields, group);
20339
136ded231700 applied changes from 582eb3d8206e0fbe1023e9ce7f3bdf833a1c0db2
Luke Schierer <lschiere@pidgin.im>
parents: 20336
diff changeset
407
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
408 for (index = 1; segments[index] != NULL && index < QQ_INFO_LAST; index++) {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
409 if (field_infos[index].iclass != iclass) {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
410 continue;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
411 }
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
412 field_request_new(group, index, segments);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
413 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
415 switch (iclass) {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
416 case QQ_FIELD_CONTACT:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
417 utf8_title = g_strdup(_("Modify Contact"));
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
418 utf8_prim = g_strdup_printf("%s for %s", _("Modify Contact"), segments[0]);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
419 case QQ_FIELD_ADDR:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
420 utf8_title = g_strdup(_("Modify Address"));
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
421 utf8_prim = g_strdup_printf("%s for %s", _("Modify Address"), segments[0]);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
422 case QQ_FIELD_EXT:
24431
75545fdf8944 String changes. I'm kind of blindly making changes to the qq strings
Mark Doliner <mark@kingant.net>
parents: 24322
diff changeset
423 utf8_title = g_strdup(_("Modify Extended Information"));
75545fdf8944 String changes. I'm kind of blindly making changes to the qq strings
Mark Doliner <mark@kingant.net>
parents: 24322
diff changeset
424 utf8_prim = g_strdup_printf("%s for %s", _("Modify Extended Information"), segments[0]);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
425 break;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
426 case QQ_FIELD_BASE:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
427 default:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
428 utf8_title = g_strdup(_("Modify Information"));
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
429 utf8_prim = g_strdup_printf("%s for %s", _("Modify Information"), segments[0]);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
430 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
431
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
432 info_request = g_new0(modify_info_request, 1);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
433 info_request->gc = gc;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
434 info_request->iclass = iclass;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
435 info_request->segments = segments;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
436
24134
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
437 purple_request_fields(gc,
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
438 utf8_title,
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
439 utf8_prim,
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
440 NULL,
bdfcfd71449c patch 20080922 from ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24117
diff changeset
441 fields,
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
442 _("Update"), G_CALLBACK(info_modify_ok_cb),
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
443 _("Cancel"), G_CALLBACK(info_modify_cancel_cb),
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
444 purple_connection_get_account(gc), NULL, NULL,
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
445 info_request);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
446
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
447 g_free(utf8_title);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
448 g_free(utf8_prim);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451 /* process the reply of modify_info packet */
24155
3c52353b83ae 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24154
diff changeset
452 void qq_process_change_info(PurpleConnection *gc, guint8 *data, gint data_len)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
454 qq_data *qd;
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23638
diff changeset
455 g_return_if_fail(data != NULL && data_len != 0);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
456
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
457 qd = (qq_data *) gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
458
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23638
diff changeset
459 data[data_len] = '\0';
24155
3c52353b83ae 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24154
diff changeset
460 if (qd->uid != atoi((gchar *) data)) { /* return should be my uid */
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24156
diff changeset
461 purple_debug_info("QQ", "Failed Updating info\n");
24654
8ee728876ded 2008.12.05 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24653
diff changeset
462 qq_got_message(gc, _("Could not change buddy information."));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
463 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
464 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
465
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
466 static void request_set_buddy_icon(PurpleConnection *gc, gint face_num)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
467 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15482
diff changeset
468 PurpleAccount *account = purple_connection_get_account(gc);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15482
diff changeset
469 PurplePresence *presence = purple_account_get_presence(account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
470 qq_data *qd = (qq_data *) gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471 gint offset;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
472
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15482
diff changeset
473 if(purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_INVISIBLE)) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
474 offset = 2;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15482
diff changeset
475 } else if(purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_AWAY)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15482
diff changeset
476 || purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_EXTENDED_AWAY)) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
477 offset = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
478 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
479 offset = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
480 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
481
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
482 qd->my_icon = 3 * (face_num - 1) + offset;
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
483 qq_request_buddy_info(gc, qd->uid, 0, QQ_BUDDY_INFO_SET_ICON);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
484 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
485
24154
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
486 void qq_change_icon_cb(PurpleConnection *gc, const char *filepath)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
487 {
24432
95f0895f6c56 Use basename() instead of splitting a path and then taking the last element.
Mark Doliner <mark@kingant.net>
parents: 24431
diff changeset
488 gchar *basename;
95f0895f6c56 Use basename() instead of splitting a path and then taking the last element.
Mark Doliner <mark@kingant.net>
parents: 24431
diff changeset
489 size_t index;
24154
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
490 gint face;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
491
24154
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
492 g_return_if_fail(filepath != NULL);
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
493
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
494 purple_debug_info("QQ", "Change my icon to %s\n", filepath);
24150
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
495
24432
95f0895f6c56 Use basename() instead of splitting a path and then taking the last element.
Mark Doliner <mark@kingant.net>
parents: 24431
diff changeset
496 basename = g_path_get_basename(filepath);
95f0895f6c56 Use basename() instead of splitting a path and then taking the last element.
Mark Doliner <mark@kingant.net>
parents: 24431
diff changeset
497 index = strcspn(basename, "0123456789");
95f0895f6c56 Use basename() instead of splitting a path and then taking the last element.
Mark Doliner <mark@kingant.net>
parents: 24431
diff changeset
498 face = strtol(basename + index, NULL, 10);
95f0895f6c56 Use basename() instead of splitting a path and then taking the last element.
Mark Doliner <mark@kingant.net>
parents: 24431
diff changeset
499 g_free(basename);
24154
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
500 purple_debug_info("QQ", "Set face to %d\n", face);
24150
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
501
24154
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
502 request_set_buddy_icon(gc, face);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
503 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
504
24150
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
505 void qq_set_custom_icon(PurpleConnection *gc, PurpleStoredImage *img)
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
506 {
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
507 PurpleAccount *account = purple_connection_get_account(gc);
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
508 const gchar *icon_path = purple_account_get_buddy_icon_path(account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
509
24150
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
510 g_return_if_fail(icon_path != NULL);
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
511
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
512 /* Fixme:
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
513 * icon_path is always null
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
514 * purple_imgstore_get_filename is always new file
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
515 * QQ buddy may set custom icon if level is over 16 */
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
516 purple_debug_info("QQ", "Change my icon to %s\n", icon_path);
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
517 }
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
518
24154
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
519 gchar *qq_get_icon_name(gint face)
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
520 {
24155
3c52353b83ae 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24154
diff changeset
521 gint icon;
3c52353b83ae 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24154
diff changeset
522 gchar *icon_name;
24154
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
523
24155
3c52353b83ae 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24154
diff changeset
524 icon = face / 3 + 1;
24165
cae676ac3c70 2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24163
diff changeset
525 if (icon < 1 || icon > QQ_FACES) {
24155
3c52353b83ae 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24154
diff changeset
526 icon = 1;
24154
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
527 }
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24156
diff changeset
528
24155
3c52353b83ae 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24154
diff changeset
529 icon_name = g_strdup_printf("%s%d%s", QQ_ICON_PREFIX, icon, QQ_ICON_SUFFIX);
24154
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
530 return icon_name;
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
531 }
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
532
27392
d7ac2ad0db5a Add a comment about some strange behavior that I noticed
Mark Doliner <mark@kingant.net>
parents: 26715
diff changeset
533 /*
27533
a5628ba3c83c Update these comments based on Kevin's reply a week ago on the devel
Mark Doliner <mark@kingant.net>
parents: 27392
diff changeset
534 * This function seems to let people set their buddy icon, but it restricts
a5628ba3c83c Update these comments based on Kevin's reply a week ago on the devel
Mark Doliner <mark@kingant.net>
parents: 27392
diff changeset
535 * them to using a small list of stock icons. Wouldn't it make more sense
a5628ba3c83c Update these comments based on Kevin's reply a week ago on the devel
Mark Doliner <mark@kingant.net>
parents: 27392
diff changeset
536 * to use libpurple's normal icon setting stuff?
a5628ba3c83c Update these comments based on Kevin's reply a week ago on the devel
Mark Doliner <mark@kingant.net>
parents: 27392
diff changeset
537 *
a5628ba3c83c Update these comments based on Kevin's reply a week ago on the devel
Mark Doliner <mark@kingant.net>
parents: 27392
diff changeset
538 * Also it would be nice to unify the icon_dir code for Windows and Linux.
27392
d7ac2ad0db5a Add a comment about some strange behavior that I noticed
Mark Doliner <mark@kingant.net>
parents: 26715
diff changeset
539 */
24154
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
540 gchar *qq_get_icon_path(gchar *icon_name)
24152
d3811bdb6b07 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24150
diff changeset
541 {
d3811bdb6b07 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24150
diff changeset
542 gchar *icon_path;
d3811bdb6b07 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24150
diff changeset
543 const gchar *icon_dir;
24154
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
544 #ifdef _WIN32
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
545 static char *dir = NULL;
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
546 if (dir == NULL) {
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
547 dir = g_build_filename(wpurple_install_dir(), "pixmaps",
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
548 "purple", "buddy_icons", "qq", NULL);
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
549 }
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
550 #endif
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
551
27533
a5628ba3c83c Update these comments based on Kevin's reply a week ago on the devel
Mark Doliner <mark@kingant.net>
parents: 27392
diff changeset
552 /*
a5628ba3c83c Update these comments based on Kevin's reply a week ago on the devel
Mark Doliner <mark@kingant.net>
parents: 27392
diff changeset
553 * TODO: The QQ protocol plugin should probably call
a5628ba3c83c Update these comments based on Kevin's reply a week ago on the devel
Mark Doliner <mark@kingant.net>
parents: 27392
diff changeset
554 * purple_prefs_add_string() at startup to initialize this
a5628ba3c83c Update these comments based on Kevin's reply a week ago on the devel
Mark Doliner <mark@kingant.net>
parents: 27392
diff changeset
555 * preference. It is used to allow users or distributions
a5628ba3c83c Update these comments based on Kevin's reply a week ago on the devel
Mark Doliner <mark@kingant.net>
parents: 27392
diff changeset
556 * to specify this directory. We don't include these icons
a5628ba3c83c Update these comments based on Kevin's reply a week ago on the devel
Mark Doliner <mark@kingant.net>
parents: 27392
diff changeset
557 * with libpurple because of possible copyright concerns.
a5628ba3c83c Update these comments based on Kevin's reply a week ago on the devel
Mark Doliner <mark@kingant.net>
parents: 27392
diff changeset
558 */
24152
d3811bdb6b07 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24150
diff changeset
559 icon_dir = purple_prefs_get_string("/plugins/prpl/qq/icon_dir");
24154
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
560 if ( icon_dir == NULL || strlen(icon_dir) == 0) {
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
561 #ifdef _WIN32
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
562 icon_dir = dir;
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
563 #else
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
564 icon_dir = QQ_BUDDY_ICON_DIR;
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
565 #endif
24152
d3811bdb6b07 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24150
diff changeset
566 }
24155
3c52353b83ae 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24154
diff changeset
567 icon_path = g_strdup_printf("%s%c%s", icon_dir, G_DIR_SEPARATOR, icon_name);
24152
d3811bdb6b07 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24150
diff changeset
568
d3811bdb6b07 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24150
diff changeset
569 return icon_path;
d3811bdb6b07 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24150
diff changeset
570 }
d3811bdb6b07 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24150
diff changeset
571
24606
16434c2b52f4 Change QQ number as unsigned long
Hu Yong <ccpaging@gmail.com>
parents: 24322
diff changeset
572 void qq_update_buddy_icon(PurpleAccount *account, const gchar *who, gint face)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
573 {
16817
56823a55581a Rework purple_buddy_icons_find() to return a reference for the caller, which
Richard Laager <rlaager@wiktel.com>
parents: 16475
diff changeset
574 PurpleBuddy *buddy;
24150
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
575 const gchar *icon_name_prev = NULL;
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
576 gchar *icon_name;
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
577 gchar *icon_path;
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
578 gchar *icon_file_content;
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
579 gsize icon_file_size;
16386
e0c9a46b459f Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@wiktel.com>
parents: 16373
diff changeset
580
24156
147f1b17b6ce 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24155
diff changeset
581 g_return_if_fail(account != NULL && who != NULL);
24161
7c0a56c5fea0 2008.10.14 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24156
diff changeset
582
24606
16434c2b52f4 Change QQ number as unsigned long
Hu Yong <ccpaging@gmail.com>
parents: 24322
diff changeset
583 /* purple_debug_info("QQ", "Update %s icon to %d\n", who, face); */
16817
56823a55581a Rework purple_buddy_icons_find() to return a reference for the caller, which
Richard Laager <rlaager@wiktel.com>
parents: 16475
diff changeset
584
24154
237e5a94e11c 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24152
diff changeset
585 icon_name = qq_get_icon_name(face);
24606
16434c2b52f4 Change QQ number as unsigned long
Hu Yong <ccpaging@gmail.com>
parents: 24322
diff changeset
586 g_return_if_fail(icon_name != NULL);
16434c2b52f4 Change QQ number as unsigned long
Hu Yong <ccpaging@gmail.com>
parents: 24322
diff changeset
587 /* purple_debug_info("QQ", "icon file name is %s\n", icon_name); */
24165
cae676ac3c70 2008.10.27 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24163
diff changeset
588
24150
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
589 if ((buddy = purple_find_buddy(account, who))) {
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
590 icon_name_prev = purple_buddy_icons_get_checksum_for_user(buddy);
24606
16434c2b52f4 Change QQ number as unsigned long
Hu Yong <ccpaging@gmail.com>
parents: 24322
diff changeset
591 /*
16434c2b52f4 Change QQ number as unsigned long
Hu Yong <ccpaging@gmail.com>
parents: 24322
diff changeset
592 purple_debug_info("QQ", "Previous icon is %s\n",
16434c2b52f4 Change QQ number as unsigned long
Hu Yong <ccpaging@gmail.com>
parents: 24322
diff changeset
593 icon_name_prev != NULL ? icon_name_prev : "(NULL)");
16434c2b52f4 Change QQ number as unsigned long
Hu Yong <ccpaging@gmail.com>
parents: 24322
diff changeset
594 */
24150
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
595 }
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
596 if (icon_name_prev != NULL && !strcmp(icon_name, icon_name_prev)) {
24606
16434c2b52f4 Change QQ number as unsigned long
Hu Yong <ccpaging@gmail.com>
parents: 24322
diff changeset
597 /* purple_debug_info("QQ", "Icon is not changed\n"); */
24150
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
598 g_free(icon_name);
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
599 return;
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
600 }
24152
d3811bdb6b07 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24150
diff changeset
601
d3811bdb6b07 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24150
diff changeset
602 icon_path = qq_get_icon_path(icon_name);
d3811bdb6b07 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24150
diff changeset
603 if (icon_path == NULL) {
24150
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
604 g_free(icon_name);
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
605 return;
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
606 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
607
24150
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
608 if (!g_file_get_contents(icon_path, &icon_file_content, &icon_file_size, NULL)) {
24152
d3811bdb6b07 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24150
diff changeset
609 purple_debug_error("QQ", "Failed reading icon file %s\n", icon_path);
24150
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
610 } else {
24606
16434c2b52f4 Change QQ number as unsigned long
Hu Yong <ccpaging@gmail.com>
parents: 24322
diff changeset
611 purple_debug_info("QQ", "Update %s icon to %d (%s)\n",
16434c2b52f4 Change QQ number as unsigned long
Hu Yong <ccpaging@gmail.com>
parents: 24322
diff changeset
612 who, face, icon_path);
24150
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
613 purple_buddy_icons_set_for_user(account, who,
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
614 icon_file_content, icon_file_size, icon_name);
16386
e0c9a46b459f Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@wiktel.com>
parents: 16373
diff changeset
615 }
24150
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
616 g_free(icon_name);
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
617 g_free(icon_path);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
618 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
619
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
620 /* after getting info or modify myself, refresh the buddy list accordingly */
24150
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
621 static void update_buddy_info(PurpleConnection *gc, gchar **segments)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
622 {
26648
660660e0e8c6 2009.04.23 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25947
diff changeset
623 PurpleBuddy *buddy = NULL;
660660e0e8c6 2009.04.23 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25947
diff changeset
624 qq_data *qd = NULL;
660660e0e8c6 2009.04.23 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25947
diff changeset
625 qq_buddy_data *bd = NULL;
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
626 guint32 uid;
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
627 gchar *who;
23561
bdb38a8bf721 20080717-05-1-fix-keep-alive ccpaging <ecc_hy(at)hotmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23051
diff changeset
628 gchar *alias_utf8;
26648
660660e0e8c6 2009.04.23 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25947
diff changeset
629
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15482
diff changeset
630 PurpleAccount *account = purple_connection_get_account(gc);
25807
e35115192593 Finished struct hiding in bonjour and qq
Gary Kramlich <grim@reaperworld.com>
parents: 24165
diff changeset
631 qd = (qq_data *)purple_connection_get_protocol_data(gc);
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
632
24606
16434c2b52f4 Change QQ number as unsigned long
Hu Yong <ccpaging@gmail.com>
parents: 24322
diff changeset
633 uid = strtoul(segments[QQ_INFO_UID], NULL, 10);
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
634 who = uid_to_purple_name(uid);
24150
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
635 qq_filter_str(segments[QQ_INFO_NICK]);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
636 alias_utf8 = qq_to_utf8(segments[QQ_INFO_NICK], QQ_CHARSET_DEFAULT);
26648
660660e0e8c6 2009.04.23 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25947
diff changeset
637
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
638 if (uid == qd->uid) { /* it is me */
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
639 purple_debug_info("QQ", "Got my info\n");
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
640 qd->my_icon = strtol(segments[QQ_INFO_FACE], NULL, 10);
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
641 if (alias_utf8 != NULL) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15482
diff changeset
642 purple_account_set_alias(account, alias_utf8);
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
643 }
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
644 /* add me to buddy list */
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
645 buddy = qq_buddy_find_or_new(gc, uid);
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
646 } else {
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
647 buddy = purple_find_buddy(gc->account, who);
26648
660660e0e8c6 2009.04.23 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25947
diff changeset
648 /* purple_debug_info("QQ", "buddy=%p\n", (void*)buddy); */
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
649 }
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
650
25807
e35115192593 Finished struct hiding in bonjour and qq
Gary Kramlich <grim@reaperworld.com>
parents: 24165
diff changeset
651 /* if the buddy is null, the api will catch it and return null here */
e35115192593 Finished struct hiding in bonjour and qq
Gary Kramlich <grim@reaperworld.com>
parents: 24165
diff changeset
652 bd = purple_buddy_get_protocol_data(buddy);
26648
660660e0e8c6 2009.04.23 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25947
diff changeset
653 /* purple_debug_info("QQ", "bd=%p\n", (void*)bd); */
25807
e35115192593 Finished struct hiding in bonjour and qq
Gary Kramlich <grim@reaperworld.com>
parents: 24165
diff changeset
654
26648
660660e0e8c6 2009.04.23 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25947
diff changeset
655 if (bd == NULL || buddy == NULL) {
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
656 g_free(who);
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
657 g_free(alias_utf8);
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
658 return;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
659 }
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
660
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
661 /* update buddy list (including myself, if myself is the buddy) */
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
662 bd->age = strtol(segments[QQ_INFO_AGE], NULL, 10);
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
663 bd->gender = strtol(segments[QQ_INFO_GENDER], NULL, 10);
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
664 bd->face = strtol(segments[QQ_INFO_FACE], NULL, 10);
26648
660660e0e8c6 2009.04.23 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25947
diff changeset
665
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
666 if (alias_utf8 != NULL) {
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
667 if (bd->nickname) g_free(bd->nickname);
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
668 bd->nickname = g_strdup(alias_utf8);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
669 }
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
670 bd->last_update = time(NULL);
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
671
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
672 purple_blist_server_alias_buddy(buddy, bd->nickname);
24150
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
673
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
674 /* convert face num from packet (0-299) to local face (1-100) */
24606
16434c2b52f4 Change QQ number as unsigned long
Hu Yong <ccpaging@gmail.com>
parents: 24322
diff changeset
675 qq_update_buddy_icon(gc->account, who, bd->face);
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
676
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
677 g_free(who);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
678 g_free(alias_utf8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
679 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
680
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
681 /* process reply to get_info packet */
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
682 void qq_process_get_buddy_info(guint8 *data, gint data_len, guint32 action, PurpleConnection *gc)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
683 {
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
684 qq_data *qd;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
685 gchar **segments;
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
686 gint field_count;
24150
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
687 gchar *icon_name;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
688
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23638
diff changeset
689 g_return_if_fail(data != NULL && data_len != 0);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
690
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
691 qd = (qq_data *) gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
692
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
693 if (qd->client_version >= 2008) {
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
694 field_count = QQ_INFO_LAST;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
695 } else {
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
696 field_count = QQ_INFO_LAST_2007;
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
697 }
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
698 if (NULL == (segments = split_data(data, data_len, "\x1e", field_count)))
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23638
diff changeset
699 return;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
700
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
701 #ifdef DEBUG
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
702 info_debug(segments);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
703 #endif
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
704
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
705 if (action == QQ_BUDDY_INFO_SET_ICON) {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
706 if (strtol(segments[QQ_INFO_FACE], NULL, 10) != qd->my_icon) {
24150
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
707 icon_name = g_strdup_printf("%d", qd->my_icon);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
708 g_free(segments[QQ_INFO_FACE]);
24150
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
709 segments[QQ_INFO_FACE] = icon_name;
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
710
24155
3c52353b83ae 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24154
diff changeset
711 /* Update me in buddy list */
3c52353b83ae 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24154
diff changeset
712 update_buddy_info(gc, segments);
3c52353b83ae 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24154
diff changeset
713 /* send new face to server */
3c52353b83ae 2008.10.08 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24154
diff changeset
714 request_change_info(gc, segments);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
715 }
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
716 g_strfreev(segments);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
717 return;
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23638
diff changeset
718 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
719
24150
119d85c40d75 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24149
diff changeset
720 update_buddy_info(gc, segments);
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
721 switch (action) {
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
722 case QQ_BUDDY_INFO_DISPLAY:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
723 info_display_only(gc, segments);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
724 break;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
725 case QQ_BUDDY_INFO_SET_ICON:
24163
7f5433ffbf8d 2008.10.22 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24161
diff changeset
726 g_return_if_reached();
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
727 break;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
728 case QQ_BUDDY_INFO_MODIFY_BASE:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
729 info_modify_dialogue(gc, segments, QQ_FIELD_BASE);
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23638
diff changeset
730 break;
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
731 case QQ_BUDDY_INFO_MODIFY_EXT:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
732 info_modify_dialogue(gc, segments, QQ_FIELD_EXT);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
733 break;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
734 case QQ_BUDDY_INFO_MODIFY_ADDR:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
735 info_modify_dialogue(gc, segments, QQ_FIELD_ADDR);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
736 break;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
737 case QQ_BUDDY_INFO_MODIFY_CONTACT:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
738 info_modify_dialogue(gc, segments, QQ_FIELD_CONTACT);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
739 break;
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
740 default:
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
741 g_strfreev(segments);
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
742 break;
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23638
diff changeset
743 }
24117
d57928c9dd8f 2008.09.19 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24115
diff changeset
744 return;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
745 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
746
23879
23cec4360d4a applied changes from 8cebefbc6cd5d84acb69c74e69e8821f11dd225d
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23878
diff changeset
747 void qq_request_get_level(PurpleConnection *gc, guint32 uid)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
748 {
23051
55f986ccbb6a patch-05-reconnect-and-code-cleanup
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23050
diff changeset
749 qq_data *qd = (qq_data *) gc->proto_data;
23048
9a5d140400f1 patch-02-fix-multiarch
SHiNE CsyFeK <csyfek@gmail.com>
parents: 22544
diff changeset
750 guint8 buf[16] = {0};
9a5d140400f1 patch-02-fix-multiarch
SHiNE CsyFeK <csyfek@gmail.com>
parents: 22544
diff changeset
751 gint bytes = 0;
9a5d140400f1 patch-02-fix-multiarch
SHiNE CsyFeK <csyfek@gmail.com>
parents: 22544
diff changeset
752
24142
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
753 if (qd->client_version >= 2007) {
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
754 bytes += qq_put8(buf + bytes, 0x02);
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
755 } else {
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
756 bytes += qq_put8(buf + bytes, 0x00);
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
757 }
23048
9a5d140400f1 patch-02-fix-multiarch
SHiNE CsyFeK <csyfek@gmail.com>
parents: 22544
diff changeset
758 bytes += qq_put32(buf + bytes, uid);
24142
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
759 qq_send_cmd(gc, QQ_CMD_GET_LEVEL, buf, bytes);
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
760 }
23048
9a5d140400f1 patch-02-fix-multiarch
SHiNE CsyFeK <csyfek@gmail.com>
parents: 22544
diff changeset
761
24142
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
762 void qq_request_get_level_2007(PurpleConnection *gc, guint32 uid)
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
763 {
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
764 guint8 buf[16] = {0};
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
765 gint bytes = 0;
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
766
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
767 bytes += qq_put8(buf + bytes, 0x08);
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
768 bytes += qq_put32(buf + bytes, uid);
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
769 bytes += qq_put8(buf + bytes, 0x00);
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
770 qq_send_cmd(gc, QQ_CMD_GET_LEVEL, buf, bytes);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
771 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
772
25518
7da3cf2530b7 2009.02.21 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 25232
diff changeset
773 void qq_request_get_buddies_level(PurpleConnection *gc, guint32 update_class)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
774 {
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
775 qq_data *qd = (qq_data *) gc->proto_data;
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
776 PurpleBuddy *buddy;
24149
818ab62006f5 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24148
diff changeset
777 qq_buddy_data *bd;
23048
9a5d140400f1 patch-02-fix-multiarch
SHiNE CsyFeK <csyfek@gmail.com>
parents: 22544
diff changeset
778 guint8 *buf;
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
779 GSList *buddies, *it;
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
780 gint bytes;
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
781
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
782 /* server only reply levels for online buddies */
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
783 buf = g_newa(guint8, MAX_PACKET_SIZE);
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
784
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
785 bytes = 0;
23638
1c50f12b1c52 2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23561
diff changeset
786 bytes += qq_put8(buf + bytes, 0x00);
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
787 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
788 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
789 buddy = it->data;
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
790 if (buddy == NULL) continue;
25807
e35115192593 Finished struct hiding in bonjour and qq
Gary Kramlich <grim@reaperworld.com>
parents: 24165
diff changeset
791 if ((bd = purple_buddy_get_protocol_data(buddy)) == NULL) continue;
24149
818ab62006f5 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24148
diff changeset
792 if (bd->uid == 0) continue; /* keep me as end of packet*/
818ab62006f5 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24148
diff changeset
793 if (bd->uid == qd->uid) continue;
818ab62006f5 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24148
diff changeset
794 bytes += qq_put32(buf + bytes, bd->uid);
15482
0d43518fd943 Port [18179] from markhuetsch: I believe there's a bug in the get_buddies_levels() code that I don't have time to find. Temporarily disable it.
Evan Schoenberg <evan.s@dreskin.net>
parents: 15436
diff changeset
795 }
23878
967344bc404d applied changes from f12c8903079425d7850fa183df0b3f937b2952be
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23695
diff changeset
796 bytes += qq_put32(buf + bytes, qd->uid);
24148
1bdf7b602684 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24146
diff changeset
797 qq_send_cmd_mess(gc, QQ_CMD_GET_LEVEL, buf, bytes, update_class, 0);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
798 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
799
24142
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
800 static void process_level(PurpleConnection *gc, guint8 *data, gint data_len)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
801 {
23048
9a5d140400f1 patch-02-fix-multiarch
SHiNE CsyFeK <csyfek@gmail.com>
parents: 22544
diff changeset
802 gint bytes = 0;
24142
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
803 guint32 uid, onlineTime;
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
804 guint16 level, timeRemainder;
24149
818ab62006f5 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24148
diff changeset
805 qq_buddy_data *bd;
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
806
24142
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
807 while (data_len - bytes >= 12) {
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
808 bytes += qq_get32(&uid, data + bytes);
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
809 bytes += qq_get32(&onlineTime, data + bytes);
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
810 bytes += qq_get16(&level, data + bytes);
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
811 bytes += qq_get16(&timeRemainder, data + bytes);
24658
68eba2bafa6f 2008.12.17 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24654
diff changeset
812 purple_debug_info("QQ", "level: %d, uid %u, tmOnline: %d, tmRemainder: %d\n",
24630
699e8f0571ac Clean debug info
Hu Yong <ccpaging@gmail.com>
parents: 24606
diff changeset
813 level, uid, onlineTime, timeRemainder);
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23638
diff changeset
814
24149
818ab62006f5 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24148
diff changeset
815 bd = qq_buddy_data_find(gc, uid);
818ab62006f5 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24148
diff changeset
816 if (bd == NULL) {
24606
16434c2b52f4 Change QQ number as unsigned long
Hu Yong <ccpaging@gmail.com>
parents: 24322
diff changeset
817 purple_debug_error("QQ", "Got levels of %u not in my buddy list\n", uid);
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23638
diff changeset
818 continue;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
819 }
23695
5f454b975a99 2008.08.10 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23638
diff changeset
820
24149
818ab62006f5 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24148
diff changeset
821 bd->onlineTime = onlineTime;
818ab62006f5 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24148
diff changeset
822 bd->level = level;
818ab62006f5 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24148
diff changeset
823 bd->timeRemainder = timeRemainder;
24142
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
824 }
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
825
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
826 if (bytes != data_len) {
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
827 purple_debug_error("QQ",
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
828 "Wrong format of Get levels. Truncate %d bytes.\n", data_len - bytes);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
829 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
830 }
23638
1c50f12b1c52 2008.08.02 - csyfek <csyfek(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 23561
diff changeset
831
24142
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
832 static void process_level_2007(PurpleConnection *gc, guint8 *data, gint data_len)
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
833 {
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
834 gint bytes;
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
835 guint32 uid, onlineTime;
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
836 guint16 level, timeRemainder;
24149
818ab62006f5 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24148
diff changeset
837 qq_buddy_data *bd;
24142
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
838 guint16 str_len;
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
839 gchar *str;
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
840 gchar *str_utf8;
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
841
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
842 bytes = 0;
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
843 bytes += qq_get32(&uid, data + bytes);
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
844 bytes += qq_get32(&onlineTime, data + bytes);
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
845 bytes += qq_get16(&level, data + bytes);
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
846 bytes += qq_get16(&timeRemainder, data + bytes);
24658
68eba2bafa6f 2008.12.17 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24654
diff changeset
847 purple_debug_info("QQ", "level: %d, uid %u, tmOnline: %d, tmRemainder: %d\n",
24630
699e8f0571ac Clean debug info
Hu Yong <ccpaging@gmail.com>
parents: 24606
diff changeset
848 level, uid, onlineTime, timeRemainder);
24142
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
849
24149
818ab62006f5 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24148
diff changeset
850 bd = qq_buddy_data_find(gc, uid);
818ab62006f5 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24148
diff changeset
851 if (bd == NULL) {
24658
68eba2bafa6f 2008.12.17 - flos <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24654
diff changeset
852 purple_debug_error("QQ", "Got levels of %u not in my buddy list\n", uid);
24142
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
853 return;
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
854 }
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
855
24149
818ab62006f5 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24148
diff changeset
856 bd->onlineTime = onlineTime;
818ab62006f5 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24148
diff changeset
857 bd->level = level;
818ab62006f5 2008.10.07 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24148
diff changeset
858 bd->timeRemainder = timeRemainder;
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
859
24142
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
860 /* extend bytes in qq2007*/
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
861 bytes += 4; /* skip 8 bytes */
24146
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
862 /* qq_show_packet("Buddies level", data + bytes, data_len - bytes); */
ce94189f15ad Flos Lonicerae <lonicerae(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24145
diff changeset
863
24142
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
864 do {
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
865 bytes += qq_get16(&str_len, data + bytes);
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
866 if (str_len <= 0 || bytes + str_len > data_len) {
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
867 purple_debug_error("QQ",
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
868 "Wrong format of Get levels. Truncate %d bytes.\n", data_len - bytes);
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
869 break;
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
870 }
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
871 str = g_strndup((gchar *)data + bytes, str_len);
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
872 bytes += str_len;
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
873 str_utf8 = qq_to_utf8(str, QQ_CHARSET_DEFAULT);
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
874 purple_debug_info("QQ", "%s\n", str_utf8);
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
875 g_free(str_utf8);
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
876 g_free(str);
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
877 } while (bytes < data_len);
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
878 }
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
879
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
880 void qq_process_get_level_reply(guint8 *data, gint data_len, PurpleConnection *gc)
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
881 {
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
882 gint bytes;
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
883 guint8 sub_cmd;
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
884
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
885 bytes = 0;
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
886 bytes += qq_get8(&sub_cmd, data + bytes);
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
887 switch (sub_cmd) {
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
888 case 0x08:
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
889 process_level_2007(gc, data + bytes, data_len - bytes);
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
890 break;
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
891 case 0x00:
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
892 case 0x02:
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
893 default:
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
894 process_level(gc, data + bytes, data_len - bytes);
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
895 break;
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
896 }
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
897 }
df699d739b8f 2008.10.03 - ccpaging <ccpaging(at)gmail.com>
SHiNE CsyFeK <csyfek@gmail.com>
parents: 24135
diff changeset
898