Sun, 30 Nov 2008 06:31:39 +0000
Add a newline to the end of the file.
| 11414 | 1 | /** |
| 2 | * @file buddylist.c | |
| 3 | * | |
| 15884 | 4 | * purple |
| 11414 | 5 | * |
| 6 | * Copyright (C) 2005 Bartosz Oler <bartosz@bzimage.us> | |
| 7 | * | |
| 8 | * This program is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
15884
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 11414 | 21 | */ |
| 22 | ||
| 23 | ||
| 13318 | 24 | #include <libgadu.h> |
| 11414 | 25 | |
| 26 | #include "gg.h" | |
|
13627
44233a1064f9
[gaim-migrate @ 16013]
Evan Schoenberg <evands@pidgin.im>
parents:
13318
diff
changeset
|
27 | #include "gg-utils.h" |
| 11414 | 28 | #include "buddylist.h" |
| 29 | ||
|
20199
f417c49285e9
applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
30 | #define F_FIRSTNAME 0 |
|
f417c49285e9
applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
31 | #define F_LASTNAME 1 |
|
f417c49285e9
applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
32 | /* #define F_ 2 */ |
|
f417c49285e9
applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
33 | #define F_NICKNAME 3 |
|
f417c49285e9
applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
34 | #define F_PHONE 4 |
|
f417c49285e9
applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
35 | #define F_GROUP 5 |
|
f417c49285e9
applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
36 | #define F_UIN 6 |
| 11414 | 37 | |
| 15884 | 38 | /* void ggp_buddylist_send(PurpleConnection *gc) {{{ */ |
| 39 | void ggp_buddylist_send(PurpleConnection *gc) | |
| 11414 | 40 | { |
| 41 | GGPInfo *info = gc->proto_data; | |
| 15884 | 42 | PurpleAccount *account = purple_connection_get_account(gc); |
| 11414 | 43 | |
| 15884 | 44 | PurpleBlistNode *gnode, *cnode, *bnode; |
| 45 | PurpleBuddy *buddy; | |
| 11414 | 46 | uin_t *userlist = NULL; |
| 47 | gchar *types = NULL; | |
| 12007 | 48 | int size = 0; |
| 49 | ||
|
24939
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
50 | for (gnode = purple_blist_get_root(); |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
51 | gnode != NULL; |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
52 | gnode = purple_blist_node_get_sibling_next(gnode)) |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
53 | { |
| 15884 | 54 | if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) |
| 12007 | 55 | continue; |
| 56 | ||
|
24939
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
57 | for (cnode = purple_blist_node_get_first_child(gnode); |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
58 | cnode != NULL; |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
59 | cnode = purple_blist_node_get_sibling_next(cnode)) |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
60 | { |
| 15884 | 61 | if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) |
| 11414 | 62 | continue; |
| 12007 | 63 | |
|
24939
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
64 | for (bnode = purple_blist_node_get_first_child(cnode); |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
65 | bnode != NULL; |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
66 | bnode = purple_blist_node_get_sibling_next(bnode)) |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
67 | { |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
68 | const gchar *name = NULL; |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
69 | |
| 15884 | 70 | if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) |
| 11414 | 71 | continue; |
| 12007 | 72 | |
| 15884 | 73 | buddy = (PurpleBuddy *)bnode; |
| 12007 | 74 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20199
diff
changeset
|
75 | if (purple_buddy_get_account(buddy) != account) |
| 12007 | 76 | continue; |
| 11414 | 77 | |
|
24939
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
78 | name = purple_buddy_get_name(buddy); |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
79 | |
| 12007 | 80 | size++; |
| 81 | userlist = (uin_t *) g_renew(uin_t, userlist, size); | |
| 82 | types = (gchar *) g_renew(gchar, types, size); | |
|
24939
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
83 | userlist[size - 1] = ggp_str_to_uin(name); |
| 12007 | 84 | types[size - 1] = GG_USER_NORMAL; |
| 15884 | 85 | purple_debug_info("gg", "ggp_buddylist_send: adding %d\n", |
| 12007 | 86 | userlist[size - 1]); |
| 11414 | 87 | } |
| 88 | } | |
| 89 | } | |
| 90 | ||
| 91 | if (userlist) { | |
| 12007 | 92 | int ret = gg_notify_ex(info->session, userlist, types, size); |
| 11414 | 93 | g_free(userlist); |
| 94 | g_free(types); | |
| 95 | ||
| 15884 | 96 | purple_debug_info("gg", "send: ret=%d; size=%d\n", ret, size); |
| 11414 | 97 | } |
| 98 | } | |
| 99 | /* }}} */ | |
| 100 | ||
| 15884 | 101 | /* void ggp_buddylist_load(PurpleConnection *gc, char *buddylist) {{{ */ |
| 102 | void ggp_buddylist_load(PurpleConnection *gc, char *buddylist) | |
| 11414 | 103 | { |
| 15884 | 104 | PurpleBuddy *buddy; |
| 105 | PurpleGroup *group; | |
| 11414 | 106 | gchar **users_tbl; |
| 107 | int i; | |
|
24826
1ce0a7a3ab84
Validate Gadu-Gadu UID's and perform proper CP1250 to UTF-8 conversions when
Adam Strzelecki <ono@java.pl>
parents:
20199
diff
changeset
|
108 | char *utf8buddylist = charset_convert(buddylist, "CP1250", "UTF-8"); |
| 11414 | 109 | |
|
20199
f417c49285e9
applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
110 | /* Don't limit the number of records in a buddylist. */ |
|
24826
1ce0a7a3ab84
Validate Gadu-Gadu UID's and perform proper CP1250 to UTF-8 conversions when
Adam Strzelecki <ono@java.pl>
parents:
20199
diff
changeset
|
111 | users_tbl = g_strsplit(utf8buddylist, "\r\n", -1); |
| 11414 | 112 | |
| 113 | for (i = 0; users_tbl[i] != NULL; i++) { | |
| 114 | gchar **data_tbl; | |
| 115 | gchar *name, *show, *g; | |
| 116 | ||
| 117 | if (strlen(users_tbl[i]) == 0) | |
| 118 | continue; | |
| 119 | ||
| 120 | data_tbl = g_strsplit(users_tbl[i], ";", 8); | |
| 15288 | 121 | if (ggp_array_size(data_tbl) < 8) { |
| 15884 | 122 | purple_debug_warning("gg", |
| 15288 | 123 | "Something is wrong on line %d of the buddylist. Skipping.\n", |
| 124 | i + 1); | |
| 125 | continue; | |
| 126 | } | |
| 11414 | 127 | |
|
24826
1ce0a7a3ab84
Validate Gadu-Gadu UID's and perform proper CP1250 to UTF-8 conversions when
Adam Strzelecki <ono@java.pl>
parents:
20199
diff
changeset
|
128 | show = data_tbl[F_NICKNAME]; |
|
20199
f417c49285e9
applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
129 | name = data_tbl[F_UIN]; |
|
24826
1ce0a7a3ab84
Validate Gadu-Gadu UID's and perform proper CP1250 to UTF-8 conversions when
Adam Strzelecki <ono@java.pl>
parents:
20199
diff
changeset
|
130 | if ('\0' == *name || !atol(name)) { |
| 15884 | 131 | purple_debug_warning("gg", |
|
24826
1ce0a7a3ab84
Validate Gadu-Gadu UID's and perform proper CP1250 to UTF-8 conversions when
Adam Strzelecki <ono@java.pl>
parents:
20199
diff
changeset
|
132 | "Identifier on line %d of the buddylist is not a number. Skipping.\n", |
| 14925 | 133 | i + 1); |
| 134 | continue; | |
| 135 | } | |
| 136 | ||
| 15288 | 137 | if ('\0' == *show) { |
|
24826
1ce0a7a3ab84
Validate Gadu-Gadu UID's and perform proper CP1250 to UTF-8 conversions when
Adam Strzelecki <ono@java.pl>
parents:
20199
diff
changeset
|
138 | show = name; |
| 14925 | 139 | } |
| 11414 | 140 | |
|
20199
f417c49285e9
applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
141 | purple_debug_info("gg", "got buddy: name=%s; show=%s\n", name, show); |
| 11414 | 142 | |
| 15884 | 143 | if (purple_find_buddy(purple_connection_get_account(gc), name)) { |
| 11414 | 144 | g_strfreev(data_tbl); |
| 145 | continue; | |
| 146 | } | |
| 147 | ||
| 148 | g = g_strdup("Gadu-Gadu"); | |
| 149 | ||
|
20199
f417c49285e9
applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
150 | if ('\0' != data_tbl[F_GROUP]) { |
| 15288 | 151 | /* XXX: Probably buddy should be added to all the groups. */ |
| 11414 | 152 | /* Hard limit to at most 50 groups */ |
|
20199
f417c49285e9
applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
153 | gchar **group_tbl = g_strsplit(data_tbl[F_GROUP], ",", 50); |
| 15288 | 154 | if (ggp_array_size(group_tbl) > 0) { |
| 11414 | 155 | g_free(g); |
|
24826
1ce0a7a3ab84
Validate Gadu-Gadu UID's and perform proper CP1250 to UTF-8 conversions when
Adam Strzelecki <ono@java.pl>
parents:
20199
diff
changeset
|
156 | g = g_strdup(group_tbl[0]); |
| 11414 | 157 | } |
| 158 | g_strfreev(group_tbl); | |
| 159 | } | |
| 160 | ||
| 15884 | 161 | buddy = purple_buddy_new(purple_connection_get_account(gc), name, |
|
20199
f417c49285e9
applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
162 | strlen(show) ? show : NULL); |
| 12007 | 163 | |
| 15884 | 164 | if (!(group = purple_find_group(g))) { |
| 165 | group = purple_group_new(g); | |
| 166 | purple_blist_add_group(group, NULL); | |
| 11414 | 167 | } |
| 168 | ||
| 15884 | 169 | purple_blist_add_buddy(buddy, NULL, group, NULL); |
| 11414 | 170 | g_free(g); |
| 171 | ||
| 172 | g_strfreev(data_tbl); | |
| 173 | } | |
| 174 | g_strfreev(users_tbl); | |
|
24826
1ce0a7a3ab84
Validate Gadu-Gadu UID's and perform proper CP1250 to UTF-8 conversions when
Adam Strzelecki <ono@java.pl>
parents:
20199
diff
changeset
|
175 | g_free(utf8buddylist); |
| 11414 | 176 | |
| 177 | ggp_buddylist_send(gc); | |
| 178 | } | |
| 179 | /* }}} */ | |
| 180 | ||
| 15884 | 181 | /* void ggp_buddylist_offline(PurpleConnection *gc) {{{ */ |
| 182 | void ggp_buddylist_offline(PurpleConnection *gc) | |
| 11414 | 183 | { |
| 15884 | 184 | PurpleAccount *account = purple_connection_get_account(gc); |
| 185 | PurpleBlistNode *gnode, *cnode, *bnode; | |
| 186 | PurpleBuddy *buddy; | |
| 11414 | 187 | |
|
24939
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
188 | for (gnode = purple_blist_get_root(); |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
189 | gnode != NULL; |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
190 | gnode = purple_blist_node_get_sibling_next(gnode)) |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
191 | { |
| 15884 | 192 | if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) |
| 12007 | 193 | continue; |
| 194 | ||
|
24939
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
195 | for (cnode = purple_blist_node_get_first_child(gnode); |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
196 | cnode != NULL; |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
197 | cnode = purple_blist_node_get_sibling_next(cnode)) |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
198 | { |
| 15884 | 199 | if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) |
| 11414 | 200 | continue; |
| 12007 | 201 | |
|
24939
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
202 | for (bnode = purple_blist_node_get_first_child(cnode); |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
203 | bnode != NULL; |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
204 | bnode = purple_blist_node_get_sibling_next(bnode)) |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
205 | { |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
206 | const gchar *name = NULL; |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
207 | |
| 15884 | 208 | if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) |
| 11414 | 209 | continue; |
| 12007 | 210 | |
| 15884 | 211 | buddy = (PurpleBuddy *)bnode; |
|
24939
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
212 | |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
213 | name = purple_buddy_get_name(buddy); |
| 11414 | 214 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20199
diff
changeset
|
215 | if (purple_buddy_get_account(buddy) != account) |
| 12007 | 216 | continue; |
| 11414 | 217 | |
| 15884 | 218 | purple_prpl_got_user_status( |
|
24939
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
219 | account, name, "offline", NULL); |
| 11414 | 220 | |
| 15884 | 221 | purple_debug_info("gg", |
| 12007 | 222 | "ggp_buddylist_offline: gone: %s\n", |
|
24939
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
223 | name); |
| 11414 | 224 | } |
| 225 | } | |
| 226 | } | |
| 227 | } | |
| 228 | /* }}} */ | |
| 229 | ||
| 15884 | 230 | /* char *ggp_buddylist_dump(PurpleAccount *account) {{{ */ |
| 231 | char *ggp_buddylist_dump(PurpleAccount *account) | |
| 11414 | 232 | { |
| 15884 | 233 | PurpleBlistNode *gnode, *cnode, *bnode; |
| 234 | PurpleGroup *group; | |
| 235 | PurpleBuddy *buddy; | |
| 11414 | 236 | |
| 237 | char *buddylist = g_strdup(""); | |
| 238 | char *ptr; | |
| 239 | ||
|
24939
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
240 | for (gnode = purple_blist_get_root(); |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
241 | gnode != NULL; |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
242 | gnode = purple_blist_node_get_sibling_next(gnode)) |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
243 | { |
| 15884 | 244 | if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) |
| 11414 | 245 | continue; |
| 246 | ||
| 15884 | 247 | group = (PurpleGroup *)gnode; |
| 11414 | 248 | |
|
24939
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
249 | for (cnode = purple_blist_node_get_first_child(gnode); |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
250 | cnode != NULL; |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
251 | cnode = purple_blist_node_get_sibling_next(cnode)) |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
252 | { |
| 15884 | 253 | if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) |
| 11414 | 254 | continue; |
| 255 | ||
|
24939
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
256 | for (bnode = purple_blist_node_get_first_child(cnode); |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
257 | bnode != NULL; |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
258 | bnode = purple_blist_node_get_sibling_next(bnode)) |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
259 | { |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
260 | const gchar *name, *alias, *gname; |
| 11414 | 261 | |
| 15884 | 262 | if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) |
| 11414 | 263 | continue; |
| 264 | ||
| 15884 | 265 | buddy = (PurpleBuddy *)bnode; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20199
diff
changeset
|
266 | if (purple_buddy_get_account(buddy) != account) |
| 11414 | 267 | continue; |
| 268 | ||
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20199
diff
changeset
|
269 | name = purple_buddy_get_name(buddy); |
|
24939
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
270 | alias = purple_buddy_get_alias(buddy); |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
271 | if(alias == NULL) |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
272 | alias = name; |
|
d25fdf62ae92
moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents:
20199
diff
changeset
|
273 | gname = purple_group_get_name(group); |
| 11414 | 274 | |
|
24826
1ce0a7a3ab84
Validate Gadu-Gadu UID's and perform proper CP1250 to UTF-8 conversions when
Adam Strzelecki <ono@java.pl>
parents:
20199
diff
changeset
|
275 | ptr = buddylist; |
|
1ce0a7a3ab84
Validate Gadu-Gadu UID's and perform proper CP1250 to UTF-8 conversions when
Adam Strzelecki <ono@java.pl>
parents:
20199
diff
changeset
|
276 | buddylist = g_strdup_printf( |
|
1ce0a7a3ab84
Validate Gadu-Gadu UID's and perform proper CP1250 to UTF-8 conversions when
Adam Strzelecki <ono@java.pl>
parents:
20199
diff
changeset
|
277 | "%s%s;%s;%s;%s;%s;%s;%s;%s%s\r\n", |
|
1ce0a7a3ab84
Validate Gadu-Gadu UID's and perform proper CP1250 to UTF-8 conversions when
Adam Strzelecki <ono@java.pl>
parents:
20199
diff
changeset
|
278 | ptr, alias, alias, alias, alias, |
|
1ce0a7a3ab84
Validate Gadu-Gadu UID's and perform proper CP1250 to UTF-8 conversions when
Adam Strzelecki <ono@java.pl>
parents:
20199
diff
changeset
|
279 | "", gname, name, "", ""); |
| 11414 | 280 | |
| 281 | g_free(ptr); | |
| 282 | } | |
| 283 | } | |
| 284 | } | |
| 285 | ||
|
24826
1ce0a7a3ab84
Validate Gadu-Gadu UID's and perform proper CP1250 to UTF-8 conversions when
Adam Strzelecki <ono@java.pl>
parents:
20199
diff
changeset
|
286 | ptr = charset_convert(buddylist, "UTF-8", "CP1250"); |
|
1ce0a7a3ab84
Validate Gadu-Gadu UID's and perform proper CP1250 to UTF-8 conversions when
Adam Strzelecki <ono@java.pl>
parents:
20199
diff
changeset
|
287 | g_free(buddylist); |
|
1ce0a7a3ab84
Validate Gadu-Gadu UID's and perform proper CP1250 to UTF-8 conversions when
Adam Strzelecki <ono@java.pl>
parents:
20199
diff
changeset
|
288 | return ptr; |
| 11414 | 289 | } |
| 290 | /* }}} */ | |
| 291 | ||
| 292 | ||
|
25001
0287f26284ad
Add a newline to the end of the file.
Richard Laager <rlaager@pidgin.im>
parents:
25000
diff
changeset
|
293 | /* vim: set ts=8 sts=0 sw=8 noet: */ |