Mercurial > pidgin.yaz
annotate src/protocols/gg/gg.c @ 3427:8fa61405af2b
[gaim-migrate @ 3453]
Who never commits anything *now*, Etan?
I changed most of the error message text around. If you think any of it
should be different, just let me know, or send a patch.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Sun, 25 Aug 2002 10:51:24 +0000 |
parents | afa68a8feee2 |
children | 7a3f16a375a5 |
rev | line source |
---|---|
2393 | 1 /* |
2 * gaim - Gadu-Gadu Protocol Plugin | |
3427 | 3 * $Id: gg.c 3453 2002-08-25 10:51:24Z seanegan $ |
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> |
2393 | 6 * |
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 */ | |
22 | |
2541
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2518
diff
changeset
|
23 #ifdef HAVE_CONFIG_H |
2393 | 24 #include <config.h> |
2541
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2518
diff
changeset
|
25 #endif |
2393 | 26 |
27 #include <netdb.h> | |
28 #include <unistd.h> | |
29 #include <errno.h> | |
30 #include <netinet/in.h> | |
31 #include <arpa/inet.h> | |
32 #include <fcntl.h> | |
33 #include <string.h> | |
34 #include <stdlib.h> | |
35 #include <stdio.h> | |
36 #include <time.h> | |
37 #include <sys/socket.h> | |
38 #include <sys/stat.h> | |
39 #include <ctype.h> | |
40 #ifdef HAVE_LANGINFO_CODESET | |
41 #include <langinfo.h> | |
42 #endif | |
43 #ifdef HAVE_ICONV | |
44 #include <iconv.h> | |
2541
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2518
diff
changeset
|
45 #include "iconv_string.h" |
2393 | 46 #endif |
47 /* Library from EKG (Eksperymentalny Klient Gadu-Gadu) */ | |
48 #include "libgg.h" | |
49 #include "multi.h" | |
50 #include "prpl.h" | |
51 #include "gaim.h" | |
52 #include "proxy.h" | |
53 | |
54 #include "pixmaps/gg_suncloud.xpm" | |
55 #include "pixmaps/gg_sunred.xpm" | |
56 #include "pixmaps/gg_sunwhitered.xpm" | |
57 #include "pixmaps/gg_sunyellow.xpm" | |
58 | |
59 #define USEROPT_NICK 0 | |
60 | |
61 #define AGG_BUF_LEN 1024 | |
62 | |
63 #define AGG_GENDER_NONE -1 | |
64 | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
65 #define AGG_PUBDIR_USERLIST_EXPORT_FORM "/appsvc/fmcontactsput.asp" |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
66 #define AGG_PUBDIR_USERLIST_IMPORT_FORM "/appsvc/fmcontactsget.asp" |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
67 #define AGG_PUBDIR_SEARCH_FORM "/appsvc/fmpubquery2.asp" |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
68 #define AGG_REGISTER_DATA_FORM "/appsvc/fmregister.asp" |
2393 | 69 #define AGG_PUBDIR_MAX_ENTRIES 200 |
70 | |
71 #define AGG_STATUS_AVAIL _("Available") | |
72 #define AGG_STATUS_AVAIL_FRIENDS _("Available for friends only") | |
73 #define AGG_STATUS_BUSY _("Away") | |
74 #define AGG_STATUS_BUSY_FRIENDS _("Away for friends only") | |
75 #define AGG_STATUS_INVISIBLE _("Invisible") | |
76 #define AGG_STATUS_INVISIBLE_FRIENDS _("Invisible for friends only") | |
77 #define AGG_STATUS_NOT_AVAIL _("Unavailable") | |
78 | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
79 #define AGG_HTTP_NONE 0 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
80 #define AGG_HTTP_SEARCH 1 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
81 #define AGG_HTTP_USERLIST_IMPORT 2 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
82 #define AGG_HTTP_USERLIST_EXPORT 3 |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
83 #define AGG_HTTP_USERLIST_DELETE 4 |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
84 #define AGG_HTTP_PASSWORD_CHANGE 5 |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
85 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2423
diff
changeset
|
86 #define UC_NORMAL 2 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2423
diff
changeset
|
87 |
2393 | 88 struct agg_data { |
89 struct gg_session *sess; | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
90 int own_status; |
2393 | 91 }; |
92 | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
93 struct agg_http { |
2393 | 94 struct gaim_connection *gc; |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
95 gchar *request; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
96 gchar *form; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
97 gchar *host; |
2393 | 98 int inpa; |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
99 int type; |
2393 | 100 }; |
101 | |
102 static char *agg_name() | |
103 { | |
104 return "Gadu-Gadu"; | |
105 } | |
106 | |
107 static gchar *charset_convert(const gchar *locstr, char *encsrc, char *encdst) | |
108 { | |
2563 | 109 #ifdef HAVE_ICONV |
2542
221e1c8e2410
[gaim-migrate @ 2555]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2541
diff
changeset
|
110 gchar *result = NULL; |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
111 if (iconv_string(encdst, encsrc, locstr, locstr + strlen(locstr) + 1, &result, NULL) >= 0) |
2542
221e1c8e2410
[gaim-migrate @ 2555]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2541
diff
changeset
|
112 return result; |
2541
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2518
diff
changeset
|
113 #endif |
2393 | 114 return g_strdup(locstr); |
115 } | |
116 | |
117 static gboolean invalid_uin(char *uin) | |
118 { | |
119 unsigned long int res = strtol(uin, (char **)NULL, 10); | |
120 if (res == LONG_MIN || res == LONG_MAX || res == 0) | |
121 return TRUE; | |
122 return FALSE; | |
123 } | |
124 | |
125 static gint args_compare(gconstpointer a, gconstpointer b) | |
126 { | |
127 gchar *arg_a = (gchar *)a; | |
128 gchar *arg_b = (gchar *)b; | |
129 | |
130 return g_strcasecmp(arg_a, arg_b); | |
131 } | |
132 | |
133 static gboolean allowed_uin(struct gaim_connection *gc, char *uin) | |
134 { | |
135 switch (gc->permdeny) { | |
136 case 1: | |
137 /* permit all, deny none */ | |
138 return TRUE; | |
139 break; | |
140 case 2: | |
141 /* deny all, permit none. */ | |
142 return FALSE; | |
143 break; | |
144 case 3: | |
145 /* permit some. */ | |
146 if (g_slist_find_custom(gc->permit, uin, args_compare)) | |
147 return TRUE; | |
148 return FALSE; | |
149 break; | |
150 case 4: | |
151 /* deny some. */ | |
152 if (g_slist_find_custom(gc->deny, uin, args_compare)) | |
153 return FALSE; | |
154 return TRUE; | |
155 break; | |
156 default: | |
157 return TRUE; | |
158 break; | |
159 } | |
160 } | |
161 | |
162 static gchar *find_local_charset(void) | |
163 { | |
164 gchar *gg_localenc = g_getenv("GG_CHARSET"); | |
165 | |
166 if (gg_localenc == NULL) { | |
167 #ifdef HAVE_LANGINFO_CODESET | |
168 gg_localenc = nl_langinfo(CODESET); | |
169 #else | |
170 gg_localenc = "US-ASCII"; | |
171 #endif | |
172 } | |
173 return gg_localenc; | |
174 } | |
175 | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
176 static char *handle_errcode(struct gaim_connection *gc, int errcode) |
2393 | 177 { |
178 static char msg[AGG_BUF_LEN]; | |
179 | |
180 switch (errcode) { | |
181 case GG_FAILURE_RESOLVING: | |
182 g_snprintf(msg, sizeof(msg), _("Unable to resolve hostname.")); | |
183 break; | |
184 case GG_FAILURE_CONNECTING: | |
185 g_snprintf(msg, sizeof(msg), _("Unable to connect to server.")); | |
186 break; | |
187 case GG_FAILURE_INVALID: | |
188 g_snprintf(msg, sizeof(msg), _("Invalid response from server.")); | |
189 break; | |
190 case GG_FAILURE_READING: | |
191 g_snprintf(msg, sizeof(msg), _("Error while reading from socket.")); | |
192 break; | |
193 case GG_FAILURE_WRITING: | |
3100 | 194 g_snprintf(msg, sizeof(msg), _("Error while writing to socket.")); |
2393 | 195 break; |
196 case GG_FAILURE_PASSWORD: | |
3100 | 197 g_snprintf(msg, sizeof(msg), _("Authentication failed.")); |
2393 | 198 break; |
199 default: | |
200 g_snprintf(msg, sizeof(msg), _("Unknown Error Code.")); | |
201 break; | |
202 } | |
203 | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
204 hide_login_progress(gc, msg); |
2393 | 205 |
206 return msg; | |
207 } | |
208 | |
209 static void agg_set_away(struct gaim_connection *gc, char *state, char *msg) | |
210 { | |
211 struct agg_data *gd = (struct agg_data *)gc->proto_data; | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
212 int status = gd->own_status; |
2393 | 213 |
214 if (gc->away) | |
215 gc->away = NULL; | |
216 | |
217 if (!g_strcasecmp(state, AGG_STATUS_AVAIL)) | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
218 status = GG_STATUS_AVAIL; |
2393 | 219 else if (!g_strcasecmp(state, AGG_STATUS_AVAIL_FRIENDS)) |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
220 status = GG_STATUS_AVAIL | GG_STATUS_FRIENDS_MASK; |
2393 | 221 else if (!g_strcasecmp(state, AGG_STATUS_BUSY)) { |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
222 status = GG_STATUS_BUSY; |
2393 | 223 gc->away = ""; |
224 } else if (!g_strcasecmp(state, AGG_STATUS_BUSY_FRIENDS)) { | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
225 status = GG_STATUS_BUSY | GG_STATUS_FRIENDS_MASK; |
2393 | 226 gc->away = ""; |
227 } else if (!g_strcasecmp(state, AGG_STATUS_INVISIBLE)) { | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
228 status = GG_STATUS_INVISIBLE; |
2393 | 229 gc->away = ""; |
230 } else if (!g_strcasecmp(state, AGG_STATUS_INVISIBLE_FRIENDS)) { | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
231 status = GG_STATUS_INVISIBLE | GG_STATUS_FRIENDS_MASK; |
2393 | 232 gc->away = ""; |
233 } else if (!g_strcasecmp(state, AGG_STATUS_NOT_AVAIL)) { | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
234 status = GG_STATUS_NOT_AVAIL; |
2393 | 235 gc->away = ""; |
236 } else if (!g_strcasecmp(state, GAIM_AWAY_CUSTOM)) { | |
237 if (msg) { | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
238 status = GG_STATUS_BUSY; |
2393 | 239 gc->away = ""; |
240 } else | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
241 status = GG_STATUS_AVAIL; |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
242 |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
243 if (gd->own_status & GG_STATUS_FRIENDS_MASK) |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
244 status |= GG_STATUS_FRIENDS_MASK; |
2393 | 245 } |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
246 |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
247 gd->own_status = status; |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
248 gg_change_status(gd->sess, status); |
2393 | 249 } |
250 | |
251 static gchar *get_away_text(int uc) | |
252 { | |
253 if (uc == UC_UNAVAILABLE) | |
254 return AGG_STATUS_NOT_AVAIL; | |
255 uc = uc >> 5; | |
256 switch (uc) { | |
257 case GG_STATUS_AVAIL: | |
258 default: | |
259 return AGG_STATUS_AVAIL; | |
260 case GG_STATUS_AVAIL | GG_STATUS_FRIENDS_MASK: | |
261 return AGG_STATUS_AVAIL_FRIENDS; | |
262 case GG_STATUS_BUSY: | |
263 return AGG_STATUS_BUSY; | |
264 case GG_STATUS_BUSY | GG_STATUS_FRIENDS_MASK: | |
265 return AGG_STATUS_BUSY_FRIENDS; | |
266 case GG_STATUS_INVISIBLE: | |
267 return AGG_STATUS_INVISIBLE; | |
268 case GG_STATUS_INVISIBLE | GG_STATUS_FRIENDS_MASK: | |
269 return AGG_STATUS_INVISIBLE_FRIENDS; | |
270 case GG_STATUS_NOT_AVAIL: | |
271 return AGG_STATUS_NOT_AVAIL; | |
272 } | |
273 } | |
274 | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2423
diff
changeset
|
275 static GList *agg_away_states(struct gaim_connection *gc) |
2393 | 276 { |
277 GList *m = NULL; | |
278 | |
279 m = g_list_append(m, AGG_STATUS_AVAIL); | |
280 m = g_list_append(m, AGG_STATUS_BUSY); | |
281 m = g_list_append(m, AGG_STATUS_INVISIBLE); | |
282 m = g_list_append(m, AGG_STATUS_AVAIL_FRIENDS); | |
283 m = g_list_append(m, AGG_STATUS_BUSY_FRIENDS); | |
284 m = g_list_append(m, AGG_STATUS_INVISIBLE_FRIENDS); | |
285 m = g_list_append(m, AGG_STATUS_NOT_AVAIL); | |
286 return m; | |
287 } | |
288 | |
289 /* Enhance these functions, more options and such stuff */ | |
290 static GList *agg_buddy_menu(struct gaim_connection *gc, char *who) | |
291 { | |
292 GList *m = NULL; | |
293 struct proto_buddy_menu *pbm; | |
294 struct buddy *b = find_buddy(gc, who); | |
295 static char buf[AGG_BUF_LEN]; | |
296 | |
297 if (!b) { | |
298 return m; | |
299 } | |
300 | |
301 pbm = g_new0(struct proto_buddy_menu, 1); | |
302 g_snprintf(buf, sizeof(buf), _("Status: %s"), get_away_text(b->uc)); | |
303 pbm->label = buf; | |
304 pbm->callback = NULL; | |
305 pbm->gc = gc; | |
306 m = g_list_append(m, pbm); | |
307 | |
308 return m; | |
309 } | |
310 | |
311 static GList *agg_user_opts() | |
312 { | |
313 GList *m = NULL; | |
314 struct proto_user_opt *puo; | |
315 | |
316 puo = g_new0(struct proto_user_opt, 1); | |
317 puo->label = _("Nick:"); | |
318 puo->def = _("Gadu-Gadu User"); | |
319 puo->pos = USEROPT_NICK; | |
320 m = g_list_append(m, puo); | |
321 | |
322 return m; | |
323 } | |
324 | |
325 static void main_callback(gpointer data, gint source, GaimInputCondition cond) | |
326 { | |
327 struct gaim_connection *gc = data; | |
328 struct agg_data *gd = gc->proto_data; | |
329 struct gg_event *e; | |
330 | |
331 debug_printf("main_callback enter: begin\n"); | |
332 | |
333 if (gd->sess->fd != source) | |
334 gd->sess->fd = source; | |
335 | |
336 if (source == -1) { | |
2915
7a158753b8d6
[gaim-migrate @ 2928]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2856
diff
changeset
|
337 hide_login_progress(gc, _("Could not connect")); |
2393 | 338 signoff(gc); |
339 return; | |
340 } | |
341 | |
342 if (!(e = gg_watch_fd(gd->sess))) { | |
343 debug_printf("main_callback: gg_watch_fd failed - CRITICAL!\n"); | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
344 hide_login_progress(gc, _("Unable to read socket")); |
2393 | 345 signoff(gc); |
346 return; | |
347 } | |
348 | |
349 switch (e->type) { | |
350 case GG_EVENT_NONE: | |
351 /* do nothing */ | |
352 break; | |
353 case GG_EVENT_CONN_SUCCESS: | |
354 debug_printf("main_callback: CONNECTED AGAIN!?\n"); | |
355 break; | |
356 case GG_EVENT_CONN_FAILED: | |
357 if (gc->inpa) | |
358 gaim_input_remove(gc->inpa); | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
359 handle_errcode(gc, e->event.failure); |
2393 | 360 signoff(gc); |
361 break; | |
362 case GG_EVENT_MSG: | |
363 { | |
364 gchar *imsg; | |
365 gchar user[20]; | |
366 | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
367 g_snprintf(user, sizeof(user), "%lu", e->event.msg.sender); |
2393 | 368 if (!allowed_uin(gc, user)) |
369 break; | |
370 imsg = charset_convert(e->event.msg.message, "CP1250", find_local_charset()); | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
371 strip_linefeed(imsg); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
372 /* e->event.msg.time - we don't know what this time is for */ |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2846
diff
changeset
|
373 serv_got_im(gc, user, imsg, 0, time(NULL), -1); |
2393 | 374 g_free(imsg); |
375 } | |
376 break; | |
377 case GG_EVENT_NOTIFY: | |
378 { | |
379 gchar user[20]; | |
380 struct gg_notify_reply *n = e->event.notify; | |
381 guint status; | |
382 | |
383 while (n->uin) { | |
384 switch (n->status) { | |
385 case GG_STATUS_NOT_AVAIL: | |
386 status = UC_UNAVAILABLE; | |
387 break; | |
388 case GG_STATUS_AVAIL: | |
389 case GG_STATUS_BUSY: | |
390 case GG_STATUS_INVISIBLE: | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
391 status = UC_NORMAL | (n->status << 5); |
2393 | 392 break; |
393 default: | |
394 status = UC_NORMAL; | |
395 break; | |
396 } | |
397 | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
398 g_snprintf(user, sizeof(user), "%lu", n->uin); |
2393 | 399 serv_got_update(gc, user, (status == UC_UNAVAILABLE) ? 0 : 1, 0, 0, 0, |
400 status, 0); | |
401 n++; | |
402 } | |
403 } | |
404 break; | |
405 case GG_EVENT_STATUS: | |
406 { | |
407 gchar user[20]; | |
408 guint status; | |
409 | |
410 switch (e->event.status.status) { | |
411 case GG_STATUS_NOT_AVAIL: | |
412 status = UC_UNAVAILABLE; | |
413 break; | |
414 case GG_STATUS_AVAIL: | |
415 case GG_STATUS_BUSY: | |
416 case GG_STATUS_INVISIBLE: | |
417 status = UC_NORMAL | (e->event.status.status << 5); | |
418 break; | |
419 default: | |
420 status = UC_NORMAL; | |
421 break; | |
422 } | |
423 | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
424 g_snprintf(user, sizeof(user), "%lu", e->event.status.uin); |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
425 serv_got_update(gc, user, (status == UC_UNAVAILABLE) ? 0 : 1, 0, 0, 0, |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
426 status, 0); |
2393 | 427 } |
428 break; | |
429 case GG_EVENT_ACK: | |
430 debug_printf("main_callback: message %d to %u sent with status %d\n", | |
431 e->event.ack.seq, e->event.ack.recipient, e->event.ack.status); | |
432 break; | |
433 default: | |
434 debug_printf("main_callback: unsupported event %d\n", e->type); | |
435 break; | |
436 } | |
437 gg_free_event(e); | |
438 } | |
439 | |
440 static void login_callback(gpointer data, gint source, GaimInputCondition cond) | |
441 { | |
442 struct gaim_connection *gc = data; | |
443 struct agg_data *gd = gc->proto_data; | |
444 struct gg_event *e; | |
445 | |
446 if (!g_slist_find(connections, data)) { | |
447 close(source); | |
448 return; | |
449 } | |
450 | |
451 if (gd->sess->fd != source) | |
452 gd->sess->fd = source; | |
453 | |
454 if (source == -1) { | |
455 hide_login_progress(gc, _("Unable to connect.")); | |
456 signoff(gc); | |
457 return; | |
458 } | |
459 | |
460 if (gc->inpa == 0) | |
461 gc->inpa = gaim_input_add(gd->sess->fd, GAIM_INPUT_READ, login_callback, gc); | |
462 | |
463 switch (gd->sess->state) { | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
464 case GG_STATE_READING_DATA: |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
465 set_login_progress(gc, 2, _("Reading data")); |
2835
d8e67ff8022f
[gaim-migrate @ 2848]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2806
diff
changeset
|
466 break; |
2393 | 467 case GG_STATE_CONNECTING_GG: |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
468 set_login_progress(gc, 3, _("Balancer handshake")); |
2393 | 469 break; |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
470 case GG_STATE_READING_KEY: |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
471 set_login_progress(gc, 4, _("Reading server key")); |
2835
d8e67ff8022f
[gaim-migrate @ 2848]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2806
diff
changeset
|
472 break; |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
473 case GG_STATE_READING_REPLY: |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
474 set_login_progress(gc, 5, _("Exchanging key hash")); |
2393 | 475 break; |
476 default: | |
477 break; | |
478 } | |
479 | |
480 if (!(e = gg_watch_fd(gd->sess))) { | |
481 debug_printf("login_callback: gg_watch_fd failed - CRITICAL!\n"); | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
482 hide_login_progress(gc, _("Critical error in GG library\n")); |
2393 | 483 signoff(gc); |
484 return; | |
485 } | |
486 | |
487 switch (e->type) { | |
488 case GG_EVENT_NONE: | |
489 /* nothing */ | |
490 break; | |
491 case GG_EVENT_CONN_SUCCESS: | |
492 /* Setup new input handler */ | |
493 if (gc->inpa) | |
494 gaim_input_remove(gc->inpa); | |
495 gc->inpa = gaim_input_add(gd->sess->fd, GAIM_INPUT_READ, main_callback, gc); | |
496 | |
497 /* Our signon is complete */ | |
498 account_online(gc); | |
499 serv_finish_login(gc); | |
500 | |
2518
e7478176e760
[gaim-migrate @ 2531]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
501 if (bud_list_cache_exists(gc)) |
e7478176e760
[gaim-migrate @ 2531]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
502 do_import(gc, NULL); |
2393 | 503 break; |
504 case GG_EVENT_CONN_FAILED: | |
505 gaim_input_remove(gc->inpa); | |
506 gc->inpa = 0; | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
507 handle_errcode(gc, e->event.failure); |
2393 | 508 signoff(gc); |
509 break; | |
510 default: | |
511 break; | |
512 } | |
513 | |
514 gg_free_event(e); | |
515 } | |
516 | |
517 static void agg_keepalive(struct gaim_connection *gc) | |
518 { | |
519 struct agg_data *gd = (struct agg_data *)gc->proto_data; | |
520 if (gg_ping(gd->sess) < 0) { | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
521 hide_login_progress(gc, _("Unable to ping server")); |
2393 | 522 signoff(gc); |
523 return; | |
524 } | |
525 } | |
526 | |
527 static void agg_login(struct aim_user *user) | |
528 { | |
529 struct gaim_connection *gc = new_gaim_conn(user); | |
530 struct agg_data *gd = gc->proto_data = g_new0(struct agg_data, 1); | |
531 char buf[80]; | |
532 | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
533 gc->checkbox = _("Send as message"); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2681
diff
changeset
|
534 |
2393 | 535 gd->sess = g_new0(struct gg_session, 1); |
536 | |
537 if (user->proto_opt[USEROPT_NICK][0]) | |
538 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", | |
539 user->proto_opt[USEROPT_NICK]); | |
540 | |
541 set_login_progress(gc, 1, _("Looking up GG server")); | |
542 | |
543 if (invalid_uin(user->username)) { | |
544 hide_login_progress(gc, _("Invalid Gadu-Gadu UIN specified")); | |
545 signoff(gc); | |
546 return; | |
547 } | |
548 | |
549 gc->inpa = 0; | |
550 | |
551 /* | |
552 if (gg_login(gd->sess, strtol(user->username, (char **)NULL, 10), user->password, 1) < 0) { | |
553 debug_printf("uin=%u, pass=%s", strtol(user->username, (char **)NULL, 10), user->password); | |
554 hide_login_progress(gc, "Unable to connect."); | |
555 signoff(gc); | |
556 return; | |
557 } | |
558 | |
559 gg_login() sucks for me, so I'm using proxy_connect() | |
560 */ | |
561 | |
562 gd->sess->uin = (uin_t) strtol(user->username, (char **)NULL, 10); | |
563 gd->sess->password = g_strdup(user->password); | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
564 gd->sess->state = GG_STATE_CONNECTING; |
2393 | 565 gd->sess->check = GG_CHECK_WRITE; |
566 gd->sess->async = 1; | |
567 gd->sess->fd = proxy_connect(GG_APPMSG_HOST, GG_APPMSG_PORT, login_callback, gc); | |
568 | |
569 if (gd->sess->fd < 0) { | |
570 g_snprintf(buf, sizeof(buf), _("Connect to %s failed"), GG_APPMSG_HOST); | |
571 hide_login_progress(gc, buf); | |
572 signoff(gc); | |
573 return; | |
574 } | |
575 } | |
576 | |
577 static void agg_close(struct gaim_connection *gc) | |
578 { | |
579 struct agg_data *gd = (struct agg_data *)gc->proto_data; | |
580 if (gc->inpa) | |
581 gaim_input_remove(gc->inpa); | |
582 gg_logoff(gd->sess); | |
3339 | 583 gd->own_status = GG_STATUS_NOT_AVAIL; |
2393 | 584 gg_free_session(gd->sess); |
585 g_free(gc->proto_data); | |
586 } | |
587 | |
3033 | 588 static int agg_send_im(struct gaim_connection *gc, char *who, char *msg, int len, int flags) |
2393 | 589 { |
590 struct agg_data *gd = (struct agg_data *)gc->proto_data; | |
591 gchar *imsg; | |
592 | |
593 if (invalid_uin(who)) { | |
3427 | 594 do_error_dialog(_("You are trying to send a message to an invalid Gadu-Gadu UIN."), NULL, |
595 GAIM_ERROR); | |
2393 | 596 return -1; |
597 } | |
598 | |
599 if (strlen(msg) > 0) { | |
600 imsg = charset_convert(msg, find_local_charset(), "CP1250"); | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
601 if (gg_send_message(gd->sess, (flags & IM_FLAG_CHECKBOX) |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
602 ? GG_CLASS_MSG : GG_CLASS_CHAT, |
2393 | 603 strtol(who, (char **)NULL, 10), imsg) < 0) |
604 return -1; | |
605 g_free(imsg); | |
606 } | |
607 return 1; | |
608 } | |
609 | |
610 static void agg_add_buddy(struct gaim_connection *gc, char *who) | |
611 { | |
612 struct agg_data *gd = (struct agg_data *)gc->proto_data; | |
613 if (invalid_uin(who)) | |
614 return; | |
615 gg_add_notify(gd->sess, strtol(who, (char **)NULL, 10)); | |
616 } | |
617 | |
2681
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2563
diff
changeset
|
618 static void agg_rem_buddy(struct gaim_connection *gc, char *who, char *group) |
2393 | 619 { |
620 struct agg_data *gd = (struct agg_data *)gc->proto_data; | |
621 if (invalid_uin(who)) | |
622 return; | |
623 gg_remove_notify(gd->sess, strtol(who, (char **)NULL, 10)); | |
624 } | |
625 | |
626 static void agg_add_buddies(struct gaim_connection *gc, GList *whos) | |
627 { | |
628 struct agg_data *gd = (struct agg_data *)gc->proto_data; | |
629 uin_t *userlist = NULL; | |
630 int userlist_size = 0; | |
631 | |
632 while (whos) { | |
633 if (!invalid_uin(whos->data)) { | |
634 userlist_size++; | |
635 userlist = g_renew(uin_t, userlist, userlist_size); | |
636 userlist[userlist_size - 1] = | |
637 (uin_t) strtol((char *)whos->data, (char **)NULL, 10); | |
638 } | |
639 whos = g_list_next(whos); | |
640 } | |
641 | |
642 if (userlist) { | |
643 gg_notify(gd->sess, userlist, userlist_size); | |
644 g_free(userlist); | |
645 } | |
646 } | |
647 | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
648 static void search_results(struct gaim_connection *gc, gchar *webdata) |
2393 | 649 { |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
650 gchar **webdata_tbl; |
2393 | 651 gchar *buf; |
652 char *ptr; | |
653 int i, j; | |
654 | |
655 if ((ptr = strstr(webdata, "query_results:")) == NULL || (ptr = strchr(ptr, '\n')) == NULL) { | |
656 debug_printf("search_callback: pubdir result [%s]\n", webdata); | |
3427 | 657 do_error_dialog(_("Couldn't get search results"), NULL, GAIM_ERROR); |
2393 | 658 return; |
659 } | |
660 ptr++; | |
661 | |
662 buf = g_strconcat("<B>", _("Gadu-Gadu Search Engine"), "</B><BR>\n", NULL); | |
663 | |
664 webdata_tbl = g_strsplit(ptr, "\n", AGG_PUBDIR_MAX_ENTRIES); | |
665 | |
666 j = 0; | |
667 | |
668 /* Parse array */ | |
669 for (i = 0; webdata_tbl[i] != NULL; i++) { | |
670 gchar *p, *oldibuf; | |
671 static gchar *ibuf; | |
672 | |
673 g_strdelimit(webdata_tbl[i], "\t\n", ' '); | |
674 | |
675 /* GG_PUBDIR_HOST service returns 7 lines of data per directory entry */ | |
676 if (i % 8 == 0) | |
677 j = 0; | |
678 | |
679 p = charset_convert(g_strstrip(webdata_tbl[i]), "CP1250", find_local_charset()); | |
680 | |
681 oldibuf = ibuf; | |
682 | |
683 switch (j) { | |
684 case 0: | |
685 ibuf = g_strconcat("---------------------------------<BR>\n", NULL); | |
686 oldibuf = ibuf; | |
687 ibuf = g_strconcat(oldibuf, "<B>", _("Active"), ":</B> ", | |
688 (atoi(p) == 2) ? _("yes") : _("no"), "<BR>\n", NULL); | |
689 g_free(oldibuf); | |
690 break; | |
691 case 1: | |
692 ibuf = g_strconcat(oldibuf, "<B>", _("UIN"), ":</B> ", p, "<BR>\n", NULL); | |
693 g_free(oldibuf); | |
694 break; | |
695 case 2: | |
696 ibuf = g_strconcat(oldibuf, "<B>", _("First name"), ":</B> ", p, "<BR>\n", NULL); | |
697 g_free(oldibuf); | |
698 break; | |
699 case 3: | |
700 ibuf = | |
701 g_strconcat(oldibuf, "<B>", _("Second Name"), ":</B> ", p, "<BR>\n", NULL); | |
702 g_free(oldibuf); | |
703 break; | |
704 case 4: | |
705 ibuf = g_strconcat(oldibuf, "<B>", _("Nick"), ":</B> ", p, "<BR>\n", NULL); | |
706 g_free(oldibuf); | |
707 break; | |
708 case 5: | |
709 /* Hack, invalid_uin does what we really want here but may change in future */ | |
710 if (invalid_uin(p)) | |
711 ibuf = | |
712 g_strconcat(oldibuf, "<B>", _("Birth year"), ":</B> <BR>\n", NULL); | |
713 else | |
714 ibuf = | |
715 g_strconcat(oldibuf, "<B>", _("Birth year"), ":</B> ", p, "<BR>\n", | |
716 NULL); | |
717 g_free(oldibuf); | |
718 break; | |
719 case 6: | |
720 if (atoi(p) == GG_GENDER_FEMALE) | |
721 ibuf = g_strconcat(oldibuf, "<B>", _("Sex"), ":</B> woman<BR>\n", NULL); | |
722 else if (atoi(p) == GG_GENDER_MALE) | |
723 ibuf = g_strconcat(oldibuf, "<B>", _("Sex"), ":</B> man<BR>\n", NULL); | |
724 else | |
725 ibuf = g_strconcat(oldibuf, "<B>", _("Sex"), ":</B> <BR>\n", NULL); | |
726 g_free(oldibuf); | |
727 break; | |
728 case 7: | |
729 ibuf = g_strconcat(oldibuf, "<B>", _("City"), ":</B> ", p, "<BR>\n", NULL); | |
730 g_free(oldibuf); | |
731 | |
732 /* We have all lines, so add them to buffer */ | |
733 { | |
734 gchar *oldbuf = buf; | |
735 buf = g_strconcat(oldbuf, ibuf, NULL); | |
736 g_free(oldbuf); | |
737 } | |
738 | |
739 g_free(ibuf); | |
740 break; | |
741 } | |
742 | |
743 g_free(p); | |
744 | |
745 j++; | |
746 } | |
747 | |
748 g_strfreev(webdata_tbl); | |
749 | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2773
diff
changeset
|
750 g_show_info_text(gc, NULL, 2, buf, NULL); |
2393 | 751 |
752 g_free(buf); | |
753 } | |
754 | |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
755 static void import_buddies_server_results(struct gaim_connection *gc, gchar *webdata) |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
756 { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
757 gchar *ptr; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
758 gchar **users_tbl; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
759 int i; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
760 if (strstr(webdata, "no_data:")) { |
3427 | 761 do_error_dialog(_("There is no Buddy List stored on the Gadu-Gadu server."), NULL, GAIM_ERROR); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
762 return; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
763 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
764 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
765 if ((ptr = strstr(webdata, "get_results:")) == NULL || (ptr = strchr(ptr, ':')) == NULL) { |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
766 debug_printf("import_buddies_server_results: import buddies result [%s]\n", webdata); |
3427 | 767 do_error_dialog(_("Couldn't Import Buddies List from Server"), NULL, GAIM_ERROR); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
768 return; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
769 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
770 ptr++; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
771 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
772 users_tbl = g_strsplit(ptr, "\n", AGG_PUBDIR_MAX_ENTRIES); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
773 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
774 /* Parse array of Buddies List */ |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
775 for (i = 0; users_tbl[i] != NULL; i++) { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
776 gchar **data_tbl; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
777 gchar *name, *show; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
778 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
779 g_strdelimit(users_tbl[i], "\r\t\n\015", ' '); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
780 data_tbl = g_strsplit(users_tbl[i], ";", 8); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
781 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
782 show = data_tbl[3]; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
783 name = data_tbl[6]; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
784 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
785 if (invalid_uin(name)) { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
786 continue; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
787 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
788 |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
789 debug_printf("import_buddies_server_results: uin: %s\n", name); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
790 if (!find_buddy(gc, name)) { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
791 /* Default group if none specified on server */ |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
792 gchar *group = g_strdup("Gadu-Gadu"); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
793 if (strlen(data_tbl[5])) { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
794 gchar **group_tbl = g_strsplit(data_tbl[5], ",", 2); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
795 if (strlen(group_tbl[0])) { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
796 g_free(group); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
797 group = g_strdup(group_tbl[0]); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
798 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
799 g_strfreev(group_tbl); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
800 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
801 /* Add Buddy to our userlist */ |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
802 add_buddy(gc, group, name, strlen(show) ? show : name); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
803 do_export(gc); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
804 g_free(group); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
805 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
806 g_strfreev(data_tbl); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
807 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
808 g_strfreev(users_tbl); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
809 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
810 |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
811 static void export_buddies_server_results(struct gaim_connection *gc, gchar *webdata) |
2393 | 812 { |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
813 if (strstr(webdata, "put_success:")) { |
3427 | 814 do_error_dialog(_("Buddy List successfully transferred to Gadu-Gadu server"), NULL, GAIM_INFO); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
815 return; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
816 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
817 |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
818 debug_printf("export_buddies_server_results: webdata [%s]\n", webdata); |
3427 | 819 do_error_dialog(_("Couldn't transfer Buddy List to Gadu-Gadu server"), NULL, GAIM_ERROR); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
820 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
821 |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
822 static void delete_buddies_server_results(struct gaim_connection *gc, gchar *webdata) |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
823 { |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
824 if (strstr(webdata, "put_success:")) { |
3427 | 825 do_error_dialog(_("Buddy List sucessfully deleted from Gadu-Gadu server"), NULL, GAIM_INFO); |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
826 return; |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
827 } |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
828 |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
829 debug_printf("delete_buddies_server_results: webdata [%s]\n", webdata); |
3427 | 830 do_error_dialog(_("Couldn't delete Buddy List from Gadu-Gadu server"), NULL, GAIM_ERROR); |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
831 } |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
832 |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
833 static void password_change_server_results(struct gaim_connection *gc, gchar *webdata) |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
834 { |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
835 if (strstr(webdata, "reg_success:")) { |
3427 | 836 do_error_dialog(_("Password changed successfully"), NULL, GAIM_INFO); |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
837 return; |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
838 } |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
839 |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
840 debug_printf("delete_buddies_server_results: webdata [%s]\n", webdata); |
3427 | 841 do_error_dialog(_("Password couldn't be changed"), NULL, GAIM_ERROR); |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
842 } |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
843 |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
844 static void http_results(gpointer data, gint source, GaimInputCondition cond) |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
845 { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
846 struct agg_http *hdata = data; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
847 struct gaim_connection *gc = hdata->gc; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
848 char *webdata; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
849 int len; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
850 char read_data; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
851 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
852 debug_printf("http_results: begin\n"); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
853 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
854 if (!g_slist_find(connections, gc)) { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
855 debug_printf("search_callback: g_slist_find error\n"); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
856 gaim_input_remove(hdata->inpa); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
857 g_free(hdata); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
858 close(source); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
859 return; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
860 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
861 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
862 webdata = NULL; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
863 len = 0; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
864 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
865 while (read(source, &read_data, 1) > 0 || errno == EWOULDBLOCK) { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
866 if (errno == EWOULDBLOCK) { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
867 errno = 0; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
868 continue; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
869 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
870 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
871 if (!read_data) |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
872 continue; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
873 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
874 len++; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
875 webdata = g_realloc(webdata, len); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
876 webdata[len - 1] = read_data; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
877 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
878 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
879 webdata = g_realloc(webdata, len + 1); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
880 webdata[len] = 0; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
881 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
882 gaim_input_remove(hdata->inpa); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
883 close(source); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
884 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
885 debug_printf("http_results: type %d, webdata [%s]\n", hdata->type, webdata); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
886 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
887 switch (hdata->type) { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
888 case AGG_HTTP_SEARCH: |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
889 search_results(gc, webdata); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
890 break; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
891 case AGG_HTTP_USERLIST_IMPORT: |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
892 import_buddies_server_results(gc, webdata); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
893 break; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
894 case AGG_HTTP_USERLIST_EXPORT: |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
895 export_buddies_server_results(gc, webdata); |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
896 break; |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
897 case AGG_HTTP_USERLIST_DELETE: |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
898 delete_buddies_server_results(gc, webdata); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
899 break; |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
900 case AGG_HTTP_PASSWORD_CHANGE: |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
901 password_change_server_results(gc, webdata); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
902 break; |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
903 case AGG_HTTP_NONE: |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
904 default: |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
905 debug_printf("http_results: unsupported type %d\n", hdata->type); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
906 break; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
907 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
908 |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
909 g_free(webdata); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
910 g_free(hdata); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
911 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
912 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
913 static void http_req_callback(gpointer data, gint source, GaimInputCondition cond) |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
914 { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
915 struct agg_http *hdata = data; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
916 struct gaim_connection *gc = hdata->gc; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
917 gchar *request = hdata->request; |
2393 | 918 gchar *buf; |
919 | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
920 debug_printf("http_req_callback: begin\n"); |
2393 | 921 |
922 if (!g_slist_find(connections, gc)) { | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
923 debug_printf("http_req_callback: g_slist_find error\n"); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
924 g_free(request); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
925 g_free(hdata); |
2393 | 926 close(source); |
927 return; | |
928 } | |
929 | |
930 if (source == -1) { | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
931 g_free(request); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
932 g_free(hdata); |
2393 | 933 return; |
934 } | |
935 | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
936 debug_printf("http_req_callback: http request [%s]\n", request); |
2393 | 937 |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
938 buf = g_strdup_printf("POST %s HTTP/1.0\r\n" |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
939 "Host: %s\r\n" |
2393 | 940 "Content-Type: application/x-www-form-urlencoded\r\n" |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
941 "User-Agent: " GG_HTTP_USERAGENT "\r\n" |
2393 | 942 "Content-Length: %d\r\n" |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
943 "Pragma: no-cache\r\n" "\r\n" "%s\r\n", |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
944 hdata->form, hdata->host, strlen(request), request); |
2393 | 945 |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
946 g_free(request); |
2393 | 947 |
948 if (write(source, buf, strlen(buf)) < strlen(buf)) { | |
949 g_free(buf); | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
950 g_free(hdata); |
2393 | 951 close(source); |
3427 | 952 do_error_dialog(_("Error communicating with Gadu-Gadu server"), |
953 _("Gaim was unable to complete your request due to a problem " | |
954 "communicating to the Gadu-Gadu HTTP server. Please try again " | |
955 "later."), GAIM_ERROR); | |
2393 | 956 return; |
957 } | |
958 | |
959 g_free(buf); | |
960 | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
961 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
|
962 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
963 |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
964 static void import_buddies_server(struct gaim_connection *gc) |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
965 { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
966 struct agg_http *hi = g_new0(struct agg_http, 1); |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
967 gchar *u = gg_urlencode(gc->username); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
968 gchar *p = gg_urlencode(gc->password); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
969 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
970 hi->gc = gc; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
971 hi->type = AGG_HTTP_USERLIST_IMPORT; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
972 hi->form = AGG_PUBDIR_USERLIST_IMPORT_FORM; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
973 hi->host = GG_PUBDIR_HOST; |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
974 hi->request = g_strdup_printf("FmNum=%s&Pass=%s", u, p); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
975 |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
976 g_free(u); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
977 g_free(p); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
978 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
979 if (proxy_connect(GG_PUBDIR_HOST, GG_PUBDIR_PORT, http_req_callback, hi) < 0) { |
3427 | 980 do_error_dialog(_("Unable to import Gadu-Gadu buddy list"), |
981 _("Gaim was unable to connect to the Gadu-Gadu buddy list " | |
982 "server. Please try again later."), GAIM_ERROR); | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
983 g_free(hi->request); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
984 g_free(hi); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
985 return; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
986 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
987 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
988 |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
989 static void export_buddies_server(struct gaim_connection *gc) |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
990 { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
991 struct agg_http *he = g_new0(struct agg_http, 1); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
992 gchar *ptr; |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
993 gchar *u = gg_urlencode(gc->username); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
994 gchar *p = gg_urlencode(gc->password); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
995 |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
996 GSList *gr = gc->groups; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
997 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
998 he->gc = gc; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
999 he->type = AGG_HTTP_USERLIST_EXPORT; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1000 he->form = AGG_PUBDIR_USERLIST_EXPORT_FORM; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1001 he->host = GG_PUBDIR_HOST; |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1002 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
|
1003 |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1004 g_free(u); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1005 g_free(p); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1006 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1007 while (gr) { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1008 struct group *g = gr->data; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1009 GSList *m = g->members; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1010 while (m) { |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1011 struct buddy *b = m->data; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1012 gchar *newdata; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1013 /* GG Number */ |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1014 gchar *name = gg_urlencode(b->name); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1015 /* GG Pseudo */ |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1016 gchar *show = gg_urlencode(strlen(b->show) ? b->show : b->name); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1017 /* Group Name */ |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1018 gchar *gname = gg_urlencode(g->name); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1019 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1020 ptr = he->request; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1021 newdata = g_strdup_printf("%s;%s;%s;%s;%s;%s;%s\r\n", |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1022 show, show, show, show, "", gname, name); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1023 he->request = g_strconcat(ptr, newdata, NULL); |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1024 |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1025 g_free(newdata); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1026 g_free(ptr); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1027 |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1028 g_free(gname); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1029 g_free(show); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1030 g_free(name); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1031 |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1032 m = g_slist_next(m); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1033 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1034 gr = g_slist_next(gr); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1035 } |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1036 |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1037 if (proxy_connect(GG_PUBDIR_HOST, GG_PUBDIR_PORT, http_req_callback, he) < 0) { |
3427 | 1038 do_error_dialog(_("Couldn't export buddy list"), |
1039 _("Gaim was unable to connect to the buddy list server. " | |
1040 "Please try again later."), GAIM_ERROR); | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1041 g_free(he->request); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1042 g_free(he); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1043 return; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1044 } |
2393 | 1045 } |
1046 | |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1047 static void delete_buddies_server(struct gaim_connection *gc) |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1048 { |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1049 struct agg_http *he = g_new0(struct agg_http, 1); |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1050 gchar *u = gg_urlencode(gc->username); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1051 gchar *p = gg_urlencode(gc->password); |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1052 |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1053 he->gc = gc; |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1054 he->type = AGG_HTTP_USERLIST_DELETE; |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1055 he->form = AGG_PUBDIR_USERLIST_EXPORT_FORM; |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1056 he->host = GG_PUBDIR_HOST; |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1057 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
|
1058 |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1059 if (proxy_connect(GG_PUBDIR_HOST, GG_PUBDIR_PORT, http_req_callback, he) < 0) { |
3427 | 1060 do_error_dialog(_("Unable to delete Gadu-Gadu buddy list"), |
1061 _("Gaim was unable to connect to the buddy list server. " | |
1062 "Please try again later."), GAIM_ERROR); | |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1063 g_free(he->request); |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1064 g_free(he); |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1065 return; |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1066 } |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1067 } |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1068 |
2393 | 1069 static void agg_dir_search(struct gaim_connection *gc, char *first, char *middle, |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1070 char *last, char *maiden, char *city, char *state, |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1071 char *country, char *email) |
2393 | 1072 { |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1073 struct agg_http *srch = g_new0(struct agg_http, 1); |
2393 | 1074 srch->gc = gc; |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1075 srch->type = AGG_HTTP_SEARCH; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1076 srch->form = AGG_PUBDIR_SEARCH_FORM; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1077 srch->host = GG_PUBDIR_HOST; |
2393 | 1078 |
1079 if (email && strlen(email)) { | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1080 gchar *eemail = gg_urlencode(email); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1081 srch->request = g_strdup_printf("Mode=1&Email=%s", eemail); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1082 g_free(eemail); |
2393 | 1083 } else { |
1084 gchar *new_first = charset_convert(first, find_local_charset(), "CP1250"); | |
1085 gchar *new_last = charset_convert(last, find_local_charset(), "CP1250"); | |
1086 gchar *new_city = charset_convert(city, find_local_charset(), "CP1250"); | |
1087 | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1088 gchar *enew_first = gg_urlencode(new_first); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1089 gchar *enew_last = gg_urlencode(new_last); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1090 gchar *enew_city = gg_urlencode(new_city); |
2393 | 1091 |
1092 g_free(new_first); | |
1093 g_free(new_last); | |
1094 g_free(new_city); | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1095 |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1096 /* For active only add &ActiveOnly= */ |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1097 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
|
1098 "&NickName=%s&City=%s&MinBirth=%d&MaxBirth=%d", |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1099 enew_first, enew_last, AGG_GENDER_NONE, |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1100 "", enew_city, 0, 0); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1101 |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1102 g_free(enew_first); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1103 g_free(enew_last); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1104 g_free(enew_city); |
2393 | 1105 } |
1106 | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1107 if (proxy_connect(GG_PUBDIR_HOST, GG_PUBDIR_PORT, http_req_callback, srch) < 0) { |
3427 | 1108 do_error_dialog(_("Unable to access directory"), |
1109 _("Gaim was unable to search the Directory because it " | |
1110 "was unable to connect to the directory server. Please try" | |
1111 "again later."), GAIM_ERROR); | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1112 g_free(srch->request); |
2393 | 1113 g_free(srch); |
1114 return; | |
1115 } | |
1116 } | |
1117 | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1118 static void agg_change_passwd(struct gaim_connection *gc, char *old, char *new) |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1119 { |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1120 struct agg_http *hpass = g_new0(struct agg_http, 1); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1121 gchar *u = gg_urlencode(gc->username); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1122 gchar *p = gg_urlencode(gc->password); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1123 gchar *enew = gg_urlencode(new); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1124 gchar *eold = gg_urlencode(old); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1125 |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1126 hpass->gc = gc; |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1127 hpass->type = AGG_HTTP_PASSWORD_CHANGE; |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1128 hpass->form = AGG_REGISTER_DATA_FORM; |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1129 hpass->host = GG_REGISTER_HOST; |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1130 |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1131 /* 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
|
1132 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
|
1133 u, p, enew, eold, gg_http_hash(old, new)); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1134 |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1135 g_free(u); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1136 g_free(p); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1137 g_free(enew); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1138 g_free(eold); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1139 |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1140 if (proxy_connect(GG_REGISTER_HOST, GG_REGISTER_PORT, http_req_callback, hpass) < 0) { |
3427 | 1141 do_error_dialog(_("Unable to change Gadu-Gadu password"), |
1142 _("Gaim was unable to change your password due to an error connecting " | |
1143 "to the Gadu-Gadu server. Please try again later."), GAIM_ERROR); | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1144 g_free(hpass->request); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1145 g_free(hpass); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1146 return; |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1147 } |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1148 } |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1149 |
2393 | 1150 static void agg_do_action(struct gaim_connection *gc, char *action) |
1151 { | |
1152 if (!strcmp(action, _("Directory Search"))) { | |
1153 show_find_info(gc); | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1154 } else if (!strcmp(action, _("Change Password"))) { |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1155 show_change_passwd(gc); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1156 } else if (!strcmp(action, _("Import Buddies List from Server"))) { |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1157 import_buddies_server(gc); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1158 } else if (!strcmp(action, _("Export Buddies List to Server"))) { |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1159 export_buddies_server(gc); |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1160 } else if (!strcmp(action, _("Delete Buddies List from Server"))) { |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1161 delete_buddies_server(gc); |
2393 | 1162 } |
1163 } | |
1164 | |
1165 static GList *agg_actions() | |
1166 { | |
1167 GList *m = NULL; | |
1168 | |
1169 m = g_list_append(m, _("Directory Search")); | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1170 m = g_list_append(m, NULL); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1171 m = g_list_append(m, _("Change Password")); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1172 m = g_list_append(m, NULL); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1173 m = g_list_append(m, _("Import Buddies List from Server")); |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1174 m = g_list_append(m, _("Export Buddies List to Server")); |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
1175 m = g_list_append(m, _("Delete Buddies List from Server")); |
2393 | 1176 |
1177 return m; | |
1178 } | |
1179 | |
1180 static void agg_get_info(struct gaim_connection *gc, char *who) | |
1181 { | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1182 struct agg_http *srch = g_new0(struct agg_http, 1); |
2393 | 1183 srch->gc = gc; |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1184 srch->type = AGG_HTTP_SEARCH; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1185 srch->form = AGG_PUBDIR_SEARCH_FORM; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1186 srch->host = GG_PUBDIR_HOST; |
2393 | 1187 |
1188 /* If it's invalid uin then maybe it's nickname? */ | |
1189 if (invalid_uin(who)) { | |
1190 gchar *new_who = charset_convert(who, find_local_charset(), "CP1250"); | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1191 gchar *enew_who = gg_urlencode(new_who); |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1192 |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1193 g_free(new_who); |
2393 | 1194 |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1195 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
|
1196 "&NickName=%s&City=%s&MinBirth=%d&MaxBirth=%d", |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1197 "", "", AGG_GENDER_NONE, enew_who, "", 0, 0); |
2393 | 1198 |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1199 g_free(enew_who); |
2393 | 1200 } else |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1201 srch->request = g_strdup_printf("Mode=3&UserId=%s", who); |
2393 | 1202 |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1203 if (proxy_connect(GG_PUBDIR_HOST, GG_PUBDIR_PORT, http_req_callback, srch) < 0) { |
3427 | 1204 do_error_dialog(_("Unable to access user profile."), |
1205 _("Gaim was unable to access this users profile due to an error " | |
1206 "connecting to the directory server. Please try again later."), GAIM_ERROR); | |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
1207 g_free(srch->request); |
2393 | 1208 g_free(srch); |
1209 return; | |
1210 } | |
1211 } | |
1212 | |
1213 static char **agg_list_icon(int uc) | |
1214 { | |
1215 guint status; | |
1216 if (uc == UC_UNAVAILABLE) | |
1217 return (char **)gg_sunred_xpm; | |
1218 status = uc >> 5; | |
1219 /* Drop all masks */ | |
1220 status &= ~(GG_STATUS_FRIENDS_MASK); | |
1221 if (status == GG_STATUS_AVAIL) | |
1222 return (char **)gg_sunyellow_xpm; | |
1223 if (status == GG_STATUS_BUSY) | |
1224 return (char **)gg_suncloud_xpm; | |
1225 if (status == GG_STATUS_INVISIBLE) | |
1226 return (char **)gg_sunwhitered_xpm; | |
1227 return (char **)gg_sunyellow_xpm; | |
1228 } | |
1229 | |
1230 static void agg_set_permit_deny_dummy(struct gaim_connection *gc) | |
1231 { | |
1232 /* It's implemented on client side because GG server doesn't support this */ | |
1233 } | |
1234 | |
1235 static void agg_permit_deny_dummy(struct gaim_connection *gc, char *who) | |
1236 { | |
1237 /* It's implemented on client side because GG server doesn't support this */ | |
1238 } | |
1239 | |
1240 static struct prpl *my_protocol = NULL; | |
1241 | |
2423
ce09589b7681
[gaim-migrate @ 2436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2393
diff
changeset
|
1242 void gg_init(struct prpl *ret) |
2393 | 1243 { |
1244 ret->protocol = PROTO_GADUGADU; | |
1245 ret->options = 0; | |
1246 ret->name = agg_name; | |
1247 ret->list_icon = agg_list_icon; | |
1248 ret->away_states = agg_away_states; | |
1249 ret->actions = agg_actions; | |
1250 ret->do_action = agg_do_action; | |
1251 ret->user_opts = agg_user_opts; | |
1252 ret->buddy_menu = agg_buddy_menu; | |
1253 ret->chat_info = NULL; | |
1254 ret->login = agg_login; | |
1255 ret->close = agg_close; | |
1256 ret->send_im = agg_send_im; | |
1257 ret->set_info = NULL; | |
1258 ret->get_info = agg_get_info; | |
1259 ret->set_away = agg_set_away; | |
1260 ret->set_dir = NULL; | |
1261 ret->get_dir = agg_get_info; | |
1262 ret->dir_search = agg_dir_search; | |
1263 ret->set_idle = NULL; | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1264 ret->change_passwd = agg_change_passwd; |
2393 | 1265 ret->add_buddy = agg_add_buddy; |
1266 ret->add_buddies = agg_add_buddies; | |
1267 ret->remove_buddy = agg_rem_buddy; | |
1268 ret->add_permit = agg_permit_deny_dummy; | |
1269 ret->add_deny = agg_permit_deny_dummy; | |
1270 ret->rem_permit = agg_permit_deny_dummy; | |
1271 ret->rem_deny = agg_permit_deny_dummy; | |
1272 ret->set_permit_deny = agg_set_permit_deny_dummy; | |
1273 ret->warn = NULL; | |
1274 ret->join_chat = NULL; | |
1275 ret->chat_invite = NULL; | |
1276 ret->chat_leave = NULL; | |
1277 ret->chat_whisper = NULL; | |
1278 ret->chat_send = NULL; | |
1279 ret->keepalive = agg_keepalive; | |
1280 ret->normalize = NULL; | |
1281 my_protocol = ret; | |
1282 } | |
1283 | |
1284 #ifndef STATIC | |
1285 | |
1286 char *gaim_plugin_init(GModule *handle) | |
1287 { | |
2423
ce09589b7681
[gaim-migrate @ 2436]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2393
diff
changeset
|
1288 load_protocol(gg_init, sizeof(struct prpl)); |
2393 | 1289 return NULL; |
1290 } | |
1291 | |
1292 void gaim_plugin_remove() | |
1293 { | |
1294 struct prpl *p = find_prpl(PROTO_GADUGADU); | |
1295 if (p == my_protocol) | |
1296 unload_protocol(p); | |
1297 } | |
1298 | |
1299 char *name() | |
1300 { | |
1301 return "Gadu-Gadu"; | |
1302 } | |
1303 | |
1304 char *description() | |
1305 { | |
1306 return PRPL_DESC("Gadu-Gadu"); | |
1307 } | |
1308 | |
1309 #endif | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1310 |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1311 /* |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1312 * Local variables: |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1313 * c-indentation-style: k&r |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1314 * c-basic-offset: 8 |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1315 * indent-tabs-mode: notnil |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1316 * End: |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1317 * |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1318 * vim: shiftwidth=8: |
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1319 */ |