comparison src/protocols/gg/gg.c @ 4452:2afc0f845e74

[gaim-migrate @ 4727] I cleaned up the async dns stuff a bit. Now everything will work again. Even TOC. You don't want to use TOC, though--but you already know that. You're smart. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Tue, 28 Jan 2003 21:42:44 +0000
parents f5c6e33b1013
children 3196d9044a45
comparison
equal deleted inserted replaced
4451:ce5b64fac95d 4452:2afc0f845e74
1 /* 1 /*
2 * gaim - Gadu-Gadu Protocol Plugin 2 * gaim - Gadu-Gadu Protocol Plugin
3 * $Id: gg.c 4712 2003-01-27 22:27:02Z lschiere $ 3 * $Id: gg.c 4727 2003-01-28 21:42:44Z seanegan $
4 * 4 *
5 * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL> 5 * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 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 8 * it under the terms of the GNU General Public License as published by
304 debug_printf("main_callback enter: begin\n"); 304 debug_printf("main_callback enter: begin\n");
305 305
306 if (gd->sess->fd != source) 306 if (gd->sess->fd != source)
307 gd->sess->fd = source; 307 gd->sess->fd = source;
308 308
309 if (source == -1) { 309 if (source != 0) {
310 hide_login_progress(gc, _("Could not connect")); 310 hide_login_progress(gc, _("Could not connect"));
311 signoff(gc); 311 signoff(gc);
312 return; 312 return;
313 } 313 }
314 314
420 if (!g_slist_find(connections, gc)) { 420 if (!g_slist_find(connections, gc)) {
421 close(source); 421 close(source);
422 return; 422 return;
423 } 423 }
424 debug_printf("Found GG connection\n"); 424 debug_printf("Found GG connection\n");
425 if (gd->sess->fd != source) { 425
426 gd->sess->fd = source; 426 if (source != 0) {
427 debug_printf("Setting sess->fd to source\n");
428 }
429 if (source == -1) {
430 hide_login_progress(gc, _("Unable to connect.")); 427 hide_login_progress(gc, _("Unable to connect."));
431 signoff(gc); 428 signoff(gc);
432 return; 429 return;
433 } 430 }
431
432 gd->sess->fd = source;
433
434 debug_printf("Source is valid.\n"); 434 debug_printf("Source is valid.\n");
435 if (gc->inpa == 0) { 435 if (gc->inpa == 0) {
436 debug_printf("login_callback.. checking gc->inpa .. is 0.. setting fd watch\n"); 436 debug_printf("login_callback.. checking gc->inpa .. is 0.. setting fd watch\n");
437 gc->inpa = gaim_input_add(gd->sess->fd, GAIM_INPUT_READ, login_callback, gc); 437 gc->inpa = gaim_input_add(gd->sess->fd, GAIM_INPUT_READ, login_callback, gc);
438 debug_printf("Adding watch on fd\n"); 438 debug_printf("Adding watch on fd\n");
473 473
474 /* Remove watch on initial socket - now that we have ip and port of login server */ 474 /* Remove watch on initial socket - now that we have ip and port of login server */
475 gaim_input_remove(gc->inpa); 475 gaim_input_remove(gc->inpa);
476 476
477 ip.s_addr = gd->sess->server_ip; 477 ip.s_addr = gd->sess->server_ip;
478 gd->sess->fd = proxy_connect(inet_ntoa(ip), gd->sess->port, login_callback, gc);
479 478
480 if (gd->sess->fd < 0) { 479 if (proxy_connect(inet_ntoa(ip), gd->sess->port, login_callback, gc) < 0) {
481 g_snprintf(buf, sizeof(buf), _("Connect to %s failed"), inet_ntoa(ip)); 480 g_snprintf(buf, sizeof(buf), _("Connect to %s failed"), inet_ntoa(ip));
482 hide_login_progress(gc, buf); 481 hide_login_progress(gc, buf);
483 signoff(gc); 482 signoff(gc);
484 return; 483 return;
485 } 484 }
571 gd->sess->uin = (uin_t) strtol(user->username, (char **)NULL, 10); 570 gd->sess->uin = (uin_t) strtol(user->username, (char **)NULL, 10);
572 gd->sess->password = g_strdup(user->password); 571 gd->sess->password = g_strdup(user->password);
573 gd->sess->state = GG_STATE_CONNECTING; 572 gd->sess->state = GG_STATE_CONNECTING;
574 gd->sess->check = GG_CHECK_WRITE; 573 gd->sess->check = GG_CHECK_WRITE;
575 gd->sess->async = 1; 574 gd->sess->async = 1;
576 gd->sess->fd = proxy_connect(GG_APPMSG_HOST, GG_APPMSG_PORT, login_callback, gc); 575 if (proxy_connect(GG_APPMSG_HOST, GG_APPMSG_PORT, login_callback, gc) < 0) {
577
578 if (gd->sess->fd < 0) {
579 g_snprintf(buf, sizeof(buf), _("Connect to %s failed"), GG_APPMSG_HOST); 576 g_snprintf(buf, sizeof(buf), _("Connect to %s failed"), GG_APPMSG_HOST);
580 hide_login_progress(gc, buf); 577 hide_login_progress(gc, buf);
581 signoff(gc); 578 signoff(gc);
582 return; 579 return;
583 } 580 }
935 g_free(hdata); 932 g_free(hdata);
936 close(source); 933 close(source);
937 return; 934 return;
938 } 935 }
939 936
940 if (source == -1) { 937 if (source != 0) {
941 g_free(request); 938 g_free(request);
942 g_free(hdata); 939 g_free(hdata);
943 return; 940 return;
944 } 941 }
945 942