Mercurial > pidgin.yaz
annotate src/toc.c @ 937:189b780c1e07
[gaim-migrate @ 947]
remove printf
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Thu, 28 Sep 2000 02:06:05 +0000 |
parents | a88af4cc626a |
children | 9fca1293f871 |
rev | line source |
---|---|
1 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 | |
22 | |
23 | |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
333
diff
changeset
|
24 #ifdef HAVE_CONFIG_H |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
333
diff
changeset
|
25 #include "../config.h" |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
333
diff
changeset
|
26 #endif |
1 | 27 #include <netdb.h> |
28 #include <gtk/gtk.h> | |
29 #include <unistd.h> | |
30 #include <errno.h> | |
31 #include <netinet/in.h> | |
32 #include <arpa/inet.h> | |
33 #include <string.h> | |
34 #include <stdlib.h> | |
35 #include <stdio.h> | |
36 #include <time.h> | |
37 #include <sys/socket.h> | |
38 #include "gaim.h" | |
39 #include "gnome_applet_mgr.h" | |
40 | |
41 | |
42 | |
43 /* descriptor for talking to TOC */ | |
44 static int toc_fd; | |
45 static int seqno; | |
46 static unsigned int peer_ver=0; | |
47 static int state; | |
48 static int inpa=-1; | |
49 #ifdef _WIN32 | |
50 static int win32_r; | |
51 #endif | |
52 | |
53 int toc_signon(char *username, char *password); | |
54 | |
55 | |
56 | |
57 int toc_login(char *username, char *password) | |
58 { | |
59 char *config; | |
60 struct in_addr *sin; | |
61 struct aim_user *u; | |
62 char buf[80]; | |
63 char buf2[2048]; | |
64 | |
65 g_snprintf(buf, sizeof(buf), "Looking up %s", aim_host); | |
66 set_login_progress(1, buf); | |
67 | |
68 sin = (struct in_addr *)get_address(aim_host); | |
69 if (!sin) { | |
70 | |
71 #ifdef USE_APPLET | |
746
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
710
diff
changeset
|
72 set_user_state(offline); |
1 | 73 #endif /* USE_APPLET */ |
74 set_state(STATE_OFFLINE); | |
75 g_snprintf(buf, sizeof(buf), "Unable to lookup %s", aim_host); | |
76 hide_login_progress(buf); | |
77 return -1; | |
78 } | |
79 | |
80 g_snprintf(toc_addy, sizeof(toc_addy), "%s", inet_ntoa(*sin)); | |
81 g_snprintf(buf, sizeof(buf), "Connecting to %s", inet_ntoa(*sin)); | |
82 | |
83 set_login_progress(2, buf); | |
84 | |
85 | |
86 | |
87 toc_fd = connect_address(sin->s_addr, aim_port); | |
88 | |
89 if (toc_fd < 0) { | |
90 #ifdef USE_APPLET | |
746
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
710
diff
changeset
|
91 set_user_state(offline); |
1 | 92 #endif /* USE_APPLET */ |
93 set_state(STATE_OFFLINE); | |
94 g_snprintf(buf, sizeof(buf), "Connect to %s failed", | |
95 inet_ntoa(*sin)); | |
96 hide_login_progress(buf); | |
97 return -1; | |
98 } | |
99 | |
100 g_free(sin); | |
101 | |
102 g_snprintf(buf, sizeof(buf), "Signon: %s",username); | |
103 | |
104 set_login_progress(3, buf); | |
105 | |
106 if (toc_signon(username, password) < 0) { | |
107 #ifdef USE_APPLET | |
746
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
710
diff
changeset
|
108 set_user_state(offline); |
1 | 109 #endif /* USE_APPLET */ |
110 set_state(STATE_OFFLINE); | |
111 hide_login_progress("Disconnected."); | |
112 return -1; | |
113 } | |
114 | |
115 g_snprintf(buf, sizeof(buf), "Waiting for reply..."); | |
116 set_login_progress(4, buf); | |
117 if (toc_wait_signon() < 0) { | |
118 #ifdef USE_APPLET | |
746
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
710
diff
changeset
|
119 set_user_state(offline); |
1 | 120 #endif /* USE_APPLET */ |
121 set_state(STATE_OFFLINE); | |
122 hide_login_progress("Authentication Failed"); | |
123 return -1; | |
124 } | |
125 | |
126 u = find_user(username); | |
127 | |
128 if (!u) { | |
129 u = g_new0(struct aim_user, 1); | |
130 g_snprintf(u->user_info, sizeof(u->user_info), DEFAULT_INFO); | |
131 aim_users = g_list_append(aim_users, u); | |
132 } | |
133 | |
134 current_user = u; | |
135 | |
136 g_snprintf(current_user->username, sizeof(current_user->username), "%s", username); | |
137 g_snprintf(current_user->password, sizeof(current_user->password), "%s", password); | |
138 | |
139 save_prefs(); | |
140 | |
141 g_snprintf(buf, sizeof(buf), "Retrieving config..."); | |
142 set_login_progress(5, buf); | |
300
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
143 config = toc_wait_config(); |
301
f905caee43ca
[gaim-migrate @ 311]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
300
diff
changeset
|
144 state = STATE_ONLINE; |
1 | 145 |
746
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
710
diff
changeset
|
146 gtk_widget_hide(mainwindow); |
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
710
diff
changeset
|
147 show_buddy_list(); |
1 | 148 #ifdef USE_APPLET |
10 | 149 if (general_options & OPT_GEN_APP_BUDDY_SHOW) { |
746
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
710
diff
changeset
|
150 refresh_buddy_window(); |
50 | 151 createOnlinePopup(); |
746
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
710
diff
changeset
|
152 applet_buddy_show = TRUE; |
1 | 153 } else { |
746
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
710
diff
changeset
|
154 gtk_widget_hide(blist); |
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
710
diff
changeset
|
155 applet_buddy_show = FALSE; |
1 | 156 } |
157 | |
746
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
710
diff
changeset
|
158 set_user_state(online); |
1 | 159 #else |
746
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
710
diff
changeset
|
160 refresh_buddy_window(); |
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
710
diff
changeset
|
161 #endif |
300
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
162 if (config != NULL) |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
163 parse_toc_buddy_list(config, 0); |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
164 else |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
165 do_import(0, 0); |
1 | 166 |
774
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
762
diff
changeset
|
167 setup_buddy_chats(); |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
762
diff
changeset
|
168 |
1 | 169 g_snprintf(buf2, sizeof(buf2), "toc_init_done"); |
170 sflap_send(buf2, -1, TYPE_DATA); | |
171 | |
211
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
172 g_snprintf(buf2, sizeof(buf2), "toc_set_caps %s %s %s %s %s", |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
173 FILE_SEND_UID, FILE_GET_UID, B_ICON_UID, IMAGE_UID, |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
174 VOICE_UID); |
1 | 175 sflap_send(buf2, -1, TYPE_DATA); |
149 | 176 |
930
a88af4cc626a
[gaim-migrate @ 940]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
866
diff
changeset
|
177 if (keepalv < 0) |
a88af4cc626a
[gaim-migrate @ 940]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
866
diff
changeset
|
178 update_keepalive(general_options & OPT_GEN_KEEPALIVE); |
a88af4cc626a
[gaim-migrate @ 940]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
866
diff
changeset
|
179 |
1 | 180 serv_finish_login(); |
181 return 0; | |
182 } | |
183 | |
184 void toc_close() | |
185 { | |
186 #ifdef USE_APPLET | |
746
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
710
diff
changeset
|
187 set_user_state(offline); |
1 | 188 #endif /* USE_APPLET */ |
189 seqno = 0; | |
190 state = STATE_OFFLINE; | |
191 if (inpa > 0) | |
192 gdk_input_remove(inpa); | |
193 close(toc_fd); | |
194 toc_fd=-1; | |
195 inpa=-1; | |
196 } | |
197 | |
198 unsigned char *roast_password(char *pass) | |
199 { | |
200 /* Trivial "encryption" */ | |
201 static char rp[256]; | |
202 static char *roast = ROAST; | |
203 int pos=2; | |
204 int x; | |
205 strcpy(rp, "0x"); | |
206 for (x=0;(x<150) && pass[x]; x++) | |
207 pos+=sprintf(&rp[pos],"%02x", pass[x] ^ roast[x % strlen(roast)]); | |
208 rp[pos]='\0'; | |
209 return rp; | |
210 } | |
211 | |
212 | |
213 char *print_header(void *hdr_v) | |
214 { | |
215 static char s[80]; | |
216 struct sflap_hdr *hdr = (struct sflap_hdr *)hdr_v; | |
217 g_snprintf(s,sizeof(s), "[ ast: %c, type: %d, seqno: %d, len: %d ]", | |
218 hdr->ast, hdr->type, ntohs(hdr->seqno), ntohs(hdr->len)); | |
219 return s; | |
220 } | |
221 | |
222 void print_buffer(char *buf, int len) | |
223 { | |
224 #if 0 | |
225 int x; | |
226 printf("[ "); | |
227 for (x=0;x<len;x++) | |
228 printf("%d ", buf[x]); | |
229 printf("]\n"); | |
230 printf("[ "); | |
231 for (x=0;x<len;x++) | |
232 printf("%c ", buf[x]); | |
233 printf("]\n"); | |
234 #endif | |
235 } | |
236 | |
237 int sflap_send(char *buf, int olen, int type) | |
238 { | |
239 int len; | |
240 int slen=0; | |
241 struct sflap_hdr hdr; | |
242 char obuf[MSG_LEN]; | |
243 | |
244 /* One _last_ 2048 check here! This shouldn't ever | |
245 * get hit though, hopefully. If it gets hit on an IM | |
246 * It'll lose the last " and the message won't go through, | |
247 * but this'll stop a segfault. */ | |
248 if (strlen(buf) > (MSG_LEN - sizeof(hdr))) { | |
249 buf[MSG_LEN - sizeof(hdr) - 3] = '"'; | |
250 buf[MSG_LEN - sizeof(hdr) - 2] = '\0'; | |
251 } | |
252 | |
253 sprintf(debug_buff,"%s [Len %d]\n", buf, strlen(buf)); | |
254 debug_print(debug_buff); | |
255 | |
256 | |
257 | |
258 if (olen < 0) | |
259 len = escape_message(buf); | |
260 else | |
261 len = olen; | |
262 hdr.ast = '*'; | |
263 hdr.type = type; | |
264 hdr.seqno = htons(seqno++ & 0xffff); | |
265 hdr.len = htons(len + (type == TYPE_SIGNON ? 0 : 1)); | |
266 | |
267 sprintf(debug_buff,"Escaped message is '%s'\n",buf); | |
268 debug_print(debug_buff); | |
269 | |
270 memcpy(obuf, &hdr, sizeof(hdr)); | |
271 slen += sizeof(hdr); | |
272 memcpy(&obuf[slen], buf, len); | |
273 slen += len; | |
274 if (type != TYPE_SIGNON) { | |
275 obuf[slen]='\0'; | |
276 slen += 1; | |
277 } | |
278 print_buffer(obuf, slen); | |
279 | |
280 return write(toc_fd, obuf, slen); | |
281 } | |
282 | |
283 | |
79 | 284 int wait_reply(char *buffer, size_t buflen) |
1 | 285 { |
79 | 286 size_t res=-1; |
287 int read_rv = -1; | |
1 | 288 struct sflap_hdr *hdr=(struct sflap_hdr *)buffer; |
289 char *c; | |
290 | |
79 | 291 if(buflen < sizeof(struct sflap_hdr)) { |
292 do_error_dialog("Buffer too small", "Gaim - Error (internal)"); | |
293 return -1; | |
294 } | |
295 | |
296 while((read_rv = read(toc_fd, buffer, 1))) { | |
297 if (read_rv < 0 || read_rv > 1) | |
298 return -1; | |
1 | 299 if (buffer[0] == '*') |
300 break; | |
301 | |
302 } | |
303 | |
79 | 304 read_rv = read(toc_fd, buffer+1, sizeof(struct sflap_hdr) - 1); |
1 | 305 |
79 | 306 if (read_rv < 0) |
307 return read_rv; | |
1 | 308 |
79 | 309 res = read_rv + 1; |
1 | 310 |
311 | |
312 sprintf(debug_buff, "Rcv: %s %s\n",print_header(buffer), ""); | |
313 debug_print(debug_buff); | |
314 | |
315 | |
79 | 316 if(buflen < sizeof(struct sflap_hdr) + ntohs(hdr->len) + 1) { |
317 do_error_dialog("Buffer too small", "Gaim - Error (internal)"); | |
318 return -1; | |
319 } | |
1 | 320 |
321 while (res < (sizeof(struct sflap_hdr) + ntohs(hdr->len))) { | |
79 | 322 read_rv = read(toc_fd, buffer + res, (ntohs(hdr->len) + sizeof(struct sflap_hdr)) - res); |
323 if(read_rv < 0) return read_rv; | |
324 res += read_rv; | |
1 | 325 while(gtk_events_pending()) |
326 gtk_main_iteration(); | |
327 } | |
328 | |
329 if (res >= sizeof(struct sflap_hdr)) | |
330 buffer[res]='\0'; | |
331 else | |
332 return res - sizeof(struct sflap_hdr); | |
333 | |
334 switch(hdr->type) { | |
335 case TYPE_SIGNON: | |
336 memcpy(&peer_ver, buffer + sizeof(struct sflap_hdr), 4); | |
337 peer_ver = ntohl(peer_ver); | |
338 seqno = ntohs(hdr->seqno); | |
339 state = STATE_SIGNON_REQUEST; | |
340 break; | |
341 case TYPE_DATA: | |
342 if (!strncasecmp(buffer + sizeof(struct sflap_hdr), "SIGN_ON:", strlen("SIGN_ON:"))) | |
343 state = STATE_SIGNON_ACK; | |
344 else if (!strncasecmp(buffer + sizeof(struct sflap_hdr), "CONFIG:", strlen("CONFIG:"))) { | |
345 state = STATE_CONFIG; | |
301
f905caee43ca
[gaim-migrate @ 311]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
300
diff
changeset
|
346 } else if (!strncasecmp(buffer + sizeof(struct sflap_hdr), "ERROR:", strlen("ERROR:"))) { |
1 | 347 c = strtok(buffer + sizeof(struct sflap_hdr) + strlen("ERROR:"), ":"); |
348 show_error_dialog(c); | |
349 } | |
350 | |
351 sprintf(debug_buff, "Data: %s\n",buffer + sizeof(struct sflap_hdr)); | |
352 debug_print(debug_buff); | |
353 | |
354 break; | |
355 default: | |
356 sprintf(debug_buff, "Unknown/unimplemented packet type %d\n",hdr->type); | |
357 debug_print(debug_buff); | |
358 } | |
359 return res; | |
360 } | |
361 | |
362 | |
363 | |
364 void toc_callback( gpointer data, | |
365 gint source, | |
366 GdkInputCondition condition ) | |
367 { | |
368 char *buf; | |
369 char *c; | |
370 char *l; | |
371 | |
866
646acb9e9c38
[gaim-migrate @ 876]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
863
diff
changeset
|
372 buf = g_malloc(2 * BUF_LONG); |
646acb9e9c38
[gaim-migrate @ 876]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
863
diff
changeset
|
373 if (wait_reply(buf, 2 * BUF_LONG) < 0) { |
1 | 374 signoff(); |
375 hide_login_progress("Connection Closed"); | |
376 g_free(buf); | |
377 return; | |
378 } | |
379 | |
380 | |
381 c=strtok(buf+sizeof(struct sflap_hdr),":"); /* Ditch the first part */ | |
382 if (!strcasecmp(c,"UPDATE_BUDDY")) { | |
383 char *uc; | |
384 int logged, evil, idle, type = 0; | |
385 time_t signon; | |
386 time_t time_idle; | |
387 | |
388 c = strtok(NULL,":"); /* c is name */ | |
389 | |
390 l = strtok(NULL,":"); /* l is T/F logged status */ | |
391 | |
392 sscanf(strtok(NULL, ":"), "%d", &evil); | |
393 | |
394 sscanf(strtok(NULL, ":"), "%ld", &signon); | |
395 | |
396 sscanf(strtok(NULL, ":"), "%d", &idle); | |
397 | |
398 uc = strtok(NULL, ":"); | |
399 | |
400 | |
401 if (!strncasecmp(l,"T",1)) | |
402 logged = 1; | |
403 else | |
404 logged = 0; | |
405 | |
406 | |
407 if (uc[0] == 'A') | |
408 type |= UC_AOL; | |
409 | |
410 switch(uc[1]) { | |
411 case 'A': | |
412 type |= UC_ADMIN; | |
413 break; | |
414 case 'U': | |
415 type |= UC_UNCONFIRMED; | |
416 break; | |
417 case 'O': | |
418 type |= UC_NORMAL; | |
419 break; | |
420 default: | |
421 break; | |
422 } | |
423 | |
424 switch(uc[2]) { | |
425 case 'U': | |
426 type |= UC_UNAVAILABLE; | |
427 break; | |
428 default: | |
429 break; | |
430 } | |
431 | |
432 if (idle) { | |
433 time(&time_idle); | |
434 time_idle -= idle*60; | |
435 } else | |
436 time_idle = 0; | |
437 | |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
507
diff
changeset
|
438 serv_got_update(c, logged, evil, signon, time_idle, type, 0); |
1 | 439 |
300
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
440 } else if (!strcasecmp(c, "CONFIG")) { |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
441 /* do we want to load the buddy list again here? */ |
318
35796808896a
[gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
301
diff
changeset
|
442 c = strtok(NULL,":"); |
35796808896a
[gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
301
diff
changeset
|
443 parse_toc_buddy_list(c, 0); |
1 | 444 } else if (!strcasecmp(c, "ERROR")) { |
301
f905caee43ca
[gaim-migrate @ 311]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
300
diff
changeset
|
445 /* This should be handled by wait_reply |
1 | 446 c = strtok(NULL,":"); |
447 show_error_dialog(c); | |
301
f905caee43ca
[gaim-migrate @ 311]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
300
diff
changeset
|
448 */ |
1 | 449 } else if (!strcasecmp(c, "NICK")) { |
450 c = strtok(NULL,":"); | |
451 g_snprintf(current_user->username, sizeof(current_user->username), "%s", c); | |
452 } else if (!strcasecmp(c, "IM_IN")) { | |
453 char *away, *message; | |
454 int a = 0; | |
455 | |
456 c = strtok(NULL,":"); | |
457 away = strtok(NULL,":"); | |
458 | |
459 message = away; | |
460 | |
461 while(*message && (*message != ':')) | |
462 message++; | |
463 | |
464 message++; | |
465 | |
466 if (!strncasecmp(away, "T", 1)) | |
467 a = 1; | |
468 serv_got_im(c, message, a); | |
469 | |
470 } else if (!strcasecmp(c, "GOTO_URL")) { | |
471 char *name; | |
472 char *url; | |
473 | |
474 char tmp[256]; | |
475 | |
476 name = strtok(NULL, ":"); | |
477 url = strtok(NULL, ":"); | |
478 | |
479 | |
480 g_snprintf(tmp, sizeof(tmp), "http://%s:%d/%s", toc_addy, aim_port, url); | |
481 /* fprintf(stdout, "Name: %s\n%s\n", name, url); | |
482 printf("%s", grab_url(tmp));*/ | |
483 g_show_info(tmp); | |
484 } else if (!strcasecmp(c, "EVILED")) { | |
485 int lev; | |
486 char *name = NULL; | |
487 | |
488 sscanf(strtok(NULL, ":"), "%d", &lev); | |
489 name = strtok(NULL, ":"); | |
490 | |
491 sprintf(debug_buff,"%s | %d\n", name, lev); | |
492 debug_print(debug_buff); | |
493 | |
494 serv_got_eviled(name, lev); | |
495 | |
496 } else if (!strcasecmp(c, "CHAT_JOIN")) { | |
497 char *name; | |
498 int id; | |
499 | |
500 | |
501 sscanf(strtok(NULL, ":"), "%d", &id); | |
502 name = strtok(NULL, ":"); | |
503 serv_got_joined_chat(id, name); | |
504 | |
505 } else if (!strcasecmp(c, "DIR_STATUS")) { | |
149 | 506 } else if (!strcasecmp(c, "ADMIN_PASSWD_STATUS")) { |
507 do_error_dialog("Password Change Successeful", "Gaim - Password Change"); | |
1 | 508 } else if (!strcasecmp(c, "CHAT_UPDATE_BUDDY")) { |
509 int id; | |
510 char *in; | |
511 char *buddy; | |
512 GList *bcs = buddy_chats; | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
447
diff
changeset
|
513 struct conversation *b = NULL; |
1 | 514 |
515 sscanf(strtok(NULL, ":"), "%d", &id); | |
516 | |
517 in = strtok(NULL, ":"); | |
518 | |
519 while(bcs) { | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
447
diff
changeset
|
520 b = (struct conversation *)bcs->data; |
1 | 521 if (id == b->id) |
522 break; | |
523 bcs = bcs->next; | |
524 b = NULL; | |
525 } | |
526 | |
44 | 527 if (!b) { |
45 | 528 g_free(buf); |
1 | 529 return; |
44 | 530 } |
1 | 531 |
532 | |
533 if (!strcasecmp(in, "T")) { | |
534 while((buddy = strtok(NULL, ":")) != NULL) { | |
535 add_chat_buddy(b, buddy); | |
536 } | |
537 } else { | |
538 while((buddy = strtok(NULL, ":")) != NULL) { | |
539 remove_chat_buddy(b, buddy); | |
540 } | |
541 } | |
542 | |
543 } else if (!strcasecmp(c, "CHAT_LEFT")) { | |
544 int id; | |
545 | |
546 | |
547 sscanf(strtok(NULL, ":"), "%d", &id); | |
548 | |
549 serv_got_chat_left(id); | |
550 | |
551 | |
552 } else if (!strcasecmp(c, "CHAT_IN")) { | |
553 | |
554 int id, w; | |
555 char *m; | |
556 char *who, *whisper; | |
557 | |
558 | |
559 sscanf(strtok(NULL, ":"), "%d", &id); | |
560 who = strtok(NULL, ":"); | |
561 whisper = strtok(NULL, ":"); | |
562 m = whisper; | |
563 while(*m && (*m != ':')) m++; | |
564 m++; | |
565 | |
566 if (!strcasecmp(whisper, "T")) | |
567 w = 1; | |
568 else | |
569 w = 0; | |
570 | |
571 serv_got_chat_in(id, who, w, m); | |
572 | |
573 | |
574 } else if (!strcasecmp(c, "CHAT_INVITE")) { | |
575 char *name; | |
576 char *who; | |
577 char *message; | |
578 int id; | |
579 | |
580 | |
581 name = strtok(NULL, ":"); | |
582 sscanf(strtok(NULL, ":"), "%d", &id); | |
583 who = strtok(NULL, ":"); | |
584 message = strtok(NULL, ":"); | |
585 | |
586 serv_got_chat_invite(name, id, who, message); | |
587 | |
588 | |
589 } else if (!strcasecmp(c, "RVOUS_PROPOSE")) { | |
590 char *user; | |
591 char *uuid; | |
592 char *cookie; | |
593 int seq; | |
594 char *rip, *pip, *vip; | |
595 int port; | |
596 int unk[4]; | |
597 char *messages[4]; | |
598 int subtype, files, totalsize; | |
599 char *name; | |
600 char *tmp; | |
601 int i; | |
602 struct file_transfer *ft; | |
603 | |
604 | |
605 user = strtok(NULL, ":"); | |
606 uuid = strtok(NULL, ":"); | |
607 cookie = strtok(NULL, ":"); | |
608 sscanf(strtok(NULL, ":"), "%d", &seq); | |
609 rip = strtok(NULL, ":"); | |
610 pip = strtok(NULL, ":"); | |
611 vip = strtok(NULL, ":"); | |
612 sscanf(strtok(NULL, ":"), "%d", &port); | |
613 | |
197
24f0fef56a73
[gaim-migrate @ 207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
196
diff
changeset
|
614 if (!strcmp(uuid, FILE_SEND_UID)) { |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
615 /* we're getting a file */ |
211
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
616 for (i=0; i<4; i++) { |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
617 sscanf(strtok(NULL, ":"), "%d", &unk[i]); |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
618 if (unk[i] == 10001) |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
619 break; |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
620 messages[i] = frombase64(strtok(NULL, ":")); |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
621 } |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
622 tmp = frombase64(strtok(NULL, ":")); |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
623 subtype = tmp[1]; |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
624 files = tmp[3]; /* These are fine */ |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
625 |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
626 totalsize = 0; |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
627 totalsize |= (tmp[4] << 24) & 0xff000000; |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
628 totalsize |= (tmp[5] << 16) & 0x00ff0000; |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
629 totalsize |= (tmp[6] << 8) & 0x0000ff00; |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
630 totalsize |= (tmp[7] << 0) & 0x000000ff; |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
631 |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
632 name = tmp + 8; |
1 | 633 |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
634 ft = g_new0(struct file_transfer, 1); |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
635 |
198
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
636 ft->cookie = g_strdup(cookie); |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
637 ft->ip = g_strdup(pip); |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
638 ft->port = port; |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
639 if (i) |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
640 ft->message = g_strdup(messages[0]); |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
641 else |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
642 ft->message = NULL; |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
643 ft->filename = g_strdup(name); |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
644 ft->user = g_strdup(user); |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
645 ft->size = totalsize; |
198
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
646 sprintf(ft->UID, "%s", FILE_SEND_UID); |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
647 |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
648 g_free(tmp); |
1 | 649 |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
650 for (i--; i >= 0; i--) |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
651 g_free(messages[i]); |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
652 |
507
d17547ff9c2a
[gaim-migrate @ 517]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
472
diff
changeset
|
653 if (totalsize) /* sanity check */ |
d17547ff9c2a
[gaim-migrate @ 517]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
472
diff
changeset
|
654 accept_file_dialog(ft); |
197
24f0fef56a73
[gaim-migrate @ 207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
196
diff
changeset
|
655 } else if (!strcmp(uuid, FILE_GET_UID)) { |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
656 /* we're sending a file */ |
211
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
657 for (i=0; i<4; i++) { |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
658 sscanf(strtok(NULL, ":"), "%d", &unk[i]); |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
659 if (unk[i] == 10001) |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
660 break; |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
661 messages[i] = frombase64(strtok(NULL, ":")); |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
662 } |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
663 tmp = frombase64(strtok(NULL, ":")); |
198
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
664 ft = g_new0(struct file_transfer, 1); |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
665 |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
666 ft->cookie = g_strdup(cookie); |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
667 ft->ip = g_strdup(pip); |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
668 ft->port = port; |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
669 if (i) |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
670 ft->message = g_strdup(messages[0]); |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
671 else |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
672 ft->message = NULL; |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
673 ft->user = g_strdup(user); |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
674 sprintf(ft->UID, "%s", FILE_GET_UID); |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
675 |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
676 g_free(tmp); |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
677 |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
678 for (i--; i >= 0; i--) |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
679 g_free(messages[i]); |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
680 |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
681 accept_file_dialog(ft); |
369
cf895313fc50
[gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
351
diff
changeset
|
682 } else if (!strcmp(uuid, VOICE_UID)) { |
cf895313fc50
[gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
351
diff
changeset
|
683 /* oh goody. voice over ip. fun stuff. */ |
cf895313fc50
[gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
351
diff
changeset
|
684 |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
685 /* |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
686 } else if (!strcmp(uuid, B_ICON_UID)) { |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
687 } else if (!strcmp(uuid, IMAGE_UID)) { |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
688 */ |
1 | 689 |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
690 } else { |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
691 sprintf(debug_buff,"don't know what to do with %s\n", |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
692 uuid); |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
693 debug_print(debug_buff); |
211
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
694 tmp = g_malloc(BUF_LEN); |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
695 name = frombase64(cookie); |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
696 snprintf(tmp, BUF_LEN, "toc_rvous_cancel %s %s %s", |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
697 user, name, uuid); |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
698 sflap_send(tmp, strlen(tmp), TYPE_DATA); |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
699 free(name); |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
700 free(tmp); |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
701 } |
1 | 702 } else { |
703 sprintf(debug_buff,"don't know what to do with %s\n", c); | |
704 debug_print(debug_buff); | |
705 } | |
706 g_free(buf); | |
707 } | |
708 | |
709 | |
710 int toc_signon(char *username, char *password) | |
711 { | |
712 char buf[BUF_LONG]; | |
713 int res; | |
714 struct signon so; | |
715 | |
716 sprintf(debug_buff,"State = %d\n", state); | |
717 debug_print(debug_buff); | |
718 | |
719 if ((res = write(toc_fd, FLAPON, strlen(FLAPON))) < 0) | |
720 return res; | |
721 /* Wait for signon packet */ | |
722 | |
723 state = STATE_FLAPON; | |
724 | |
725 if ((res = wait_reply(buf, sizeof(buf)) < 0)) | |
726 return res; | |
727 | |
728 if (state != STATE_SIGNON_REQUEST) { | |
729 sprintf(debug_buff, "State should be %d, but is %d instead\n", STATE_SIGNON_REQUEST, state); | |
730 debug_print(debug_buff); | |
731 return -1; | |
732 } | |
733 | |
734 /* Compose a response */ | |
735 | |
736 g_snprintf(so.username, sizeof(so.username), "%s", username); | |
737 so.ver = ntohl(1); | |
738 so.tag = ntohs(1); | |
739 so.namelen = htons(strlen(so.username)); | |
740 | |
741 sflap_send((char *)&so, ntohs(so.namelen) + 8, TYPE_SIGNON); | |
742 | |
743 g_snprintf(buf, sizeof(buf), | |
744 "toc_signon %s %d %s %s %s \"%s\"", | |
745 login_host, login_port, normalize(username), roast_password(password), LANGUAGE, REVISION); | |
746 | |
747 sprintf(debug_buff,"Send: %s\n", buf); | |
748 debug_print(debug_buff); | |
749 | |
750 return sflap_send(buf, -1, TYPE_DATA); | |
751 } | |
752 | |
753 int toc_wait_signon() | |
754 { | |
755 /* Wait for the SIGNON to be approved */ | |
351
22161278657c
[gaim-migrate @ 361]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
756 char buf[BUF_LONG]; |
1 | 757 int res; |
758 res = wait_reply(buf, sizeof(buf)); | |
759 if (res < 0) | |
760 return res; | |
761 if (state != STATE_SIGNON_ACK) { | |
762 sprintf(debug_buff, "State should be %d, but is %d instead\n",STATE_SIGNON_ACK, state); | |
763 debug_print(debug_buff); | |
764 return -1; | |
765 } | |
766 return 0; | |
767 } | |
768 | |
769 #ifdef _WIN32 | |
770 gint win32_read() | |
771 { | |
772 int ret; | |
773 struct fd_set fds; | |
774 struct timeval tv; | |
775 | |
776 FD_ZERO(&fds); | |
777 | |
778 tv.tv_sec = 0; | |
779 tv.tv_usec = 200; | |
780 | |
781 FD_SET(toc_fd, &fds); | |
782 | |
783 ret = select(toc_fd + 1, &fds, NULL, NULL, &tv); | |
784 | |
785 if (ret == 0) { | |
786 return TRUE; | |
787 } | |
788 | |
789 toc_callback(NULL, 0, (GdkInputCondition)0); | |
790 return TRUE; | |
791 } | |
792 #endif | |
793 | |
794 | |
795 char *toc_wait_config() | |
796 { | |
797 /* Waits for configuration packet, returning the contents of the packet */ | |
351
22161278657c
[gaim-migrate @ 361]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
798 static char buf[BUF_LONG]; |
1 | 799 int res; |
300
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
800 res = wait_reply(buf, sizeof(buf)); |
1 | 801 if (res < 0) |
802 return NULL; | |
300
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
803 /* Apparently, the toc_config is optional. *VERY* Optional |
285 | 804 */ |
300
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
805 if (state != STATE_CONFIG) { |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
806 res = 0; |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
807 } else { |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
808 res = 1; |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
809 } |
1 | 810 /* At this point, it's time to setup automatic handling of incoming packets */ |
300
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
811 state = STATE_ONLINE; |
1 | 812 #ifdef _WIN32 |
300
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
813 win32_r = gtk_timeout_add(1000, (GtkFunction)win32_read, NULL); |
1 | 814 #else |
300
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
815 inpa = gdk_input_add(toc_fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, toc_callback, NULL); |
1 | 816 #endif |
300
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
817 if (res) |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
818 return buf; |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
819 else |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
820 return NULL; |
1 | 821 } |
822 | |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
823 void toc_build_config(char *s, int len, gboolean show) |
1 | 824 { |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
825 GList *grp = groups; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
826 GList *mem; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
827 struct group *g; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
828 struct buddy *b; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
829 GList *plist = permit; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
830 GList *dlist = deny; |
1 | 831 |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
832 int pos=0; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
833 |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
834 if (!permdeny) |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
835 permdeny = 1; |
1 | 836 |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
837 pos += g_snprintf(&s[pos], len - pos, "m %d\n", permdeny); |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
838 while(grp) { |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
839 g = (struct group *)grp->data; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
840 pos += g_snprintf(&s[pos], len - pos, "g %s\n", g->name); |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
841 mem = g->members; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
842 while(mem) { |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
843 b = (struct buddy *)mem->data; |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
844 pos += g_snprintf(&s[pos], len - pos, "b %s%s%s\n", b->name, |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
845 show ? ":" : "", show ? b->show : ""); |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
846 mem = mem->next; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
847 } |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
848 grp = grp ->next; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
849 } |
1 | 850 |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
851 while(plist) { |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
852 pos += g_snprintf(&s[pos], len - pos, "p %s\n", (char *)plist->data); |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
853 plist=plist->next; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
854 } |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
855 |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
856 while(dlist) { |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
857 pos += g_snprintf(&s[pos], len - pos, "d %s\n", (char *)dlist->data); |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
858 dlist=dlist->next; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
859 } |
1 | 860 } |
861 | |
296
a88b889b692b
[gaim-migrate @ 306]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
285
diff
changeset
|
862 void parse_toc_buddy_list(char *config, int from_do_import) |
1 | 863 { |
864 char *c; | |
681
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
865 char current[256]; |
1 | 866 char *name; |
867 GList *bud; | |
228 | 868 int how_many = 0; |
869 | |
1 | 870 bud = NULL; |
871 | |
681
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
872 /* skip "CONFIG:" (if it exists)*/ |
1 | 873 |
332
b573f33c5e0e
[gaim-migrate @ 342]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
318
diff
changeset
|
874 if (config != NULL) { |
b573f33c5e0e
[gaim-migrate @ 342]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
318
diff
changeset
|
875 |
681
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
876 c = strncmp(config + sizeof(struct sflap_hdr),"CONFIG:",strlen("CONFIG:"))? |
1 | 877 strtok(config, "\n"): |
878 strtok(config + sizeof(struct sflap_hdr)+strlen("CONFIG:"), "\n"); | |
681
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
879 do { |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
880 if (c == NULL) |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
881 break; |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
882 if (*c == 'g') { |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
883 strncpy(current,c+2, sizeof(current)); |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
884 add_group(current); |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
885 how_many++; |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
886 } else if (*c == 'b' && !find_buddy(c+2)) { |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
887 char nm[80], sw[80], *tmp = c+2; |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
888 int i = 0; |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
889 while (*tmp != ':' && *tmp) |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
890 nm[i++] = *tmp++; |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
891 if (*tmp == ':') *tmp++ = '\0'; |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
892 nm[i] = '\0'; |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
893 i = 0; |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
894 while (*tmp) sw[i++] = *tmp++; |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
895 sw[i] = '\0'; |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
896 if (!find_buddy(nm)) |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
897 add_buddy(current, nm, sw); |
681
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
898 how_many++; |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
899 |
681
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
900 bud = g_list_append(bud, c+2); |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
901 } else if (*c == 'p') { |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
902 GList *d = permit; |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
903 char *n; |
863
55194c5f338f
[gaim-migrate @ 873]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
793
diff
changeset
|
904 name = g_malloc(strlen(c+2) + 2); |
681
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
905 g_snprintf(name, strlen(c+2) + 1, "%s", c+2); |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
906 n = g_strdup(normalize(name)); |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
907 while (d) { |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
908 if (!strcasecmp(n, normalize(d->data))) |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
909 break; |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
910 d = d->next; |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
911 } |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
912 g_free(n); |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
913 if (!d) |
762
977048924ce1
[gaim-migrate @ 772]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
761
diff
changeset
|
914 permit = g_list_append(permit, name); |
681
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
915 } else if (*c == 'd') { |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
916 GList *d = deny; |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
917 char *n; |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
918 name = g_malloc(strlen(c+2) + 2); |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
919 g_snprintf(name, strlen(c+2) + 1, "%s", c+2); |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
920 n = g_strdup(normalize(name)); |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
921 while (d) { |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
922 if (!strcasecmp(n, normalize(d->data))) |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
923 break; |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
924 d = d->next; |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
925 } |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
926 g_free(n); |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
927 if (!d) |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
928 deny = g_list_append(deny, name); |
793
57cc66fbfa8e
[gaim-migrate @ 803]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
774
diff
changeset
|
929 } else if (!strncmp("toc", c, 3)) { |
57cc66fbfa8e
[gaim-migrate @ 803]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
774
diff
changeset
|
930 sscanf(c + strlen(c) - 1, "%d", &permdeny); |
57cc66fbfa8e
[gaim-migrate @ 803]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
774
diff
changeset
|
931 sprintf(debug_buff, "permdeny: %d\n", permdeny); |
57cc66fbfa8e
[gaim-migrate @ 803]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
774
diff
changeset
|
932 debug_print(debug_buff); |
57cc66fbfa8e
[gaim-migrate @ 803]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
774
diff
changeset
|
933 if (permdeny == 0) |
57cc66fbfa8e
[gaim-migrate @ 803]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
774
diff
changeset
|
934 permdeny = 1; |
57cc66fbfa8e
[gaim-migrate @ 803]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
774
diff
changeset
|
935 } else if (*c == 'm') { |
57cc66fbfa8e
[gaim-migrate @ 803]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
774
diff
changeset
|
936 sscanf(c + 2, "%d", &permdeny); |
57cc66fbfa8e
[gaim-migrate @ 803]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
774
diff
changeset
|
937 sprintf(debug_buff, "permdeny: %d\n", permdeny); |
57cc66fbfa8e
[gaim-migrate @ 803]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
774
diff
changeset
|
938 debug_print(debug_buff); |
681
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
939 if (permdeny == 0) |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
940 permdeny = 1; |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
941 } |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
942 } while((c=strtok(NULL,"\n"))); |
1 | 943 #if 0 |
681
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
944 fprintf(stdout, "Sending message '%s'\n",buf); |
1 | 945 #endif |
681
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
946 |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
947 if (bud != NULL) serv_add_buddies(bud); |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
948 serv_set_permit_deny(); |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
949 if (blist) { |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
950 build_edit_tree(); |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
951 build_permit_tree(); |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
952 } |
332
b573f33c5e0e
[gaim-migrate @ 342]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
318
diff
changeset
|
953 } |
b573f33c5e0e
[gaim-migrate @ 342]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
318
diff
changeset
|
954 |
228 | 955 /* perhaps the server dropped the buddy list, try importing from |
956 cache */ | |
957 | |
296
a88b889b692b
[gaim-migrate @ 306]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
285
diff
changeset
|
958 if ( how_many == 0 && !from_do_import ) { |
228 | 959 do_import( (GtkWidget *) NULL, 0 ); |
229 | 960 } else if ( bud_list_cache_exists() == FALSE ) { |
961 do_export( (GtkWidget *) NULL, 0 ); | |
228 | 962 } |
1 | 963 } |