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