annotate libpurple/protocols/gg/buddylist.c @ 29947:7be0dbc00168

Add purple_marshal_POINTER__POINTER(), which sadrul says should be used for the patch attached to #4598. Refs #4598.
author John Bailey <rekkanoryo@rekkanoryo.org>
date Sun, 07 Mar 2010 01:27:02 +0000
parents 818f2845ab47
children a8cc50c2279f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15374
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 buddylist.c
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
4 * purple
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 * Copyright (C) 2005 Bartosz Oler <bartosz@bzimage.us>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * 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
9 * 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
10 * 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
11 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * 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
14 * 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
15 * 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
16 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * 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
19 * along with this program; if not, write to the Free Software
19680
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 15823
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22
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 #include <libgadu.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 #include "gg.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 #include "gg-utils.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 #include "buddylist.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29
20307
d30ea407576e applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents: 19680
diff changeset
30 #define F_FIRSTNAME 0
d30ea407576e applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents: 19680
diff changeset
31 #define F_LASTNAME 1
d30ea407576e applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents: 19680
diff changeset
32 /* #define F_ 2 */
d30ea407576e applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents: 19680
diff changeset
33 #define F_NICKNAME 3
d30ea407576e applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents: 19680
diff changeset
34 #define F_PHONE 4
d30ea407576e applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents: 19680
diff changeset
35 #define F_GROUP 5
d30ea407576e applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents: 19680
diff changeset
36 #define F_UIN 6
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
38 /* void ggp_buddylist_send(PurpleConnection *gc) {{{ */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
39 void ggp_buddylist_send(PurpleConnection *gc)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 GGPInfo *info = gc->proto_data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
42 PurpleAccount *account = purple_connection_get_account(gc);
27076
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
43 GSList *buddies;
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
44 uin_t *userlist;
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
45 gchar *types;
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
46 int i = 0, ret = 0;
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
47 int size;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48
27076
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
49 buddies = purple_find_buddies(account, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50
27076
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
51 size = g_slist_length(buddies);
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
52 userlist = g_new(uin_t, size);
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
53 types = g_new(gchar, size);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54
27076
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
55 for (buddies = purple_find_buddies(account, NULL); buddies;
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
56 buddies = g_slist_delete_link(buddies, buddies), ++i)
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
57 {
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
58 PurpleBuddy *buddy = buddies->data;
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
59 const gchar *name = purple_buddy_get_name(buddy);
25283
4d20fa86455b moved gg to use the api rather than structs directly
Gary Kramlich <grim@reaperworld.com>
parents: 20307
diff changeset
60
27076
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
61 userlist[i] = ggp_str_to_uin(name);
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
62 types[i] = GG_USER_NORMAL;
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
63 purple_debug_info("gg", "ggp_buddylist_send: adding %d\n",
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
64 userlist[i]);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66
24817
c9c4b31d98a7 Fix a connection timeout that occurs with empty Gadu-Gadu buddy lists.
Martin Rosinski <martin@zone-mr.net>
parents: 24506
diff changeset
67 ret = gg_notify_ex(info->session, userlist, types, size);
c9c4b31d98a7 Fix a connection timeout that occurs with empty Gadu-Gadu buddy lists.
Martin Rosinski <martin@zone-mr.net>
parents: 24506
diff changeset
68 purple_debug_info("gg", "send: ret=%d; size=%d\n", ret, size);
27076
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
69
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70 if (userlist) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 g_free(userlist);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72 g_free(types);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75 /* }}} */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
77 /* void ggp_buddylist_load(PurpleConnection *gc, char *buddylist) {{{ */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
78 void ggp_buddylist_load(PurpleConnection *gc, char *buddylist)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
80 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
81 PurpleGroup *group;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 gchar **users_tbl;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 int i;
24506
0b2a1b6f7464 Validate Gadu-Gadu UID's and perform proper CP1250 to UTF-8 conversions when
Adam Strzelecki <ono@java.pl>
parents: 20307
diff changeset
84 char *utf8buddylist = charset_convert(buddylist, "CP1250", "UTF-8");
29944
818f2845ab47 Finish making libgadu compile on Windows. Fixes #10542 finally!
kkszysiu@gmail.com
parents: 27076
diff changeset
85
20307
d30ea407576e applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents: 19680
diff changeset
86 /* Don't limit the number of records in a buddylist. */
24506
0b2a1b6f7464 Validate Gadu-Gadu UID's and perform proper CP1250 to UTF-8 conversions when
Adam Strzelecki <ono@java.pl>
parents: 20307
diff changeset
87 users_tbl = g_strsplit(utf8buddylist, "\r\n", -1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89 for (i = 0; users_tbl[i] != NULL; i++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 gchar **data_tbl;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 gchar *name, *show, *g;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 if (strlen(users_tbl[i]) == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96 data_tbl = g_strsplit(users_tbl[i], ";", 8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 if (ggp_array_size(data_tbl) < 8) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
98 purple_debug_warning("gg",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 "Something is wrong on line %d of the buddylist. Skipping.\n",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100 i + 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103
24506
0b2a1b6f7464 Validate Gadu-Gadu UID's and perform proper CP1250 to UTF-8 conversions when
Adam Strzelecki <ono@java.pl>
parents: 20307
diff changeset
104 show = data_tbl[F_NICKNAME];
20307
d30ea407576e applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents: 19680
diff changeset
105 name = data_tbl[F_UIN];
24506
0b2a1b6f7464 Validate Gadu-Gadu UID's and perform proper CP1250 to UTF-8 conversions when
Adam Strzelecki <ono@java.pl>
parents: 20307
diff changeset
106 if ('\0' == *name || !atol(name)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
107 purple_debug_warning("gg",
24506
0b2a1b6f7464 Validate Gadu-Gadu UID's and perform proper CP1250 to UTF-8 conversions when
Adam Strzelecki <ono@java.pl>
parents: 20307
diff changeset
108 "Identifier on line %d of the buddylist is not a number. Skipping.\n",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 i + 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 if ('\0' == *show) {
24506
0b2a1b6f7464 Validate Gadu-Gadu UID's and perform proper CP1250 to UTF-8 conversions when
Adam Strzelecki <ono@java.pl>
parents: 20307
diff changeset
114 show = name;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116
20307
d30ea407576e applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents: 19680
diff changeset
117 purple_debug_info("gg", "got buddy: name=%s; show=%s\n", name, show);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
119 if (purple_find_buddy(purple_connection_get_account(gc), name)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 g_strfreev(data_tbl);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 g = g_strdup("Gadu-Gadu");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125
20307
d30ea407576e applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents: 19680
diff changeset
126 if ('\0' != data_tbl[F_GROUP]) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127 /* XXX: Probably buddy should be added to all the groups. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 /* Hard limit to at most 50 groups */
20307
d30ea407576e applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents: 19680
diff changeset
129 gchar **group_tbl = g_strsplit(data_tbl[F_GROUP], ",", 50);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 if (ggp_array_size(group_tbl) > 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 g_free(g);
24506
0b2a1b6f7464 Validate Gadu-Gadu UID's and perform proper CP1250 to UTF-8 conversions when
Adam Strzelecki <ono@java.pl>
parents: 20307
diff changeset
132 g = g_strdup(group_tbl[0]);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 g_strfreev(group_tbl);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
137 buddy = purple_buddy_new(purple_connection_get_account(gc), name,
20307
d30ea407576e applied changes from 45b8a011cd84e0e69d7ac5a6fb84f55cdb0809cb
Luke Schierer <lschiere@pidgin.im>
parents: 19680
diff changeset
138 strlen(show) ? show : NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
140 if (!(group = purple_find_group(g))) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
141 group = purple_group_new(g);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
142 purple_blist_add_group(group, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
145 purple_blist_add_buddy(buddy, NULL, group, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146 g_free(g);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
147
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 g_strfreev(data_tbl);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150 g_strfreev(users_tbl);
24506
0b2a1b6f7464 Validate Gadu-Gadu UID's and perform proper CP1250 to UTF-8 conversions when
Adam Strzelecki <ono@java.pl>
parents: 20307
diff changeset
151 g_free(utf8buddylist);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 ggp_buddylist_send(gc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155 /* }}} */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
157 /* char *ggp_buddylist_dump(PurpleAccount *account) {{{ */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
158 char *ggp_buddylist_dump(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159 {
27076
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
160 GSList *buddies;
25381
43b721aa4b76 explicit merge of '32d4ce0b6cfc9ccb9a6e7ed661423b9260a0bead'
Richard Laager <rlaager@wiktel.com>
parents: 25345 24825
diff changeset
161 GString *buddylist = g_string_sized_new(1024);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162 char *ptr;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163
27076
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
164 for (buddies = purple_find_buddies(account, NULL); buddies;
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
165 buddies = g_slist_delete_link(buddies, buddies)) {
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
166 PurpleBuddy *buddy = buddies->data;
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
167 PurpleGroup *group = purple_buddy_get_group(buddy);
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
168 const char *bname = purple_buddy_get_name(buddy);
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
169 const char *gname = purple_group_get_name(group);
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
170 const char *alias = purple_buddy_get_alias(buddy);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171
27076
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
172 if (alias == NULL)
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
173 alias = bname;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174
27076
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
175 g_string_append_printf(buddylist,
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
176 "%s;%s;%s;%s;%s;%s;%s;%s%s\r\n",
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
177 alias, alias, alias, alias,
1fcd09c34fee Use purple_find_buddies() instead of iterating the buddy list.
Paul Aurich <paul@darkrain42.org>
parents: 27074
diff changeset
178 "", gname, bname, "", "");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180
24825
5d693af3e9e2 Fix a leak "KuSh" discovered using "cppcheck". Fixes #7858. Also, make the relevant code less of a horrible abomination.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24817
diff changeset
181 ptr = charset_convert(buddylist->str, "UTF-8", "CP1250");
5d693af3e9e2 Fix a leak "KuSh" discovered using "cppcheck". Fixes #7858. Also, make the relevant code less of a horrible abomination.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24817
diff changeset
182 g_string_free(buddylist, TRUE);
24506
0b2a1b6f7464 Validate Gadu-Gadu UID's and perform proper CP1250 to UTF-8 conversions when
Adam Strzelecki <ono@java.pl>
parents: 20307
diff changeset
183 return ptr;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 /* }}} */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 /* vim: set ts=8 sts=0 sw=8 noet: */