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