Mercurial > pidgin
changeset 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 | ce5b64fac95d |
children | 78a2d2e7f4b5 |
files | src/protocols/gg/gg.c src/protocols/irc/irc.c src/protocols/jabber/jabber.c src/protocols/msn/msn.c src/protocols/napster/napster.c src/protocols/oscar/oscar.c src/protocols/toc/toc.c src/protocols/yahoo/yahoo.c src/proxy.c |
diffstat | 9 files changed, 48 insertions(+), 84 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/gg/gg.c Tue Jan 28 18:49:42 2003 +0000 +++ b/src/protocols/gg/gg.c Tue Jan 28 21:42:44 2003 +0000 @@ -1,6 +1,6 @@ /* * gaim - Gadu-Gadu Protocol Plugin - * $Id: gg.c 4712 2003-01-27 22:27:02Z lschiere $ + * $Id: gg.c 4727 2003-01-28 21:42:44Z seanegan $ * * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL> * @@ -306,7 +306,7 @@ if (gd->sess->fd != source) gd->sess->fd = source; - if (source == -1) { + if (source != 0) { hide_login_progress(gc, _("Could not connect")); signoff(gc); return; @@ -422,15 +422,15 @@ return; } debug_printf("Found GG connection\n"); - if (gd->sess->fd != source) { - gd->sess->fd = source; - debug_printf("Setting sess->fd to source\n"); - } - if (source == -1) { + + if (source != 0) { hide_login_progress(gc, _("Unable to connect.")); signoff(gc); return; } + + gd->sess->fd = source; + debug_printf("Source is valid.\n"); if (gc->inpa == 0) { debug_printf("login_callback.. checking gc->inpa .. is 0.. setting fd watch\n"); @@ -475,9 +475,8 @@ gaim_input_remove(gc->inpa); ip.s_addr = gd->sess->server_ip; - gd->sess->fd = proxy_connect(inet_ntoa(ip), gd->sess->port, login_callback, gc); - if (gd->sess->fd < 0) { + if (proxy_connect(inet_ntoa(ip), gd->sess->port, login_callback, gc) < 0) { g_snprintf(buf, sizeof(buf), _("Connect to %s failed"), inet_ntoa(ip)); hide_login_progress(gc, buf); signoff(gc); @@ -573,9 +572,7 @@ gd->sess->state = GG_STATE_CONNECTING; gd->sess->check = GG_CHECK_WRITE; gd->sess->async = 1; - gd->sess->fd = proxy_connect(GG_APPMSG_HOST, GG_APPMSG_PORT, login_callback, gc); - - if (gd->sess->fd < 0) { + if (proxy_connect(GG_APPMSG_HOST, GG_APPMSG_PORT, login_callback, gc) < 0) { g_snprintf(buf, sizeof(buf), _("Connect to %s failed"), GG_APPMSG_HOST); hide_login_progress(gc, buf); signoff(gc); @@ -937,7 +934,7 @@ return; } - if (source == -1) { + if (source != 0) { g_free(request); g_free(hdata); return;
--- a/src/protocols/irc/irc.c Tue Jan 28 18:49:42 2003 +0000 +++ b/src/protocols/irc/irc.c Tue Jan 28 21:42:44 2003 +0000 @@ -1664,12 +1664,12 @@ idata = gc->proto_data; - if (source == -1) { + if (source != 1) { hide_login_progress(gc, "Write error"); signoff(gc); return; } - + idata->fd = source; /* Try a quick conversion to see if the specified encoding is OK */ test = g_convert("test", strlen("test"), gc->user->proto_opt[USEROPT_CHARSET], @@ -1682,8 +1682,6 @@ g_free(test); - idata->fd = source; - gethostname(hostname, sizeof(hostname) - 1); hostname[sizeof(hostname) - 1] = 0; if (!*hostname) @@ -1740,10 +1738,9 @@ idata->fd = -1; rc = proxy_connect(user->proto_opt[USEROPT_SERV], - user->proto_opt[USEROPT_PORT][0] ? atoi(user-> - proto_opt[USEROPT_PORT]) : - 6667, irc_login_callback, gc); - if (!user->gc || (rc < 0)) { + user->proto_opt[USEROPT_PORT][0] ? atoi(user->proto_opt[USEROPT_PORT]) : + 6667, irc_login_callback, gc); + if (!user->gc || (rc != 0)) { hide_login_progress(gc, "Unable to create socket"); signoff(gc); return;
--- a/src/protocols/jabber/jabber.c Tue Jan 28 18:49:42 2003 +0000 +++ b/src/protocols/jabber/jabber.c Tue Jan 28 21:42:44 2003 +0000 @@ -819,7 +819,7 @@ XML_SetCharacterDataHandler(gjc->parser, charData); rc = proxy_connect(server, port, gjab_connected, GJ_GC(gjc)); - if (!user->gc || (rc < 0)) { + if (!user->gc || (rc != 0)) { STATE_EVT(JCONN_STATE_OFF) return; }
--- a/src/protocols/msn/msn.c Tue Jan 28 18:49:42 2003 +0000 +++ b/src/protocols/msn/msn.c Tue Jan 28 21:42:44 2003 +0000 @@ -688,8 +688,7 @@ int cont = 1; int len; - if (mft->fd != source) - mft->fd = source; + mft->fd = source; len = read(mft->fd, buf, sizeof(buf)); @@ -838,9 +837,7 @@ mft->port = atoi(port_s); mft->authcookie = atol(authcookie_s); - mft->fd = proxy_connect(mft->ip, mft->port, msn_msnftp_connect, mft); - - if (ms->fd < 0) { + if (proxy_connect(mft->ip, mft->port, msn_msnftp_connect, mft) != 0) { md->file_transfers = g_slist_remove(md->file_transfers, mft); return; } @@ -933,9 +930,7 @@ int cont = 1; int len; - /* This is really stupid and I hate to put this here. */ - if (ms->fd != source) - ms->fd = source; + ms->fd = source; len = read(ms->fd, buf, sizeof(buf)); if (len <= 0) { msn_kill_switch(ms); @@ -1437,8 +1432,7 @@ port = 1863; ms = g_new0(struct msn_switchboard, 1); - ms->fd = proxy_connect(ssaddr, port, msn_rng_connect, ms); - if (ms->fd < 0) { + if (proxy_connect(ssaddr, port, msn_rng_connect, ms) != 0) { g_free(ms); return 1; } @@ -1548,26 +1542,22 @@ } if (switchboard) { - int rc; struct msn_switchboard *ms = msn_find_writable_switch(gc); if (!ms) return 1; GET_NEXT(tmp); - rc = proxy_connect(host, port, msn_ss_xfr_connect, ms); - if (rc < 0) { + if (proxy_connect(host, port, msn_ss_xfr_connect, ms) != 0) { msn_kill_switch(ms); return 1; } ms->auth = g_strdup(tmp); } else { - int rc; close(md->fd); gaim_input_remove(md->inpa); md->inpa = 0; - rc = proxy_connect(host, port, msn_login_xfr_connect, gc); - if (rc < 0) { + if (proxy_connect(host, port, msn_login_xfr_connect, gc) != 0) { hide_login_progress(gc, _("Error transfering")); signoff(gc); return 0; @@ -1862,9 +1852,8 @@ gaim_input_remove(md->inpa); md->inpa = 0; md->fd = 0; - md->fd = proxy_connect(host, port, msn_login_xfr_connect, gc); md->sl = time(NULL); - if (md->fd < 0) { + if (proxy_connect(host, port, msn_login_xfr_connect, gc) != 0) { hide_login_progress(gc, _("Unable to transfer")); signoff(gc); } @@ -1978,10 +1967,9 @@ g_snprintf(gc->username, sizeof(gc->username), "%s", msn_normalize(gc->username)); - md->fd = proxy_connect(user->proto_opt[USEROPT_MSNSERVER][0] ? user->proto_opt[USEROPT_MSNSERVER] : MSN_SERVER, + if (proxy_connect(user->proto_opt[USEROPT_MSNSERVER][0] ? user->proto_opt[USEROPT_MSNSERVER] : MSN_SERVER, user->proto_opt[USEROPT_MSNPORT][0] ? atoi(user->proto_opt[USEROPT_MSNPORT]) : MSN_PORT, - msn_login_connect, gc); - if (md->fd < 0) { + msn_login_connect, gc) != 0) { hide_login_progress(gc, _("Unable to connect")); signoff(gc); }
--- a/src/protocols/napster/napster.c Tue Jan 28 18:49:42 2003 +0000 +++ b/src/protocols/napster/napster.c Tue Jan 28 21:42:44 2003 +0000 @@ -426,8 +426,7 @@ } ndata = gc->proto_data; - if (ndata->fd != source) - ndata->fd = source; + ndata->fd = source; /* And write our signon data */ g_snprintf(buf, NAP_BUF_LEN, "%s %s 0 \"gaimster\" 0", gc->username, gc->password); @@ -443,10 +442,9 @@ struct gaim_connection *gc = new_gaim_conn(user); struct nap_data *ndata = gc->proto_data = g_new0(struct nap_data, 1); - ndata->fd = proxy_connect(user->proto_opt[USEROPT_NAPSERVER][0] ? user->proto_opt[USEROPT_NAPSERVER] : NAP_SERVER, + if (proxy_connect(user->proto_opt[USEROPT_NAPSERVER][0] ? user->proto_opt[USEROPT_NAPSERVER] : NAP_SERVER, user->proto_opt[USEROPT_NAPPORT][0] ? atoi(user->proto_opt[USEROPT_NAPPORT]) : NAP_PORT, - nap_login_connect, gc); - if (ndata->fd < 0) { + nap_login_connect, gc) != 0) { hide_login_progress(gc, "Unable to connect"); signoff(gc); }
--- a/src/protocols/oscar/oscar.c Tue Jan 28 18:49:42 2003 +0000 +++ b/src/protocols/oscar/oscar.c Tue Jan 28 21:42:44 2003 +0000 @@ -643,7 +643,6 @@ char buf[256]; struct gaim_connection *gc = new_gaim_conn(user); struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1); - int rc; if (isdigit(*user->username)) { odata->icq = TRUE; @@ -680,12 +679,11 @@ aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); conn->status |= AIM_CONN_STATUS_INPROGRESS; - rc = proxy_connect(user->proto_opt[USEROPT_AUTH][0] ? + if (proxy_connect(user->proto_opt[USEROPT_AUTH][0] ? user->proto_opt[USEROPT_AUTH] : FAIM_LOGIN_SERVER, user->proto_opt[USEROPT_AUTHPORT][0] ? atoi(user->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT, - oscar_login_connect, gc); - if (rc < 0) { + oscar_login_connect, gc) < 0) { hide_login_progress(gc, _("Couldn't connect to host")); signoff(gc); return; @@ -803,7 +801,8 @@ static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { va_list ap; struct aim_authresp_info *info; - int i, rc; char *host; int port; + int i, rc; + char *host; int port; struct aim_user *user; aim_conn_t *bosconn; @@ -1026,7 +1025,6 @@ struct pieceofcrap *pos; fu32_t offset, len; char *modname; - int fd; va_start(ap, fr); offset = va_arg(ap, fu32_t); @@ -1076,15 +1074,14 @@ pos->len = len; pos->modname = modname ? g_strdup(modname) : NULL; - fd = proxy_connect("gaim.sourceforge.net", 80, straight_to_hell, pos); - if (fd < 0) { + if (proxy_connect("gaim.sourceforge.net", 80, straight_to_hell, pos) != 0) { char buf[256]; if (pos->modname) g_free(pos->modname); g_free(pos); g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. You may want to use TOC until " "this is fixed. Check %s for updates."), WEBSITE); - do_error_dialog(_("Gaim was Unable to get valid login hash."), + do_error_dialog(_("Gaim was Unable to get a valid login hash."), buf, GAIM_WARNING); } @@ -1286,7 +1283,7 @@ struct gaim_connection *gc = sess->aux_data; struct aim_user *user = gc->user; aim_conn_t *tstconn; - int i, rc; + int i; char *host; int port; @@ -1320,8 +1317,7 @@ aim_conn_addhandler(sess, tstconn, 0x0007, 0x0007, gaim_account_confirm, 0); tstconn->status |= AIM_CONN_STATUS_INPROGRESS; - rc = proxy_connect(host, port, oscar_auth_connect, gc); - if (rc < 0) { + if (proxy_connect(host, port, oscar_auth_connect, gc) != 0) { aim_conn_kill(sess, &tstconn); debug_printf("unable to reconnect with authorizer\n"); g_free(host); @@ -1340,8 +1336,7 @@ aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chatnav, 0); tstconn->status |= AIM_CONN_STATUS_INPROGRESS; - rc = proxy_connect(host, port, oscar_chatnav_connect, gc); - if (rc < 0) { + if (proxy_connect(host, port, oscar_chatnav_connect, gc) != 0) { aim_conn_kill(sess, &tstconn); debug_printf("unable to connect to chatnav server\n"); g_free(host); @@ -1372,8 +1367,7 @@ ccon->show = extract_name(redir->chat.room); ccon->conn->status |= AIM_CONN_STATUS_INPROGRESS; - rc = proxy_connect(host, port, oscar_chat_connect, ccon); - if (rc < 0) { + if (proxy_connect(host, port, oscar_chat_connect, ccon) != 0) { aim_conn_kill(sess, &tstconn); debug_printf("unable to connect to chat server\n"); g_free(host); @@ -1395,8 +1389,7 @@ aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_email, 0); tstconn->status |= AIM_CONN_STATUS_INPROGRESS; - rc = proxy_connect(host, port, oscar_email_connect, gc); - if (rc < 0) { + if (proxy_connect(host, port, oscar_email_connect, gc) != 0) { aim_conn_kill(sess, &tstconn); debug_printf("unable to connect to email server\n"); g_free(host);
--- a/src/protocols/toc/toc.c Tue Jan 28 18:49:42 2003 +0000 +++ b/src/protocols/toc/toc.c Tue Jan 28 21:42:44 2003 +0000 @@ -198,13 +198,10 @@ set_login_progress(gc, 1, buf); debug_printf("* Client connects to TOC\n"); - tdt->toc_fd = - proxy_connect(user->proto_opt[USEROPT_AUTH][0] ? user->proto_opt[USEROPT_AUTH] : TOC_HOST, + if (proxy_connect(user->proto_opt[USEROPT_AUTH][0] ? user->proto_opt[USEROPT_AUTH] : TOC_HOST, user->proto_opt[USEROPT_AUTHPORT][0] ? atoi(user->proto_opt[USEROPT_AUTHPORT]) : TOC_PORT, - toc_login_callback, gc); - - if (!user->gc || (tdt->toc_fd < 0)) { + toc_login_callback, gc) != 0 || !user->gc) { g_snprintf(buf, sizeof(buf), "Connect to %s failed", user->proto_opt[USEROPT_AUTH]); hide_login_progress(gc, buf); signoff(gc); @@ -231,9 +228,7 @@ signoff(gc); return; } - - if (tdt->toc_fd == 0) - tdt->toc_fd = source; + tdt->toc_fd = source; debug_printf("* Client sends \"FLAPON\\r\\n\\r\\n\"\n"); if (toc_write(tdt->toc_fd, FLAPON, strlen(FLAPON)) < 0) { @@ -1694,9 +1689,7 @@ g_snprintf(buf, sizeof(buf), "toc_rvous_accept %s %s %s", ft->user, ft->cookie, FILE_SEND_UID); sflap_send(ft->gc, buf, -1, TYPE_DATA); - fd = - proxy_connect(ft->ip, ft->port, toc_send_file_connect, ft); - if (fd < 0) { + if (proxy_connect(ft->ip, ft->port, toc_send_file_connect, ft) != 0) { do_error_dialog(_("Could not connect for transfer."), NULL, GAIM_ERROR); g_free(ft->filename); g_free(ft->cookie); @@ -1863,7 +1856,6 @@ { struct file_transfer *ft; const char *dirname = gtk_file_selection_get_filename(GTK_FILE_SELECTION(old_ft->window)); - int fd; struct aim_user *user; char *buf, buf2[BUF_LEN * 2]; @@ -1899,9 +1891,7 @@ g_snprintf(buf2, sizeof(buf2), "toc_rvous_accept %s %s %s", ft->user, ft->cookie, FILE_GET_UID); sflap_send(ft->gc, buf2, -1, TYPE_DATA); - fd = - proxy_connect(ft->ip, ft->port, toc_get_file_connect, ft); - if (fd < 0) { + if (proxy_connect(ft->ip, ft->port, toc_get_file_connect, ft) < 0) { do_error_dialog(_("Could not connect for transfer."), NULL, GAIM_ERROR); fclose(ft->file); g_free(ft->filename);
--- a/src/protocols/yahoo/yahoo.c Tue Jan 28 18:49:42 2003 +0000 +++ b/src/protocols/yahoo/yahoo.c Tue Jan 28 21:42:44 2003 +0000 @@ -977,7 +977,7 @@ user->proto_opt[USEROPT_PAGERHOST] : YAHOO_PAGER_HOST, user->proto_opt[USEROPT_PAGERPORT][0] ? atoi(user->proto_opt[USEROPT_PAGERPORT]) : YAHOO_PAGER_PORT, - yahoo_got_connected, gc) < 0) { + yahoo_got_connected, gc) != 0) { hide_login_progress(gc, "Connection problem"); signoff(gc); return;
--- a/src/proxy.c Tue Jan 28 18:49:42 2003 +0000 +++ b/src/proxy.c Tue Jan 28 21:42:44 2003 +0000 @@ -1156,7 +1156,8 @@ } } -int proxy_connect(char *host, int port, GaimInputFunction func, gpointer data) +int +proxy_connect(char *host, int port, GaimInputFunction func, gpointer data) { char *connecthost = host; int connectport = port; @@ -1194,5 +1195,5 @@ } gaim_gethostbyname_async(connecthost, connectport, connection_host_resolved, phb); - return 1; + return 0; }