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