Mercurial > pidgin.yaz
annotate src/protocols/gg/gg.c @ 9953:d908907d9441
[gaim-migrate @ 10849]
grim | patch -p0 && cvs commit
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sun, 05 Sep 2004 06:29:51 +0000 |
parents | ba085944efee |
children | c124bef68132 |
rev | line source |
---|---|
2393 | 1 /* |
2 * gaim - Gadu-Gadu Protocol Plugin | |
9953 | 3 * $Id: gg.c 10849 2004-09-05 06:29:51Z faceprint $ |
2393 | 4 * |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
5 * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL> |
6787
faa491042c66
[gaim-migrate @ 7326]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
6 * |
2393 | 7 * This program is free software; you can redistribute it and/or modify |
8 * it under the terms of the GNU General Public License as published by | |
9 * the Free Software Foundation; either version 2 of the License, or | |
10 * (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 * GNU General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program; if not, write to the Free Software | |
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
20 * | |
21 */ | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
22 #include "internal.h" |
2393 | 23 |
24 /* Library from EKG (Eksperymentalny Klient Gadu-Gadu) */ | |
25 #include "libgg.h" | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
26 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
27 #include "account.h" |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5618
diff
changeset
|
28 #include "accountopt.h" |
9030 | 29 #include "blist.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
30 #include "debug.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
31 #include "notify.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
32 #include "proxy.h" |
2393 | 33 #include "prpl.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
34 #include "server.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
35 #include "util.h" |
9943 | 36 #include "version.h" |
2393 | 37 |
5603 | 38 #define GG_CONNECT_STEPS 5 |
39 | |
2393 | 40 #define AGG_BUF_LEN 1024 |
41 | |
42 #define AGG_GENDER_NONE -1 | |
43 | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
44 #define AGG_PUBDIR_USERLIST_EXPORT_FORM "/appsvc/fmcontactsput.asp" |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
45 #define AGG_PUBDIR_USERLIST_IMPORT_FORM "/appsvc/fmcontactsget.asp" |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
46 #define AGG_PUBDIR_SEARCH_FORM "/appsvc/fmpubquery2.asp" |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
47 #define AGG_REGISTER_DATA_FORM "/appsvc/fmregister.asp" |
2393 | 48 #define AGG_PUBDIR_MAX_ENTRIES 200 |
49 | |
50 #define AGG_STATUS_AVAIL _("Available") | |
51 #define AGG_STATUS_AVAIL_FRIENDS _("Available for friends only") | |
52 #define AGG_STATUS_BUSY _("Away") | |
53 #define AGG_STATUS_BUSY_FRIENDS _("Away for friends only") | |
54 #define AGG_STATUS_INVISIBLE _("Invisible") | |
55 #define AGG_STATUS_INVISIBLE_FRIENDS _("Invisible for friends only") | |
56 #define AGG_STATUS_NOT_AVAIL _("Unavailable") | |
57 | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
58 #define AGG_HTTP_NONE 0 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
59 #define AGG_HTTP_SEARCH 1 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
60 #define AGG_HTTP_USERLIST_IMPORT 2 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
61 #define AGG_HTTP_USERLIST_EXPORT 3 |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
62 #define AGG_HTTP_USERLIST_DELETE 4 |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
63 #define AGG_HTTP_PASSWORD_CHANGE 5 |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
64 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2423
diff
changeset
|
65 #define UC_NORMAL 2 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2423
diff
changeset
|
66 |
2393 | 67 struct agg_data { |
68 struct gg_session *sess; | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
69 int own_status; |
2393 | 70 }; |
71 | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
72 struct agg_http { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
73 GaimConnection *gc; |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
74 gchar *request; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
75 gchar *form; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
76 gchar *host; |
2393 | 77 int inpa; |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
78 int type; |
2393 | 79 }; |
80 | |
81 | |
3466 | 82 static gchar *charset_convert(const gchar *locstr, const char *encsrc, const char *encdst) |
2393 | 83 { |
4051 | 84 return (g_convert (locstr, strlen (locstr), encdst, encsrc, NULL, NULL, NULL)); |
2393 | 85 } |
86 | |
3466 | 87 static gboolean invalid_uin(const char *uin) |
2393 | 88 { |
89 unsigned long int res = strtol(uin, (char **)NULL, 10); | |
7631 | 90 if (res == ULONG_MAX || res == 0) |
2393 | 91 return TRUE; |
92 return FALSE; | |
93 } | |
94 | |
95 static gint args_compare(gconstpointer a, gconstpointer b) | |
96 { | |
4793 | 97 return g_ascii_strcasecmp((const gchar *)a,(const gchar *)b); |
2393 | 98 } |
99 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
100 static gboolean allowed_uin(GaimConnection *gc, char *uin) |
2393 | 101 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
102 GaimAccount *account = gaim_connection_get_account(gc); |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
103 |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
104 switch (account->perm_deny) { |
2393 | 105 case 1: |
106 /* permit all, deny none */ | |
107 return TRUE; | |
108 break; | |
109 case 2: | |
110 /* deny all, permit none. */ | |
111 return FALSE; | |
112 break; | |
113 case 3: | |
114 /* permit some. */ | |
4491 | 115 if (g_slist_find_custom(gc->account->permit, uin, args_compare)) |
2393 | 116 return TRUE; |
117 return FALSE; | |
118 break; | |
119 case 4: | |
120 /* deny some. */ | |
4491 | 121 if (g_slist_find_custom(gc->account->deny, uin, args_compare)) |
2393 | 122 return FALSE; |
123 return TRUE; | |
124 break; | |
125 default: | |
126 return TRUE; | |
127 break; | |
128 } | |
129 } | |
130 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
131 static char *handle_errcode(GaimConnection *gc, int errcode) |
2393 | 132 { |
133 static char msg[AGG_BUF_LEN]; | |
134 | |
135 switch (errcode) { | |
136 case GG_FAILURE_RESOLVING: | |
137 g_snprintf(msg, sizeof(msg), _("Unable to resolve hostname.")); | |
138 break; | |
139 case GG_FAILURE_CONNECTING: | |
140 g_snprintf(msg, sizeof(msg), _("Unable to connect to server.")); | |
141 break; | |
142 case GG_FAILURE_INVALID: | |
143 g_snprintf(msg, sizeof(msg), _("Invalid response from server.")); | |
144 break; | |
145 case GG_FAILURE_READING: | |
146 g_snprintf(msg, sizeof(msg), _("Error while reading from socket.")); | |
147 break; | |
148 case GG_FAILURE_WRITING: | |
3100 | 149 g_snprintf(msg, sizeof(msg), _("Error while writing to socket.")); |
2393 | 150 break; |
151 case GG_FAILURE_PASSWORD: | |
3100 | 152 g_snprintf(msg, sizeof(msg), _("Authentication failed.")); |
2393 | 153 break; |
154 default: | |
155 g_snprintf(msg, sizeof(msg), _("Unknown Error Code.")); | |
156 break; | |
157 } | |
158 | |
5603 | 159 gaim_connection_error(gc, msg); |
2393 | 160 |
161 return msg; | |
162 } | |
163 | |
9950 | 164 static void agg_set_status(GaimAccount *account, GaimStatus *status) |
2393 | 165 { |
9950 | 166 GaimConnection *gc = gaim_account_get_connection(account); |
2393 | 167 struct agg_data *gd = (struct agg_data *)gc->proto_data; |
9950 | 168 int status_num = gd->own_status; |
169 const char *status_id; | |
170 char *msg = NULL; | |
171 | |
172 status_id = gaim_status_get_id(status); | |
173 | |
174 if (!strcmp(status_id, "available")) | |
175 status_num = GG_STATUS_AVAIL; | |
176 else if (!strcmp(status_id, "available-friends")) | |
177 status_num = GG_STATUS_AVAIL | GG_STATUS_FRIENDS_MASK; | |
178 else if (!strcmp(status_id, "away")) | |
179 status_num = GG_STATUS_BUSY; | |
180 else if (!strcmp(status_id, "away-friends")) | |
181 status_num = GG_STATUS_BUSY | GG_STATUS_FRIENDS_MASK; | |
182 else if (!strcmp(status_id, "invisible")) | |
183 status_num = GG_STATUS_INVISIBLE; | |
184 else if (!strcmp(status_id, "invisible-friends")) | |
185 status_num = GG_STATUS_INVISIBLE | GG_STATUS_FRIENDS_MASK; | |
186 else if (!strcmp(status_id, "unavailable")) | |
187 status_num = GG_STATUS_NOT_AVAIL; | |
188 else | |
189 g_assert_not_reached(); | |
2393 | 190 |
9950 | 191 /* XXX: this was added between the status_rewrite and now and needs to be fixed */ |
9415 | 192 if (msg) { |
9950 | 193 switch (status_num) { |
9415 | 194 case GG_STATUS_AVAIL: |
9950 | 195 status_num = GG_STATUS_AVAIL_DESCR; |
9415 | 196 break; |
197 case GG_STATUS_BUSY: | |
9950 | 198 status_num = GG_STATUS_BUSY_DESCR; |
9415 | 199 break; |
200 case GG_STATUS_INVISIBLE: | |
9950 | 201 status_num = GG_STATUS_INVISIBLE_DESCR; |
9415 | 202 break; |
203 case GG_STATUS_NOT_AVAIL: | |
9950 | 204 status_num = GG_STATUS_NOT_AVAIL_DESCR; |
9415 | 205 break; |
206 } | |
207 } | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
208 |
9950 | 209 gd->own_status = status_num; |
210 | |
9415 | 211 if (msg) |
9950 | 212 gg_change_status_descr(gd->sess, status_num, msg); |
9415 | 213 else |
9950 | 214 gg_change_status(gd->sess, status_num); |
9415 | 215 } |
216 | |
9950 | 217 |
9421 | 218 #if 0 |
9415 | 219 static void agg_get_away(GaimConnection *gc, const char *who) |
220 { | |
221 GaimBuddy *buddy; | |
222 char *dialog_msg, **splitmsg; | |
223 | |
224 if (invalid_uin(who)) | |
9421 | 225 return; |
9415 | 226 |
227 buddy = gaim_find_buddy(gaim_connection_get_account(gc), who); | |
228 if (buddy->proto_data) { | |
9421 | 229 /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */ |
230 splitmsg = g_strsplit(buddy->proto_data, "\r\n", 0); | |
9415 | 231 |
9421 | 232 dialog_msg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<HR>%s"), who, (char *)buddy->proto_data, g_strjoinv("<BR>", splitmsg)); |
9797 | 233 gaim_notify_userinfo(gc, who, NULL, _("Buddy Information"), buddy->proto_data, dialog_msg, NULL, NULL); |
9415 | 234 } |
2393 | 235 } |
9421 | 236 #endif |
2393 | 237 |
9950 | 238 static gchar *get_away_text(GaimBuddy *buddy) |
2393 | 239 { |
9950 | 240 GaimPresence *presence = gaim_buddy_get_presence(buddy); |
241 | |
242 if (gaim_presence_is_status_active(presence, "available")) | |
2393 | 243 return AGG_STATUS_AVAIL; |
9950 | 244 else if (gaim_presence_is_status_active(presence, "available-friends")) |
2393 | 245 return AGG_STATUS_AVAIL_FRIENDS; |
9950 | 246 else if (gaim_presence_is_status_active(presence, "away")) |
2393 | 247 return AGG_STATUS_BUSY; |
9950 | 248 else if (gaim_presence_is_status_active(presence, "away-friends")) |
2393 | 249 return AGG_STATUS_BUSY_FRIENDS; |
9950 | 250 else if (gaim_presence_is_status_active(presence, "invisible")) |
251 return AGG_STATUS_INVISIBLE; | |
252 else if (gaim_presence_is_status_active(presence, "invisible-friends")) | |
253 return AGG_STATUS_INVISIBLE_FRIENDS; | |
254 else if (gaim_presence_is_status_active(presence, "unavailable")) | |
2393 | 255 return AGG_STATUS_NOT_AVAIL; |
9950 | 256 |
257 return AGG_STATUS_AVAIL; | |
2393 | 258 } |
259 | |
9950 | 260 |
261 static GList *agg_status_types(GaimAccount *account) | |
2393 | 262 { |
9950 | 263 GaimStatusType *type; |
264 GList *types = NULL; | |
265 | |
266 type = gaim_status_type_new(GAIM_STATUS_OFFLINE, "offline", | |
267 _("Offline"), FALSE); | |
268 types = g_list_append(types, type); | |
269 | |
270 type = gaim_status_type_new(GAIM_STATUS_ONLINE, "online", | |
271 _("Online"), FALSE); | |
272 types = g_list_append(types, type); | |
273 | |
274 type = gaim_status_type_new_with_attrs( | |
275 GAIM_STATUS_AVAILABLE, "available", AGG_STATUS_AVAIL, | |
276 TRUE, TRUE, FALSE, | |
277 "message", _("Message"), gaim_value_new(GAIM_TYPE_STRING)); | |
278 types = g_list_append(types, type); | |
279 | |
280 type = gaim_status_type_new_with_attrs( | |
281 GAIM_STATUS_AWAY, "away", AGG_STATUS_BUSY, | |
282 TRUE, TRUE, FALSE, | |
283 "message", _("Message"), gaim_value_new(GAIM_TYPE_STRING)); | |
284 types = g_list_append(types, type); | |
2393 | 285 |
9950 | 286 type = gaim_status_type_new_with_attrs( |
287 GAIM_STATUS_HIDDEN, "invisible", AGG_STATUS_INVISIBLE, | |
288 TRUE, TRUE, FALSE, | |
289 "message", _("Message"), gaim_value_new(GAIM_TYPE_STRING)); | |
290 types = g_list_append(types, type); | |
291 | |
292 type = gaim_status_type_new_with_attrs( | |
293 GAIM_STATUS_AVAILABLE, "available-friends", AGG_STATUS_AVAIL_FRIENDS, | |
294 TRUE, TRUE, FALSE, | |
295 "message", _("Message"), gaim_value_new(GAIM_TYPE_STRING)); | |
296 types = g_list_append(types, type); | |
297 | |
298 type = gaim_status_type_new_with_attrs( | |
299 GAIM_STATUS_AWAY, "away-friends", AGG_STATUS_BUSY_FRIENDS, | |
300 TRUE, TRUE, FALSE, | |
301 "message", _("Message"), gaim_value_new(GAIM_TYPE_STRING)); | |
302 types = g_list_append(types, type); | |
303 | |
304 type = gaim_status_type_new_with_attrs( | |
305 GAIM_STATUS_HIDDEN, "invisible-friends", AGG_STATUS_INVISIBLE, | |
306 TRUE, TRUE, FALSE, | |
307 "message", _("Message"), gaim_value_new(GAIM_TYPE_STRING)); | |
308 types = g_list_append(types, type); | |
309 | |
310 type = gaim_status_type_new_with_attrs( | |
311 GAIM_STATUS_UNAVAILABLE, "unavailable", AGG_STATUS_NOT_AVAIL, | |
312 TRUE, TRUE, FALSE, | |
313 "message", _("Message"), gaim_value_new(GAIM_TYPE_STRING)); | |
314 types = g_list_append(types, type); | |
315 | |
316 return types; | |
2393 | 317 } |
318 | |
319 /* Enhance these functions, more options and such stuff */ | |
9030 | 320 static GList *agg_buddy_menu(GaimBuddy *buddy) |
2393 | 321 { |
322 GList *m = NULL; | |
9030 | 323 GaimBlistNodeAction *act; |
324 | |
2393 | 325 static char buf[AGG_BUF_LEN]; |
9950 | 326 g_snprintf(buf, sizeof(buf), _("Status: %s"), get_away_text(buddy)); |
2393 | 327 |
9030 | 328 /* um... this seems silly. since in this pass, I'm only converting |
329 over the menu building, I'm not going to mess with it though */ | |
330 /* XXX: shouldn't this be in the tooltip instead? */ | |
331 act = gaim_blist_node_action_new(buf, NULL, NULL); | |
332 m = g_list_append(m, act); | |
2393 | 333 |
334 return m; | |
335 } | |
336 | |
9030 | 337 |
338 static GList * | |
339 agg_blist_node_menu(GaimBlistNode *node) | |
340 { | |
341 if(GAIM_BLIST_NODE_IS_BUDDY(node)) { | |
342 return agg_buddy_menu((GaimBuddy *) node); | |
343 } else { | |
344 return NULL; | |
345 } | |
346 } | |
347 | |
348 | |
8775 | 349 static void agg_load_buddy_list(GaimConnection *gc, char *buddylist) |
350 { | |
351 struct agg_data *gd = (struct agg_data *)gc->proto_data; | |
352 gchar *ptr = buddylist; | |
353 gchar **users_tbl; | |
354 int i; | |
355 uin_t *userlist = NULL; | |
356 int userlist_size = 0; | |
357 | |
358 users_tbl = g_strsplit(ptr, "\r\n", AGG_PUBDIR_MAX_ENTRIES); | |
359 | |
360 /* Parse array of Buddies List */ | |
361 for (i = 0; users_tbl[i] != NULL; i++) { | |
362 gchar **data_tbl; | |
363 gchar *name, *show; | |
364 | |
365 if (strlen(users_tbl[i])==0) { | |
366 gaim_debug(GAIM_DEBUG_MISC, "gg", | |
367 "import_buddies_server_results: users_tbl[i] is empty\n"); | |
368 continue; | |
369 } | |
370 | |
371 data_tbl = g_strsplit(users_tbl[i], ";", 8); | |
372 | |
373 show = charset_convert(data_tbl[3], "CP1250", "UTF-8"); | |
374 name = data_tbl[6]; | |
8996 | 375 |
8775 | 376 if (invalid_uin(name)) { |
377 continue; | |
378 } | |
379 | |
380 gaim_debug(GAIM_DEBUG_MISC, "gg", | |
381 "import_buddies_server_results: uin: %s\n", name); | |
382 if (!gaim_find_buddy(gc->account, name)) { | |
383 GaimBuddy *b; | |
384 GaimGroup *g; | |
385 /* Default group if none specified on server */ | |
386 gchar *group = g_strdup("Gadu-Gadu"); | |
387 if (strlen(data_tbl[5])) { | |
388 gchar **group_tbl = g_strsplit(data_tbl[5], ",", 2); | |
389 if (strlen(group_tbl[0])) { | |
390 g_free(group); | |
391 group = g_strdup(group_tbl[0]); | |
392 } | |
393 g_strfreev(group_tbl); | |
394 } | |
395 /* Add Buddy to our userlist */ | |
396 if (!(g = gaim_find_group(group))) { | |
397 g = gaim_group_new(group); | |
398 gaim_blist_add_group(g, NULL); | |
399 } | |
400 b = gaim_buddy_new(gc->account, name, strlen(show) ? show : NULL); | |
401 gaim_blist_add_buddy(b,NULL,g,NULL); | |
8996 | 402 |
8775 | 403 userlist_size++; |
404 userlist = g_renew(uin_t, userlist, userlist_size); | |
405 userlist[userlist_size - 1] = | |
406 (uin_t) strtol((char *)name, (char **)NULL, 10); | |
8996 | 407 |
8775 | 408 g_free(group); |
409 } | |
410 g_free(show); | |
411 g_strfreev(data_tbl); | |
412 } | |
413 g_strfreev(users_tbl); | |
8996 | 414 |
8775 | 415 if (userlist) { |
416 gg_notify(gd->sess, userlist, userlist_size); | |
417 g_free(userlist); | |
418 } | |
419 } | |
420 | |
9285 | 421 static void agg_save_buddy_list(GaimConnection *gc, char *existlist) |
8775 | 422 { |
9285 | 423 struct agg_data *gd = (struct agg_data *)gc->proto_data; |
8775 | 424 GaimBlistNode *gnode, *cnode, *bnode; |
425 char *buddylist = g_strdup(existlist ? existlist : ""); | |
426 char *ptr; | |
427 | |
428 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { | |
429 GaimGroup *g = (GaimGroup *)gnode; | |
430 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
431 continue; | |
432 for(cnode = gnode->child; cnode; cnode = cnode->next) { | |
433 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
434 continue; | |
435 for(bnode = cnode->child; bnode; bnode = bnode->next) { | |
436 GaimBuddy *b = (GaimBuddy *)bnode; | |
437 | |
438 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
439 continue; | |
440 | |
441 if(b->account == gc->account) { | |
442 gchar *newdata; | |
443 /* GG Number */ | |
444 gchar *name = b->name; | |
445 /* GG Pseudo */ | |
446 gchar *show = b->alias ? b->alias : b->name; | |
447 /* Group Name */ | |
448 gchar *gname = g->name; | |
449 | |
450 newdata = g_strdup_printf("%s;%s;%s;%s;%s;%s;%s;%s%s\r\n", | |
451 show, show, show, show, "", gname, name, "", ""); | |
8996 | 452 |
8775 | 453 ptr = buddylist; |
454 buddylist = g_strconcat(ptr, newdata, NULL); | |
8996 | 455 |
8775 | 456 g_free(newdata); |
457 g_free(ptr); | |
458 } | |
459 } | |
460 } | |
461 } | |
8996 | 462 |
8775 | 463 /* save the list to the gadu gadu server */ |
464 gg_userlist_request(gd->sess, GG_USERLIST_PUT, buddylist); | |
465 } | |
466 | |
2393 | 467 static void main_callback(gpointer data, gint source, GaimInputCondition cond) |
468 { | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
469 GaimConnection *gc = data; |
9944 | 470 GaimAccount *account = gaim_connection_get_account(gc); |
2393 | 471 struct agg_data *gd = gc->proto_data; |
472 struct gg_event *e; | |
473 | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
474 gaim_debug(GAIM_DEBUG_INFO, "gg", "main_callback enter: begin\n"); |
2393 | 475 |
476 if (gd->sess->fd != source) | |
477 gd->sess->fd = source; | |
478 | |
4511 | 479 if (source == 0) { |
5603 | 480 gaim_connection_error(gc, _("Could not connect")); |
2393 | 481 return; |
482 } | |
483 | |
484 if (!(e = gg_watch_fd(gd->sess))) { | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
485 gaim_debug(GAIM_DEBUG_ERROR, "gg", |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
486 "main_callback: gg_watch_fd failed - CRITICAL!\n"); |
5603 | 487 gaim_connection_error(gc, _("Unable to read socket")); |
2393 | 488 return; |
489 } | |
490 | |
491 switch (e->type) { | |
492 case GG_EVENT_NONE: | |
493 /* do nothing */ | |
494 break; | |
495 case GG_EVENT_CONN_SUCCESS: | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
496 gaim_debug(GAIM_DEBUG_WARNING, "gg", |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
497 "main_callback: CONNECTED AGAIN!?\n"); |
2393 | 498 break; |
499 case GG_EVENT_CONN_FAILED: | |
500 if (gc->inpa) | |
501 gaim_input_remove(gc->inpa); | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
502 handle_errcode(gc, e->event.failure); |
2393 | 503 break; |
504 case GG_EVENT_MSG: | |
505 { | |
506 gchar *imsg; | |
8442 | 507 gchar *jmsg; |
2393 | 508 gchar user[20]; |
509 | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
510 g_snprintf(user, sizeof(user), "%lu", e->event.msg.sender); |
2393 | 511 if (!allowed_uin(gc, user)) |
512 break; | |
4051 | 513 imsg = charset_convert(e->event.msg.message, "CP1250", "UTF-8"); |
7478
3c21f3084ff0
[gaim-migrate @ 8091]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7386
diff
changeset
|
514 gaim_str_strip_cr(imsg); |
8442 | 515 jmsg = gaim_escape_html(imsg); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
516 /* e->event.msg.time - we don't know what this time is for */ |
8442 | 517 serv_got_im(gc, user, jmsg, 0, time(NULL)); |
2393 | 518 g_free(imsg); |
8442 | 519 g_free(jmsg); |
2393 | 520 } |
521 break; | |
522 case GG_EVENT_NOTIFY: | |
523 { | |
524 gchar user[20]; | |
525 struct gg_notify_reply *n = e->event.notify; | |
9950 | 526 const char *status_id; |
2393 | 527 |
528 while (n->uin) { | |
529 switch (n->status) { | |
9950 | 530 case GG_STATUS_NOT_AVAIL: |
531 status_id = "unavailable"; | |
532 break; | |
533 | |
534 case GG_STATUS_AVAIL: | |
535 status_id = "available"; | |
536 break; | |
537 | |
538 case GG_STATUS_BUSY: | |
539 status_id = "away"; | |
540 break; | |
541 | |
542 case GG_STATUS_INVISIBLE: | |
543 status_id = "invisible"; | |
544 break; | |
545 | |
546 default: | |
547 status_id = "available"; | |
548 break; | |
549 | |
2393 | 550 } |
551 | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
552 g_snprintf(user, sizeof(user), "%lu", n->uin); |
9950 | 553 gaim_prpl_got_user_status(account, user, status_id, NULL); |
2393 | 554 n++; |
555 } | |
556 } | |
557 break; | |
8775 | 558 case GG_EVENT_NOTIFY60: |
559 { | |
560 gchar user[20]; | |
9950 | 561 const char *status_id; |
9415 | 562 guint i = 0; |
563 | |
564 for (i = 0; e->event.notify60[i].uin; i++) { | |
565 GaimBuddy *buddy; | |
566 | |
567 g_snprintf(user, sizeof(user), "%lu", (long unsigned int)e->event.notify60[i].uin); | |
8775 | 568 |
9415 | 569 buddy = gaim_find_buddy(gaim_connection_get_account(gc), user); |
570 if (buddy && buddy->proto_data != NULL) { | |
571 g_free(buddy->proto_data); | |
572 buddy->proto_data = NULL; | |
573 } | |
574 | |
575 switch (e->event.notify60[i].status) { | |
9950 | 576 case GG_STATUS_NOT_AVAIL: |
577 case GG_STATUS_NOT_AVAIL_DESCR: | |
578 status_id = "unavailable"; | |
579 break; | |
580 | |
581 case GG_STATUS_AVAIL: | |
582 case GG_STATUS_AVAIL_DESCR: | |
583 status_id = "available"; | |
584 break; | |
585 | |
586 case GG_STATUS_BUSY: | |
587 case GG_STATUS_BUSY_DESCR: | |
588 status_id = "away"; | |
589 break; | |
590 | |
591 case GG_STATUS_INVISIBLE: | |
592 case GG_STATUS_INVISIBLE_DESCR: | |
593 status_id = "invisible"; | |
594 break; | |
595 | |
596 default: | |
597 status_id = "available"; | |
598 break; | |
8775 | 599 } |
9415 | 600 |
601 if (buddy && e->event.notify60[i].descr != NULL) { | |
602 buddy->proto_data = g_strdup(e->event.notify60[i].descr); | |
603 } | |
8775 | 604 |
9950 | 605 gaim_prpl_got_user_status(account, user, status_id, NULL); |
9415 | 606 i++; |
8775 | 607 } |
608 } | |
609 break; | |
2393 | 610 case GG_EVENT_STATUS: |
611 { | |
612 gchar user[20]; | |
9950 | 613 const char *status_id; |
2393 | 614 |
615 switch (e->event.status.status) { | |
9950 | 616 case GG_STATUS_NOT_AVAIL: |
617 status_id = "unavailable"; | |
618 break; | |
619 | |
620 case GG_STATUS_AVAIL: | |
621 status_id = "available"; | |
622 break; | |
623 | |
624 case GG_STATUS_BUSY: | |
625 status_id = "away"; | |
626 break; | |
627 | |
628 case GG_STATUS_INVISIBLE: | |
629 status_id = "invisible"; | |
630 break; | |
631 | |
632 default: | |
633 status_id = "available"; | |
634 break; | |
2393 | 635 } |
636 | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
637 g_snprintf(user, sizeof(user), "%lu", e->event.status.uin); |
9950 | 638 gaim_prpl_got_user_status(account, user, status_id, NULL); |
2393 | 639 } |
640 break; | |
8775 | 641 case GG_EVENT_STATUS60: |
642 { | |
643 gchar user[20]; | |
9950 | 644 const char *status_id; |
8775 | 645 |
9415 | 646 GaimBuddy *buddy; |
647 | |
648 g_snprintf(user, sizeof(user), "%lu", e->event.status60.uin); | |
649 | |
650 buddy = gaim_find_buddy(gaim_connection_get_account(gc), user); | |
651 if (buddy && buddy->proto_data != NULL) { | |
652 g_free(buddy->proto_data); | |
653 buddy->proto_data = NULL; | |
654 } | |
655 | |
8775 | 656 switch (e->event.status60.status) { |
9950 | 657 case GG_STATUS_NOT_AVAIL_DESCR: |
658 case GG_STATUS_NOT_AVAIL: | |
659 status_id = "unavailable"; | |
660 break; | |
661 | |
662 case GG_STATUS_AVAIL: | |
663 case GG_STATUS_AVAIL_DESCR: | |
664 status_id = "available"; | |
665 break; | |
666 | |
667 case GG_STATUS_BUSY: | |
668 case GG_STATUS_BUSY_DESCR: | |
669 status_id = "away"; | |
670 break; | |
671 | |
672 case GG_STATUS_INVISIBLE: | |
673 case GG_STATUS_INVISIBLE_DESCR: | |
674 status_id = "invisible"; | |
675 break; | |
676 | |
677 default: | |
678 status_id = "available"; | |
679 break; | |
8775 | 680 } |
9950 | 681 |
9415 | 682 if (buddy && e->event.status60.descr != NULL) { |
683 buddy->proto_data = g_strdup(e->event.status60.descr); | |
684 } | |
9950 | 685 |
686 gaim_prpl_got_user_status(account, user, status_id, NULL); | |
8775 | 687 } |
8997 | 688 break; |
2393 | 689 case GG_EVENT_ACK: |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
690 gaim_debug(GAIM_DEBUG_MISC, "gg", |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
691 "main_callback: message %d to %lu sent with status %d\n", |
2393 | 692 e->event.ack.seq, e->event.ack.recipient, e->event.ack.status); |
693 break; | |
8775 | 694 case GG_EVENT_USERLIST: |
695 { | |
696 gaim_debug(GAIM_DEBUG_MISC, "gg", "main_callback: received userlist reply\n"); | |
697 switch (e->event.userlist.type) { | |
698 case GG_USERLIST_GET_REPLY: | |
699 { | |
8996 | 700 |
8775 | 701 if (e->event.userlist.reply) { |
702 agg_load_buddy_list(gc, e->event.userlist.reply); | |
703 } | |
704 break; | |
705 } | |
706 | |
707 case GG_USERLIST_PUT_REPLY: | |
708 { | |
709 /* ignored */ | |
710 } | |
711 } | |
712 } | |
713 | |
2393 | 714 default: |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
715 gaim_debug(GAIM_DEBUG_ERROR, "gg", |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
716 "main_callback: unsupported event %d\n", e->type); |
2393 | 717 break; |
718 } | |
719 gg_free_event(e); | |
720 } | |
721 | |
3630 | 722 void login_callback(gpointer data, gint source, GaimInputCondition cond) |
2393 | 723 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
724 GaimConnection *gc = data; |
2393 | 725 struct agg_data *gd = gc->proto_data; |
726 struct gg_event *e; | |
727 | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
728 gaim_debug(GAIM_DEBUG_INFO, "gg", "login_callback...\n"); |
5605 | 729 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2393 | 730 close(source); |
731 return; | |
732 } | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
733 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
734 gaim_debug(GAIM_DEBUG_INFO, "gg", "Found GG connection\n"); |
5603 | 735 |
4511 | 736 if (source == 0) { |
5603 | 737 gaim_connection_error(gc, _("Unable to connect.")); |
2393 | 738 return; |
739 } | |
4452 | 740 |
741 gd->sess->fd = source; | |
742 | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
743 gaim_debug(GAIM_DEBUG_MISC, "gg", "Source is valid.\n"); |
3630 | 744 if (gc->inpa == 0) { |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
745 gaim_debug(GAIM_DEBUG_MISC, "gg", |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
746 "login_callback.. checking gc->inpa .. is 0.. setting fd watch\n"); |
2393 | 747 gc->inpa = gaim_input_add(gd->sess->fd, GAIM_INPUT_READ, login_callback, gc); |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
748 gaim_debug(GAIM_DEBUG_INFO, "gg", "Adding watch on fd\n"); |
3630 | 749 } |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
750 gaim_debug(GAIM_DEBUG_INFO, "gg", "Checking State.\n"); |
2393 | 751 switch (gd->sess->state) { |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
752 case GG_STATE_READING_DATA: |
8896 | 753 gaim_connection_update_progress(gc, _("Reading data"), 1, GG_CONNECT_STEPS); |
2835
d8e67ff8022f
[gaim-migrate @ 2848]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2806
diff
changeset
|
754 break; |
2393 | 755 case GG_STATE_CONNECTING_GG: |
8896 | 756 gaim_connection_update_progress(gc, _("Balancer handshake"), 2, GG_CONNECT_STEPS); |
2393 | 757 break; |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
758 case GG_STATE_READING_KEY: |
8896 | 759 gaim_connection_update_progress(gc, _("Reading server key"), 3, GG_CONNECT_STEPS); |
2835
d8e67ff8022f
[gaim-migrate @ 2848]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2806
diff
changeset
|
760 break; |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
761 case GG_STATE_READING_REPLY: |
8896 | 762 gaim_connection_update_progress(gc, _("Exchanging key hash"), 4, GG_CONNECT_STEPS); |
2393 | 763 break; |
764 default: | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
765 gaim_debug(GAIM_DEBUG_INFO, "gg", "No State found\n"); |
2393 | 766 break; |
767 } | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
768 gaim_debug(GAIM_DEBUG_MISC, "gg", "gg_watch_fd\n"); |
2393 | 769 if (!(e = gg_watch_fd(gd->sess))) { |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
770 gaim_debug(GAIM_DEBUG_ERROR, "gg", |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
771 "login_callback: gg_watch_fd failed - CRITICAL!\n"); |
5603 | 772 gaim_connection_error(gc, _("Critical error in GG library\n")); |
2393 | 773 return; |
774 } | |
775 | |
3630 | 776 /* If we are GG_STATE_CONNECTING_GG then we still need to connect, as |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5645
diff
changeset
|
777 we could not use gaim_proxy_connect in libgg.c */ |
3630 | 778 switch( gd->sess->state ) { |
779 case GG_STATE_CONNECTING_GG: | |
780 { | |
781 struct in_addr ip; | |
782 char buf[256]; | |
4634 | 783 |
3630 | 784 /* Remove watch on initial socket - now that we have ip and port of login server */ |
785 gaim_input_remove(gc->inpa); | |
786 | |
787 ip.s_addr = gd->sess->server_ip; | |
4634 | 788 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5645
diff
changeset
|
789 if (gaim_proxy_connect(gc->account, inet_ntoa(ip), gd->sess->port, login_callback, gc) < 0) { |
3630 | 790 g_snprintf(buf, sizeof(buf), _("Connect to %s failed"), inet_ntoa(ip)); |
5603 | 791 gaim_connection_error(gc, buf); |
3630 | 792 return; |
793 } | |
794 break; | |
795 } | |
796 case GG_STATE_READING_KEY: | |
797 /* Set new watch on login server ip */ | |
798 if(gc->inpa) | |
799 gc->inpa = gaim_input_add(gd->sess->fd, GAIM_INPUT_READ, login_callback, gc); | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
800 gaim_debug(GAIM_DEBUG_INFO, "gg", |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
801 "Setting watch on connection with login server.\n"); |
3630 | 802 break; |
803 }/* end switch() */ | |
804 | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
805 gaim_debug(GAIM_DEBUG_MISC, "gg", "checking gg_event\n"); |
2393 | 806 switch (e->type) { |
807 case GG_EVENT_NONE: | |
808 /* nothing */ | |
809 break; | |
810 case GG_EVENT_CONN_SUCCESS: | |
811 /* Setup new input handler */ | |
812 if (gc->inpa) | |
813 gaim_input_remove(gc->inpa); | |
814 gc->inpa = gaim_input_add(gd->sess->fd, GAIM_INPUT_READ, main_callback, gc); | |
815 | |
816 /* Our signon is complete */ | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
817 gaim_connection_set_state(gc, GAIM_CONNECTED); |
2393 | 818 serv_finish_login(gc); |
819 | |
820 break; | |
821 case GG_EVENT_CONN_FAILED: | |
822 gaim_input_remove(gc->inpa); | |
823 gc->inpa = 0; | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
824 handle_errcode(gc, e->event.failure); |
2393 | 825 break; |
826 default: | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
827 gaim_debug(GAIM_DEBUG_MISC, "gg", "no gg_event\n"); |
2393 | 828 break; |
829 } | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
830 gaim_debug(GAIM_DEBUG_INFO, "gg", "Returning from login_callback\n"); |
2393 | 831 gg_free_event(e); |
832 } | |
833 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
834 static void agg_keepalive(GaimConnection *gc) |
2393 | 835 { |
836 struct agg_data *gd = (struct agg_data *)gc->proto_data; | |
837 if (gg_ping(gd->sess) < 0) { | |
5603 | 838 gaim_connection_error(gc, _("Unable to ping server")); |
2393 | 839 return; |
840 } | |
841 } | |
842 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
843 static void agg_login(GaimAccount *account) |
2393 | 844 { |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
845 GaimConnection *gc = gaim_account_get_connection(account); |
2393 | 846 struct agg_data *gd = gc->proto_data = g_new0(struct agg_data, 1); |
847 char buf[80]; | |
848 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
849 #if 0 |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
850 gc->checkbox = _("Send as message"); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
851 #endif |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
852 |
2393 | 853 gd->sess = g_new0(struct gg_session, 1); |
854 | |
8896 | 855 gaim_connection_update_progress(gc, _("Looking up GG server"), 0, GG_CONNECT_STEPS); |
2393 | 856 |
4491 | 857 if (invalid_uin(account->username)) { |
5603 | 858 gaim_connection_error(gc, _("Invalid Gadu-Gadu UIN specified")); |
2393 | 859 return; |
860 } | |
861 | |
862 gc->inpa = 0; | |
863 | |
864 /* | |
865 if (gg_login(gd->sess, strtol(user->username, (char **)NULL, 10), user->password, 1) < 0) { | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
866 gaim_debug(GAIM_DEBUG_MISC, "gg", "uin=%u, pass=%s", strtol(user->username, (char **)NULL, 10), user->password); |
6321 | 867 gaim_connection_error(gc, _("Unable to connect.")); |
2393 | 868 signoff(gc); |
869 return; | |
870 } | |
871 | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5645
diff
changeset
|
872 gg_login() sucks for me, so I'm using gaim_proxy_connect() |
2393 | 873 */ |
874 | |
4491 | 875 gd->sess->uin = (uin_t) strtol(account->username, (char **)NULL, 10); |
876 gd->sess->password = g_strdup(account->password); | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
877 gd->sess->state = GG_STATE_CONNECTING; |
2393 | 878 gd->sess->check = GG_CHECK_WRITE; |
879 gd->sess->async = 1; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5645
diff
changeset
|
880 if (gaim_proxy_connect(account, GG_APPMSG_HOST, GG_APPMSG_PORT, login_callback, gc) < 0) { |
2393 | 881 g_snprintf(buf, sizeof(buf), _("Connect to %s failed"), GG_APPMSG_HOST); |
5603 | 882 gaim_connection_error(gc, buf); |
2393 | 883 return; |
884 } | |
885 } | |
886 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
887 static void agg_close(GaimConnection *gc) |
2393 | 888 { |
889 struct agg_data *gd = (struct agg_data *)gc->proto_data; | |
890 if (gc->inpa) | |
891 gaim_input_remove(gc->inpa); | |
892 gg_logoff(gd->sess); | |
3339 | 893 gd->own_status = GG_STATUS_NOT_AVAIL; |
2393 | 894 gg_free_session(gd->sess); |
895 g_free(gc->proto_data); | |
896 } | |
897 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7108
diff
changeset
|
898 static int agg_send_im(GaimConnection *gc, const char *who, const char *msg, GaimConvImFlags flags) |
2393 | 899 { |
900 struct agg_data *gd = (struct agg_data *)gc->proto_data; | |
901 gchar *imsg; | |
902 | |
903 if (invalid_uin(who)) { | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
904 gaim_notify_error(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
905 _("You are trying to send a message to an " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
906 "invalid Gadu-Gadu UIN."), NULL); |
2393 | 907 return -1; |
908 } | |
909 | |
910 if (strlen(msg) > 0) { | |
4051 | 911 imsg = charset_convert(msg, "UTF-8", "CP1250"); |
6622 | 912 if (gg_send_message(gd->sess, GG_CLASS_CHAT, |
2393 | 913 strtol(who, (char **)NULL, 10), imsg) < 0) |
914 return -1; | |
915 g_free(imsg); | |
916 } | |
917 return 1; | |
918 } | |
919 | |
9285 | 920 static void agg_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) |
2393 | 921 { |
922 struct agg_data *gd = (struct agg_data *)gc->proto_data; | |
9285 | 923 if (invalid_uin(buddy->name)) |
2393 | 924 return; |
9285 | 925 gg_add_notify(gd->sess, strtol(buddy->name, (char **)NULL, 10)); |
8775 | 926 agg_save_buddy_list(gc, NULL); |
2393 | 927 } |
928 | |
9285 | 929 static void agg_rem_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) |
2393 | 930 { |
931 struct agg_data *gd = (struct agg_data *)gc->proto_data; | |
9285 | 932 if (invalid_uin(buddy->name)) |
2393 | 933 return; |
9285 | 934 gg_remove_notify(gd->sess, strtol(buddy->name, (char **)NULL, 10)); |
8775 | 935 agg_save_buddy_list(gc, NULL); |
2393 | 936 } |
937 | |
9285 | 938 static void agg_add_buddies(GaimConnection *gc, GList *buddies, GList *groups) |
2393 | 939 { |
940 struct agg_data *gd = (struct agg_data *)gc->proto_data; | |
941 uin_t *userlist = NULL; | |
942 int userlist_size = 0; | |
943 | |
9285 | 944 while (buddies) { |
945 GaimBuddy *buddy = buddies->data; | |
946 if (!invalid_uin(buddy->name)) { | |
2393 | 947 userlist_size++; |
948 userlist = g_renew(uin_t, userlist, userlist_size); | |
949 userlist[userlist_size - 1] = | |
9285 | 950 (uin_t) strtol(buddy->name, (char **)NULL, 10); |
2393 | 951 } |
9285 | 952 buddies = g_list_next(buddies); |
2393 | 953 } |
954 | |
955 if (userlist) { | |
956 gg_notify(gd->sess, userlist, userlist_size); | |
957 g_free(userlist); | |
958 } | |
8997 | 959 |
8775 | 960 agg_save_buddy_list(gc, NULL); |
2393 | 961 } |
962 | |
9415 | 963 static void agg_buddy_free (GaimBuddy *buddy) |
964 { | |
965 if (buddy->proto_data) { | |
966 g_free(buddy->proto_data); | |
967 buddy->proto_data = NULL; | |
968 } | |
969 } | |
970 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
971 static void search_results(GaimConnection *gc, gchar *webdata) |
2393 | 972 { |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
973 gchar **webdata_tbl; |
2393 | 974 gchar *buf; |
975 char *ptr; | |
976 int i, j; | |
977 | |
978 if ((ptr = strstr(webdata, "query_results:")) == NULL || (ptr = strchr(ptr, '\n')) == NULL) { | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
979 gaim_debug(GAIM_DEBUG_MISC, "gg", "search_callback: pubdir result [%s]\n", webdata); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
980 gaim_notify_error(gc, NULL, _("Couldn't get search results"), NULL); |
2393 | 981 return; |
982 } | |
983 ptr++; | |
984 | |
985 buf = g_strconcat("<B>", _("Gadu-Gadu Search Engine"), "</B><BR>\n", NULL); | |
986 | |
987 webdata_tbl = g_strsplit(ptr, "\n", AGG_PUBDIR_MAX_ENTRIES); | |
988 | |
989 j = 0; | |
990 | |
991 /* Parse array */ | |
9285 | 992 /* XXX - Make this use a GString */ |
2393 | 993 for (i = 0; webdata_tbl[i] != NULL; i++) { |
994 gchar *p, *oldibuf; | |
995 static gchar *ibuf; | |
996 | |
997 g_strdelimit(webdata_tbl[i], "\t\n", ' '); | |
998 | |
999 /* GG_PUBDIR_HOST service returns 7 lines of data per directory entry */ | |
1000 if (i % 8 == 0) | |
1001 j = 0; | |
1002 | |
4051 | 1003 p = charset_convert(g_strstrip(webdata_tbl[i]), "CP1250", "UTF-8"); |
2393 | 1004 |
1005 oldibuf = ibuf; | |
1006 | |
1007 switch (j) { | |
1008 case 0: | |
1009 ibuf = g_strconcat("---------------------------------<BR>\n", NULL); | |
1010 oldibuf = ibuf; | |
1011 ibuf = g_strconcat(oldibuf, "<B>", _("Active"), ":</B> ", | |
4606 | 1012 (atoi(p) == 2) ? _("Yes") : _("No"), "<BR>\n", NULL); |
2393 | 1013 g_free(oldibuf); |
1014 break; | |
1015 case 1: | |
1016 ibuf = g_strconcat(oldibuf, "<B>", _("UIN"), ":</B> ", p, "<BR>\n", NULL); | |
1017 g_free(oldibuf); | |
1018 break; | |
1019 case 2: | |
7981 | 1020 ibuf = g_strconcat(oldibuf, "<B>", _("First Name"), ":</B> ", p, "<BR>\n", NULL); |
2393 | 1021 g_free(oldibuf); |
1022 break; | |
1023 case 3: | |
1024 ibuf = | |
6623 | 1025 g_strconcat(oldibuf, "<B>", _("Last Name"), ":</B> ", p, "<BR>\n", NULL); |
2393 | 1026 g_free(oldibuf); |
1027 break; | |
1028 case 4: | |
1029 ibuf = g_strconcat(oldibuf, "<B>", _("Nick"), ":</B> ", p, "<BR>\n", NULL); | |
1030 g_free(oldibuf); | |
1031 break; | |
1032 case 5: | |
1033 /* Hack, invalid_uin does what we really want here but may change in future */ | |
1034 if (invalid_uin(p)) | |
1035 ibuf = | |
8063 | 1036 g_strconcat(oldibuf, "<B>", _("Birth Year"), ":</B> <BR>\n", NULL); |
2393 | 1037 else |
1038 ibuf = | |
8063 | 1039 g_strconcat(oldibuf, "<B>", _("Birth Year"), ":</B> ", p, "<BR>\n", |
2393 | 1040 NULL); |
1041 g_free(oldibuf); | |
1042 break; | |
1043 case 6: | |
1044 if (atoi(p) == GG_GENDER_FEMALE) | |
1045 ibuf = g_strconcat(oldibuf, "<B>", _("Sex"), ":</B> woman<BR>\n", NULL); | |
1046 else if (atoi(p) == GG_GENDER_MALE) | |
1047 ibuf = g_strconcat(oldibuf, "<B>", _("Sex"), ":</B> man<BR>\n", NULL); | |
1048 else | |
1049 ibuf = g_strconcat(oldibuf, "<B>", _("Sex"), ":</B> <BR>\n", NULL); | |
1050 g_free(oldibuf); | |
1051 break; | |
1052 case 7: | |
1053 ibuf = g_strconcat(oldibuf, "<B>", _("City"), ":</B> ", p, "<BR>\n", NULL); | |
1054 g_free(oldibuf); | |
1055 | |
1056 /* We have all lines, so add them to buffer */ | |
1057 { | |
1058 gchar *oldbuf = buf; | |
1059 buf = g_strconcat(oldbuf, ibuf, NULL); | |
1060 g_free(oldbuf); | |
1061 } | |
1062 | |
1063 g_free(ibuf); | |
1064 break; | |
1065 } | |
1066 | |
1067 g_free(p); | |
1068 | |
1069 j++; | |
1070 } | |
1071 | |
1072 g_strfreev(webdata_tbl); | |
1073 | |
7062
86ed8b2aa665
[gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
1074 gaim_notify_formatted(gc, NULL, _("Buddy Information"), NULL, |
86ed8b2aa665
[gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
1075 buf, NULL, NULL); |
2393 | 1076 |
1077 g_free(buf); | |
1078 } | |
1079 | |
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7062
diff
changeset
|
1080 static void |
9015 | 1081 change_pass(GaimPluginAction *action) |
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7062
diff
changeset
|
1082 { |
9015 | 1083 GaimConnection *gc = (GaimConnection *) action->context; |
1084 GaimAccount *account = gaim_connection_get_account(gc); | |
1085 gaim_account_request_change_password(account); | |
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7062
diff
changeset
|
1086 } |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7062
diff
changeset
|
1087 |
8775 | 1088 #if 0 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
1089 static void import_buddies_server_results(GaimConnection *gc, gchar *webdata) |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1090 { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1091 gchar *ptr; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1092 gchar **users_tbl; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1093 int i; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1094 if (strstr(webdata, "no_data:")) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1095 gaim_notify_error(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1096 _("There is no Buddy List stored on the " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1097 "Gadu-Gadu server."), NULL); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1098 return; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1099 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1100 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1101 if ((ptr = strstr(webdata, "get_results:")) == NULL || (ptr = strchr(ptr, ':')) == NULL) { |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1102 gaim_debug(GAIM_DEBUG_MISC, "gg", "import_buddies_server_results: import buddies result [%s]\n", webdata); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1103 gaim_notify_error(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1104 _("Couldn't Import Buddy List from Server"), NULL); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1105 return; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1106 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1107 ptr++; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1108 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1109 users_tbl = g_strsplit(ptr, "\n", AGG_PUBDIR_MAX_ENTRIES); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1110 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1111 /* Parse array of Buddies List */ |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1112 for (i = 0; users_tbl[i] != NULL; i++) { |
4520
4fe661860577
[gaim-migrate @ 4798]
Christian Hammond <chipx86@chipx86.com>
parents:
4516
diff
changeset
|
1113 gchar **data_tbl; |
4fe661860577
[gaim-migrate @ 4798]
Christian Hammond <chipx86@chipx86.com>
parents:
4516
diff
changeset
|
1114 gchar *name, *show; |
4fe661860577
[gaim-migrate @ 4798]
Christian Hammond <chipx86@chipx86.com>
parents:
4516
diff
changeset
|
1115 |
4516 | 1116 if (strlen(users_tbl[i])==0) { |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1117 gaim_debug(GAIM_DEBUG_MISC, "gg", |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1118 "import_buddies_server_results: users_tbl[i] is empty\n"); |
4530 | 1119 continue; |
4516 | 1120 } |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1121 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1122 g_strdelimit(users_tbl[i], "\r\t\n\015", ' '); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1123 data_tbl = g_strsplit(users_tbl[i], ";", 8); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1124 |
4437 | 1125 show = charset_convert(data_tbl[3], "CP1250", "UTF-8"); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1126 name = data_tbl[6]; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1127 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1128 if (invalid_uin(name)) { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1129 continue; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1130 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1131 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1132 gaim_debug(GAIM_DEBUG_MISC, "gg", |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1133 "import_buddies_server_results: uin: %s\n", name); |
4687 | 1134 if (!gaim_find_buddy(gc->account, name)) { |
6695 | 1135 GaimBuddy *b; |
1136 GaimGroup *g; | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1137 /* Default group if none specified on server */ |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1138 gchar *group = g_strdup("Gadu-Gadu"); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1139 if (strlen(data_tbl[5])) { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1140 gchar **group_tbl = g_strsplit(data_tbl[5], ",", 2); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1141 if (strlen(group_tbl[0])) { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1142 g_free(group); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1143 group = g_strdup(group_tbl[0]); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1144 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1145 g_strfreev(group_tbl); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1146 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1147 /* Add Buddy to our userlist */ |
4775 | 1148 if (!(g = gaim_find_group(group))) { |
4687 | 1149 g = gaim_group_new(group); |
4775 | 1150 gaim_blist_add_group(g, NULL); |
1151 } | |
4687 | 1152 b = gaim_buddy_new(gc->account, name, strlen(show) ? show : NULL); |
9295 | 1153 gaim_blist_add_buddy(b, NULL, g, NULL); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1154 g_free(group); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1155 } |
4437 | 1156 g_free(show); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1157 g_strfreev(data_tbl); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1158 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1159 g_strfreev(users_tbl); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1160 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1161 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
1162 static void export_buddies_server_results(GaimConnection *gc, gchar *webdata) |
2393 | 1163 { |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1164 if (strstr(webdata, "put_success:")) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1165 gaim_notify_info(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1166 _("Buddy List successfully transferred to " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1167 "Gadu-Gadu server"), NULL); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1168 return; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1169 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1170 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1171 gaim_debug(GAIM_DEBUG_MISC, "gg", |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1172 "export_buddies_server_results: webdata [%s]\n", webdata); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1173 gaim_notify_error(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1174 _("Couldn't transfer Buddy List to Gadu-Gadu server"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1175 NULL); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1176 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1177 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
1178 static void delete_buddies_server_results(GaimConnection *gc, gchar *webdata) |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1179 { |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1180 if (strstr(webdata, "put_success:")) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1181 gaim_notify_info(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1182 _("Buddy List successfully deleted from " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1183 "Gadu-Gadu server"), NULL); |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1184 return; |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1185 } |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1186 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1187 gaim_debug(GAIM_DEBUG_MISC, "gg", |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1188 "delete_buddies_server_results: webdata [%s]\n", webdata); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1189 gaim_notify_error(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1190 _("Couldn't delete Buddy List from Gadu-Gadu server"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1191 NULL); |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1192 } |
8775 | 1193 #endif |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1194 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
1195 static void password_change_server_results(GaimConnection *gc, gchar *webdata) |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1196 { |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1197 if (strstr(webdata, "reg_success:")) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1198 gaim_notify_info(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1199 _("Password changed successfully"), NULL); |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1200 return; |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1201 } |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1202 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1203 gaim_debug(GAIM_DEBUG_MISC, "gg", |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1204 "password_change_server_results: webdata [%s]\n", webdata); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1205 gaim_notify_error(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1206 _("Password couldn't be changed"), NULL); |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1207 } |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1208 |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1209 static void http_results(gpointer data, gint source, GaimInputCondition cond) |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1210 { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1211 struct agg_http *hdata = data; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
1212 GaimConnection *gc = hdata->gc; |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1213 char *webdata; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1214 int len; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1215 char read_data; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1216 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1217 gaim_debug(GAIM_DEBUG_INFO, "gg", "http_results: begin\n"); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1218 |
5605 | 1219 if (!g_list_find(gaim_connections_get_all(), gc)) { |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1220 gaim_debug(GAIM_DEBUG_ERROR, "gg", |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1221 "search_callback: g_slist_find error\n"); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1222 gaim_input_remove(hdata->inpa); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1223 g_free(hdata); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1224 close(source); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1225 return; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1226 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1227 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1228 webdata = NULL; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1229 len = 0; |
3717
988485669631
[gaim-migrate @ 3850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3630
diff
changeset
|
1230 |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1231 while (read(source, &read_data, 1) > 0 || errno == EWOULDBLOCK) { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1232 if (errno == EWOULDBLOCK) { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1233 errno = 0; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1234 continue; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1235 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1236 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1237 if (!read_data) |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1238 continue; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1239 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1240 len++; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1241 webdata = g_realloc(webdata, len); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1242 webdata[len - 1] = read_data; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1243 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1244 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1245 webdata = g_realloc(webdata, len + 1); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1246 webdata[len] = 0; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1247 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1248 gaim_input_remove(hdata->inpa); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1249 close(source); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1250 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1251 gaim_debug(GAIM_DEBUG_MISC, "gg", |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1252 "http_results: type %d, webdata [%s]\n", hdata->type, webdata); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1253 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1254 switch (hdata->type) { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1255 case AGG_HTTP_SEARCH: |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1256 search_results(gc, webdata); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1257 break; |
8775 | 1258 #if 0 |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1259 case AGG_HTTP_USERLIST_IMPORT: |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1260 import_buddies_server_results(gc, webdata); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1261 break; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1262 case AGG_HTTP_USERLIST_EXPORT: |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1263 export_buddies_server_results(gc, webdata); |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1264 break; |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1265 case AGG_HTTP_USERLIST_DELETE: |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1266 delete_buddies_server_results(gc, webdata); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1267 break; |
8775 | 1268 #endif |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1269 case AGG_HTTP_PASSWORD_CHANGE: |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1270 password_change_server_results(gc, webdata); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1271 break; |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1272 case AGG_HTTP_NONE: |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1273 default: |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1274 gaim_debug(GAIM_DEBUG_ERROR, "gg", |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1275 "http_results: unsupported type %d\n", hdata->type); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1276 break; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1277 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1278 |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1279 g_free(webdata); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1280 g_free(hdata); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1281 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1282 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1283 static void http_req_callback(gpointer data, gint source, GaimInputCondition cond) |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1284 { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1285 struct agg_http *hdata = data; |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
1286 GaimConnection *gc = hdata->gc; |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1287 gchar *request = hdata->request; |
2393 | 1288 gchar *buf; |
1289 | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1290 gaim_debug(GAIM_DEBUG_INFO, "gg", "http_req_callback: begin\n"); |
2393 | 1291 |
5605 | 1292 if (!g_list_find(gaim_connections_get_all(), gc)) { |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1293 gaim_debug(GAIM_DEBUG_ERROR, "gg", |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1294 "http_req_callback: g_slist_find error\n"); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1295 g_free(request); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1296 g_free(hdata); |
2393 | 1297 close(source); |
1298 return; | |
1299 } | |
1300 | |
4511 | 1301 if (source == 0) { |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1302 g_free(request); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1303 g_free(hdata); |
2393 | 1304 return; |
1305 } | |
1306 | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1307 gaim_debug(GAIM_DEBUG_MISC, "gg", |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
1308 "http_req_callback: http request [%s]\n", request); |
2393 | 1309 |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1310 buf = g_strdup_printf("POST %s HTTP/1.0\r\n" |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1311 "Host: %s\r\n" |
2393 | 1312 "Content-Type: application/x-www-form-urlencoded\r\n" |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1313 "User-Agent: " GG_HTTP_USERAGENT "\r\n" |
2393 | 1314 "Content-Length: %d\r\n" |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1315 "Pragma: no-cache\r\n" "\r\n" "%s\r\n", |
7386 | 1316 hdata->form, hdata->host, (int)strlen(request), request); |
2393 | 1317 |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1318 g_free(request); |
2393 | 1319 |
1320 if (write(source, buf, strlen(buf)) < strlen(buf)) { | |
1321 g_free(buf); | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1322 g_free(hdata); |
2393 | 1323 close(source); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1324 gaim_notify_error(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1325 _("Error communicating with Gadu-Gadu server"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1326 _("Gaim was unable to complete your request due " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1327 "to a problem communicating with the Gadu-Gadu " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1328 "HTTP server. Please try again later.")); |
2393 | 1329 return; |
1330 } | |
1331 | |
1332 g_free(buf); | |
1333 | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1334 hdata->inpa = gaim_input_add(source, GAIM_INPUT_READ, http_results, hdata); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1335 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1336 |
8775 | 1337 #if 0 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
1338 static void import_buddies_server(GaimConnection *gc) |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1339 { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1340 struct agg_http *hi = g_new0(struct agg_http, 1); |
5603 | 1341 gchar *u = gg_urlencode(gaim_account_get_username(gc->account)); |
1342 gchar *p = gg_urlencode(gaim_account_get_password(gc->account)); | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1343 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1344 hi->gc = gc; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1345 hi->type = AGG_HTTP_USERLIST_IMPORT; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1346 hi->form = AGG_PUBDIR_USERLIST_IMPORT_FORM; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1347 hi->host = GG_PUBDIR_HOST; |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1348 hi->request = g_strdup_printf("FmNum=%s&Pass=%s", u, p); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1349 |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1350 g_free(u); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1351 g_free(p); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1352 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5645
diff
changeset
|
1353 if (gaim_proxy_connect(gc->account, GG_PUBDIR_HOST, GG_PUBDIR_PORT, http_req_callback, hi) < 0) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1354 gaim_notify_error(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1355 _("Unable to import Gadu-Gadu buddy list"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1356 _("Gaim was unable to connect to the Gadu-Gadu " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1357 "buddy list server. Please try again later.")); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1358 g_free(hi->request); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1359 g_free(hi); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1360 return; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1361 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1362 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1363 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
1364 static void export_buddies_server(GaimConnection *gc) |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1365 { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1366 struct agg_http *he = g_new0(struct agg_http, 1); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1367 gchar *ptr; |
5603 | 1368 gchar *u = gg_urlencode(gaim_account_get_username(gc->account)); |
1369 gchar *p = gg_urlencode(gaim_account_get_password(gc->account)); | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1370 |
6695 | 1371 GaimBlistNode *gnode, *cnode, *bnode; |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1372 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1373 he->gc = gc; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1374 he->type = AGG_HTTP_USERLIST_EXPORT; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1375 he->form = AGG_PUBDIR_USERLIST_EXPORT_FORM; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1376 he->host = GG_PUBDIR_HOST; |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1377 he->request = g_strdup_printf("FmNum=%s&Pass=%s&Contacts=", u, p); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1378 |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1379 g_free(u); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1380 g_free(p); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1381 |
4785 | 1382 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
6695 | 1383 GaimGroup *g = (GaimGroup *)gnode; |
4516 | 1384 int num_added=0; |
4785 | 1385 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) |
1386 continue; | |
6695 | 1387 for(cnode = gnode->child; cnode; cnode = cnode->next) { |
1388 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
1389 continue; | |
1390 for(bnode = cnode->child; bnode; bnode = bnode->next) { | |
1391 GaimBuddy *b = (GaimBuddy *)bnode; | |
4785 | 1392 |
6695 | 1393 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) |
1394 continue; | |
4349 | 1395 |
6695 | 1396 if(b->account == gc->account) { |
1397 gchar *newdata; | |
1398 /* GG Number */ | |
1399 gchar *name = gg_urlencode(b->name); | |
1400 /* GG Pseudo */ | |
1401 gchar *show = gg_urlencode(b->alias ? b->alias : b->name); | |
1402 /* Group Name */ | |
1403 gchar *gname = gg_urlencode(g->name); | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1404 |
6695 | 1405 ptr = he->request; |
1406 newdata = g_strdup_printf("%s;%s;%s;%s;%s;%s;%s", | |
1407 show, show, show, show, "", gname, name); | |
4516 | 1408 |
6695 | 1409 if(num_added > 0) |
1410 he->request = g_strconcat(ptr, "%0d%0a", newdata, NULL); | |
1411 else | |
1412 he->request = g_strconcat(ptr, newdata, NULL); | |
4516 | 1413 |
6695 | 1414 num_added++; |
1415 | |
1416 g_free(newdata); | |
1417 g_free(ptr); | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1418 |
6695 | 1419 g_free(gname); |
1420 g_free(show); | |
1421 g_free(name); | |
1422 } | |
4349 | 1423 } |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1424 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1425 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1426 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5645
diff
changeset
|
1427 if (gaim_proxy_connect(gc->account, GG_PUBDIR_HOST, GG_PUBDIR_PORT, http_req_callback, he) < 0) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1428 gaim_notify_error(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1429 _("Couldn't export buddy list"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1430 _("Gaim was unable to connect to the buddy " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1431 "list server. Please try again later.")); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1432 g_free(he->request); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1433 g_free(he); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1434 return; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1435 } |
2393 | 1436 } |
1437 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
1438 static void delete_buddies_server(GaimConnection *gc) |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1439 { |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1440 struct agg_http *he = g_new0(struct agg_http, 1); |
5603 | 1441 gchar *u = gg_urlencode(gaim_account_get_username(gc->account)); |
1442 gchar *p = gg_urlencode(gaim_account_get_password(gc->account)); | |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1443 |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1444 he->gc = gc; |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1445 he->type = AGG_HTTP_USERLIST_DELETE; |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1446 he->form = AGG_PUBDIR_USERLIST_EXPORT_FORM; |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1447 he->host = GG_PUBDIR_HOST; |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1448 he->request = g_strdup_printf("FmNum=%s&Pass=%s&Delete=1", u, p); |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1449 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5645
diff
changeset
|
1450 if (gaim_proxy_connect(gc->account, GG_PUBDIR_HOST, GG_PUBDIR_PORT, http_req_callback, he) < 0) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1451 gaim_notify_error(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1452 _("Unable to delete Gadu-Gadu buddy list"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1453 _("Gaim was unable to connect to the buddy " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1454 "list server. Please try again later.")); |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1455 g_free(he->request); |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1456 g_free(he); |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1457 return; |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1458 } |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1459 } |
8775 | 1460 #endif |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1461 |
8950 | 1462 #if 0 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
1463 static void agg_dir_search(GaimConnection *gc, const char *first, const char *middle, |
3466 | 1464 const char *last, const char *maiden, const char *city, const char *state, |
1465 const char *country, const char *email) | |
2393 | 1466 { |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1467 struct agg_http *srch = g_new0(struct agg_http, 1); |
2393 | 1468 srch->gc = gc; |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1469 srch->type = AGG_HTTP_SEARCH; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1470 srch->form = AGG_PUBDIR_SEARCH_FORM; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1471 srch->host = GG_PUBDIR_HOST; |
2393 | 1472 |
1473 if (email && strlen(email)) { | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1474 gchar *eemail = gg_urlencode(email); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1475 srch->request = g_strdup_printf("Mode=1&Email=%s", eemail); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1476 g_free(eemail); |
2393 | 1477 } else { |
4051 | 1478 gchar *new_first = charset_convert(first, "UTF-8", "CP1250"); |
1479 gchar *new_last = charset_convert(last, "UTF-8", "CP1250"); | |
1480 gchar *new_city = charset_convert(city, "UTF-8", "CP1250"); | |
2393 | 1481 |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1482 gchar *enew_first = gg_urlencode(new_first); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1483 gchar *enew_last = gg_urlencode(new_last); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1484 gchar *enew_city = gg_urlencode(new_city); |
2393 | 1485 |
1486 g_free(new_first); | |
1487 g_free(new_last); | |
1488 g_free(new_city); | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1489 |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1490 /* For active only add &ActiveOnly= */ |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1491 srch->request = g_strdup_printf("Mode=0&FirstName=%s&LastName=%s&Gender=%d" |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1492 "&NickName=%s&City=%s&MinBirth=%d&MaxBirth=%d", |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1493 enew_first, enew_last, AGG_GENDER_NONE, |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1494 "", enew_city, 0, 0); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1495 |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1496 g_free(enew_first); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1497 g_free(enew_last); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1498 g_free(enew_city); |
2393 | 1499 } |
1500 | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5645
diff
changeset
|
1501 if (gaim_proxy_connect(gc->account, GG_PUBDIR_HOST, GG_PUBDIR_PORT, http_req_callback, srch) < 0) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1502 gaim_notify_error(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1503 _("Unable to access directory"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1504 _("Gaim was unable to search the Directory " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1505 "because it was unable to connect to the " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1506 "directory server. Please try again later.")); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1507 g_free(srch->request); |
2393 | 1508 g_free(srch); |
1509 return; | |
1510 } | |
1511 } | |
8950 | 1512 #endif |
2393 | 1513 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
1514 static void agg_change_passwd(GaimConnection *gc, const char *old, const char *new) |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1515 { |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1516 struct agg_http *hpass = g_new0(struct agg_http, 1); |
5603 | 1517 gchar *u = gg_urlencode(gaim_account_get_username(gc->account)); |
1518 gchar *p = gg_urlencode(gaim_account_get_password(gc->account)); | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1519 gchar *enew = gg_urlencode(new); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1520 gchar *eold = gg_urlencode(old); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1521 |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1522 hpass->gc = gc; |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1523 hpass->type = AGG_HTTP_PASSWORD_CHANGE; |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1524 hpass->form = AGG_REGISTER_DATA_FORM; |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1525 hpass->host = GG_REGISTER_HOST; |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1526 |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1527 /* We are using old password as place for email - it's ugly */ |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1528 hpass->request = g_strdup_printf("fmnumber=%s&fmpwd=%s&pwd=%s&email=%s&code=%u", |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1529 u, p, enew, eold, gg_http_hash(old, new)); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1530 |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1531 g_free(u); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1532 g_free(p); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1533 g_free(enew); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1534 g_free(eold); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1535 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5645
diff
changeset
|
1536 if (gaim_proxy_connect(gc->account, GG_REGISTER_HOST, GG_REGISTER_PORT, http_req_callback, hpass) < 0) { |
8997 | 1537 gaim_notify_error(gc, NULL, |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1538 _("Unable to change Gadu-Gadu password"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1539 _("Gaim was unable to change your password " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1540 "due to an error connecting to the " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1541 "Gadu-Gadu server. Please try again " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1542 "later.")); |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1543 g_free(hpass->request); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1544 g_free(hpass); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1545 return; |
8997 | 1546 } |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1547 } |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1548 |
9015 | 1549 static GList *agg_actions(GaimPlugin *plugin, gpointer context) |
2393 | 1550 { |
1551 GList *m = NULL; | |
9015 | 1552 GaimPluginAction *act = NULL; |
2393 | 1553 |
7062
86ed8b2aa665
[gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
1554 #if 0 |
9015 | 1555 act = gaim_plugin_action_new(_("Directory Search"), show_find_info); |
1556 m = g_list_append(m, act); | |
4333 | 1557 m = g_list_append(m, NULL); |
7062
86ed8b2aa665
[gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
1558 #endif |
4333 | 1559 |
9015 | 1560 act = gaim_plugin_action_new(_("Change Password"), change_pass); |
1561 m = g_list_append(m, act); | |
4333 | 1562 |
8775 | 1563 #if 0 |
9015 | 1564 act = gaim_plugin_action_new(_("Import Buddy List from Server"), |
1565 import_buddies_server); | |
1566 m = g_list_append(m, act); | |
4333 | 1567 |
9015 | 1568 act = gaim_plugin_action_new(_("Export Buddy List to Server"), |
1569 export_buddies_server); | |
1570 m = g_list_append(m, act); | |
4333 | 1571 |
9015 | 1572 act = gaim_plugin_action_new(_("Delete Buddy List from Server"), |
1573 delete_buddies_server); | |
1574 m = g_list_append(m, act); | |
8775 | 1575 #endif |
2393 | 1576 |
1577 return m; | |
1578 } | |
1579 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
1580 static void agg_get_info(GaimConnection *gc, const char *who) |
2393 | 1581 { |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1582 struct agg_http *srch = g_new0(struct agg_http, 1); |
2393 | 1583 srch->gc = gc; |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1584 srch->type = AGG_HTTP_SEARCH; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1585 srch->form = AGG_PUBDIR_SEARCH_FORM; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1586 srch->host = GG_PUBDIR_HOST; |
2393 | 1587 |
1588 /* If it's invalid uin then maybe it's nickname? */ | |
1589 if (invalid_uin(who)) { | |
4051 | 1590 gchar *new_who = charset_convert(who, "UTF-8", "CP1250"); |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1591 gchar *enew_who = gg_urlencode(new_who); |
8997 | 1592 |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1593 g_free(new_who); |
2393 | 1594 |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1595 srch->request = g_strdup_printf("Mode=0&FirstName=%s&LastName=%s&Gender=%d" |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1596 "&NickName=%s&City=%s&MinBirth=%d&MaxBirth=%d", |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1597 "", "", AGG_GENDER_NONE, enew_who, "", 0, 0); |
2393 | 1598 |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1599 g_free(enew_who); |
2393 | 1600 } else |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1601 srch->request = g_strdup_printf("Mode=3&UserId=%s", who); |
2393 | 1602 |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5645
diff
changeset
|
1603 if (gaim_proxy_connect(gc->account, GG_PUBDIR_HOST, GG_PUBDIR_PORT, http_req_callback, srch) < 0) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1604 gaim_notify_error(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1605 _("Unable to access user profile."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1606 _("Gaim was unable to access this user's " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1607 "profile due to an error connecting to the " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
1608 "directory server. Please try again later.")); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1609 g_free(srch->request); |
2393 | 1610 g_free(srch); |
1611 return; | |
1612 } | |
1613 } | |
1614 | |
6695 | 1615 static const char *agg_list_icon(GaimAccount *a, GaimBuddy *b) |
2393 | 1616 { |
4687 | 1617 return "gadu-gadu"; |
1618 } | |
4916 | 1619 |
9953 | 1620 static void agg_list_emblems(GaimBuddy *b, const char **se, const char **sw, |
1621 const char **nw, const char **ne) | |
4916 | 1622 { |
9944 | 1623 GaimPresence *presence = gaim_buddy_get_presence(b); |
1624 | |
1625 if (!GAIM_BUDDY_IS_ONLINE(b)) | |
4916 | 1626 *se = "offline"; |
9944 | 1627 else if (gaim_presence_is_status_active(presence, "away") || |
1628 gaim_presence_is_status_active(presence, "away-friends")) | |
1629 { | |
4916 | 1630 *se = "away"; |
9944 | 1631 } |
1632 else if (gaim_presence_is_status_active(presence, "invisible") || | |
1633 gaim_presence_is_status_active(presence, "invisible-friends")) | |
1634 { | |
1635 *se = "invisible"; | |
4916 | 1636 } |
2393 | 1637 } |
4916 | 1638 |
2393 | 1639 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
1640 static void agg_set_permit_deny_dummy(GaimConnection *gc) |
2393 | 1641 { |
1642 /* It's implemented on client side because GG server doesn't support this */ | |
1643 } | |
1644 | |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
1645 static void agg_permit_deny_dummy(GaimConnection *gc, const char *who) |
2393 | 1646 { |
1647 /* It's implemented on client side because GG server doesn't support this */ | |
1648 } | |
1649 | |
8796 | 1650 static void agg_group_buddy (GaimConnection *gc, const char *who, |
8775 | 1651 const char *old_group, const char *new_group) |
1652 { | |
1653 GaimBuddy *buddy = gaim_find_buddy(gaim_connection_get_account(gc), who); | |
1654 gchar *newdata; | |
1655 /* GG Number */ | |
1656 gchar *name = buddy->name; | |
1657 /* GG Pseudo */ | |
1658 gchar *show = buddy->alias ? buddy->alias : buddy->name; | |
1659 /* Group Name */ | |
1660 const gchar *gname = new_group; | |
1661 | |
1662 newdata = g_strdup_printf("%s;%s;%s;%s;%s;%s;%s;%s%s\r\n", | |
1663 show, show, show, show, "", gname, name, "", ""); | |
1664 agg_save_buddy_list(gc, newdata); | |
1665 g_free(newdata); | |
1666 } | |
1667 | |
9285 | 1668 static void agg_rename_group (GaimConnection *gc, const char *old_name, |
1669 GaimGroup *group, GList *moved_buddies) | |
8775 | 1670 { |
1671 agg_save_buddy_list(gc, NULL); | |
1672 } | |
1673 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1674 static GaimPlugin *my_protocol = NULL; |
2393 | 1675 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1676 static GaimPluginProtocolInfo prpl_info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1677 { |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1678 0, |
9475 | 1679 NULL, /* user_splits */ |
1680 NULL, /* protocol_options */ | |
9950 | 1681 NO_BUDDY_ICONS, /* icon_spec */ |
1682 agg_list_icon, /* list_icon */ | |
1683 agg_list_emblems, /* list_emblems */ | |
9475 | 1684 NULL, /* status_text */ |
1685 NULL, /* tooltip_text */ | |
9950 | 1686 agg_status_types, /* status_types */ |
9475 | 1687 agg_blist_node_menu, /* blist_node_menu */ |
1688 NULL, /* chat_info */ | |
9754 | 1689 NULL, /* chat_info_defaults */ |
9950 | 1690 agg_login, /* login */ |
1691 agg_close, /* close */ | |
1692 agg_send_im, /* send_im */ | |
9475 | 1693 NULL, /* set_info */ |
1694 NULL, /* send_typing */ | |
9950 | 1695 agg_get_info, /* get_info */ |
1696 agg_set_status, /* set_away */ | |
9475 | 1697 NULL, /* set_idle */ |
9950 | 1698 agg_change_passwd, /* change_passwd */ |
1699 agg_add_buddy, /* add_buddy */ | |
1700 agg_add_buddies, /* add_buddies */ | |
1701 agg_rem_buddy, /* remove_buddy */ | |
9475 | 1702 NULL, /* remove_buddies */ |
1703 agg_permit_deny_dummy, /* add_permit */ | |
1704 agg_permit_deny_dummy, /* add_deny */ | |
1705 agg_permit_deny_dummy, /* rem_permit */ | |
1706 agg_permit_deny_dummy, /* rem_deny */ | |
1707 agg_set_permit_deny_dummy, /* set_permit_deny */ | |
1708 NULL, /* warn */ | |
1709 NULL, /* join_chat */ | |
1710 NULL, /* reject_chat */ | |
9917 | 1711 NULL, /* get_chat_name */ |
9475 | 1712 NULL, /* chat_invite */ |
1713 NULL, /* chat_leave */ | |
1714 NULL, /* chat_whisper */ | |
1715 NULL, /* chat_send */ | |
9950 | 1716 agg_keepalive, /* keepalive */ |
9475 | 1717 NULL, /* register_user */ |
1718 NULL, /* get_cb_info */ | |
1719 NULL, /* get_cb_away */ | |
1720 NULL, /* alias_buddy */ | |
9950 | 1721 agg_group_buddy, /* group_buddy */ |
1722 agg_rename_group, /* rename_group */ | |
1723 agg_buddy_free, /* buddy_free */ | |
9475 | 1724 NULL, /* convo_closed */ |
1725 NULL, /* normalize */ | |
1726 NULL, /* set_buddy_icon */ | |
1727 NULL, /* remove_group */ | |
1728 NULL, /* get_cb_real_name */ | |
1729 NULL, /* set_chat_topic */ | |
1730 NULL, /* find_blist_chat */ | |
1731 NULL, /* roomlist_get_list */ | |
1732 NULL, /* roomlist_cancel */ | |
1733 NULL, /* roomlist_expand_category */ | |
1734 NULL, /* can_receive_file */ | |
1735 NULL /* send_file */ | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1736 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1737 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1738 static GaimPluginInfo info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1739 { |
9943 | 1740 GAIM_PLUGIN_MAGIC, |
1741 GAIM_MAJOR_VERSION, | |
1742 GAIM_MINOR_VERSION, | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1743 GAIM_PLUGIN_PROTOCOL, /**< type */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1744 NULL, /**< ui_requirement */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1745 0, /**< flags */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1746 NULL, /**< dependencies */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1747 GAIM_PRIORITY_DEFAULT, /**< priority */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1748 |
9030 | 1749 "prpl-gg", /**< id */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1750 "Gadu-Gadu", /**< name */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1751 VERSION, /**< version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1752 /** summary */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1753 N_("Gadu-Gadu Protocol Plugin"), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1754 /** description */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1755 N_("Gadu-Gadu Protocol Plugin"), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1756 "Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>", /**< author */ |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6321
diff
changeset
|
1757 GAIM_WEBSITE, /**< homepage */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1758 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1759 NULL, /**< load */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1760 NULL, /**< unload */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1761 NULL, /**< destroy */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1762 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1763 NULL, /**< ui_info */ |
8993 | 1764 &prpl_info, /**< extra_info */ |
1765 NULL, | |
9015 | 1766 agg_actions |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1767 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1768 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1769 static void |
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1770 init_plugin(GaimPlugin *plugin) |
2393 | 1771 { |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5618
diff
changeset
|
1772 GaimAccountOption *option; |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1773 |
5645
a9cd11fd0d6f
[gaim-migrate @ 6059]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
1774 option = gaim_account_option_string_new(_("Nick"), "nick", |
9030 | 1775 "Gadu-Gadu User"); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5618
diff
changeset
|
1776 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
9030 | 1777 option); |
3572 | 1778 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
1779 my_protocol = plugin; |
2393 | 1780 } |
1781 | |
9863 | 1782 GAIM_INIT_PLUGIN(gg, init_plugin, info) |