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