Mercurial > pidgin
changeset 2090:b66aca8e8dce
[gaim-migrate @ 2100]
change ../config.h to <config.h> because that's better. change from GdkInput functions to GaimInput for reasons mentioned elsewhere.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Tue, 31 Jul 2001 23:23:40 +0000 |
parents | bb1ddaaf0d26 |
children | bc3a118644d5 |
files | plugins/iconaway.c src/about.c src/aim.c src/applet.c src/away.c src/browser.c src/buddy.c src/buddy_chat.c src/conversation.c src/dialogs.c src/gaim.h src/gaimrc.c src/html.c src/idle.c src/perl.c src/plugins.c src/prefs.c src/protocols/icq/gaim_icq.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/yay.c src/proxy.c src/proxy.h src/server.c src/sound.c src/util.c |
diffstat | 30 files changed, 275 insertions(+), 257 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/iconaway.c Tue Jul 31 18:02:40 2001 +0000 +++ b/plugins/iconaway.c Tue Jul 31 23:23:40 2001 +0000 @@ -1,4 +1,4 @@ -#include "../config.h" +#include <config.h> #include "gaim.h" #include <gdk/gdkx.h>
--- a/src/about.c Tue Jul 31 18:02:40 2001 +0000 +++ b/src/about.c Tue Jul 31 23:23:40 2001 +0000 @@ -20,7 +20,7 @@ */ #ifdef HAVE_CONFIG_H -#include "../config.h" +#include <config.h> #endif #include <string.h> #include <stdio.h>
--- a/src/aim.c Tue Jul 31 18:02:40 2001 +0000 +++ b/src/aim.c Tue Jul 31 23:23:40 2001 +0000 @@ -20,7 +20,7 @@ */ #ifdef HAVE_CONFIG_H -#include "../config.h" +#include <config.h> #endif #ifdef USE_APPLET #include "applet.h"
--- a/src/applet.c Tue Jul 31 18:02:40 2001 +0000 +++ b/src/applet.c Tue Jul 31 23:23:40 2001 +0000 @@ -28,7 +28,7 @@ */ #ifdef HAVE_CONFIG_H -#include "../config.h" +#include <config.h> #endif #ifdef USE_APPLET #include <string.h>
--- a/src/away.c Tue Jul 31 18:02:40 2001 +0000 +++ b/src/away.c Tue Jul 31 23:23:40 2001 +0000 @@ -20,7 +20,7 @@ */ #ifdef HAVE_CONFIG_H -#include "../config.h" +#include <config.h> #endif #ifdef USE_APPLET #include <gnome.h>
--- a/src/browser.c Tue Jul 31 18:02:40 2001 +0000 +++ b/src/browser.c Tue Jul 31 23:23:40 2001 +0000 @@ -28,7 +28,7 @@ #ifdef HAVE_CONFIG_H -#include "../config.h" +#include <config.h> #endif #include <stdio.h> #include <stdlib.h>
--- a/src/buddy.c Tue Jul 31 18:02:40 2001 +0000 +++ b/src/buddy.c Tue Jul 31 23:23:40 2001 +0000 @@ -20,7 +20,7 @@ */ #ifdef HAVE_CONFIG_H -#include "../config.h" +#include <config.h> #endif #ifdef USE_APPLET #include <gnome.h>
--- a/src/buddy_chat.c Tue Jul 31 18:02:40 2001 +0000 +++ b/src/buddy_chat.c Tue Jul 31 23:23:40 2001 +0000 @@ -20,7 +20,7 @@ */ #ifdef HAVE_CONFIG_H -#include "../config.h" +#include <config.h> #endif #include <string.h> #include <sys/time.h>
--- a/src/conversation.c Tue Jul 31 18:02:40 2001 +0000 +++ b/src/conversation.c Tue Jul 31 23:23:40 2001 +0000 @@ -20,7 +20,7 @@ */ #ifdef HAVE_CONFIG_H -#include "../config.h" +#include <config.h> #endif #include <string.h> #include <sys/time.h>
--- a/src/dialogs.c Tue Jul 31 18:02:40 2001 +0000 +++ b/src/dialogs.c Tue Jul 31 23:23:40 2001 +0000 @@ -20,7 +20,7 @@ */ #ifdef HAVE_CONFIG_H -#include "../config.h" +#include <config.h> #endif #include <string.h> #include <stdio.h>
--- a/src/gaim.h Tue Jul 31 18:02:40 2001 +0000 +++ b/src/gaim.h Tue Jul 31 23:23:40 2001 +0000 @@ -23,7 +23,7 @@ #define _GAIM_GAIM_H_ #ifdef HAVE_CONFIG_H -#include "../config.h" +#include <config.h> #endif #include <gtk/gtk.h>
--- a/src/gaimrc.c Tue Jul 31 18:02:40 2001 +0000 +++ b/src/gaimrc.c Tue Jul 31 23:23:40 2001 +0000 @@ -20,7 +20,7 @@ */ #ifdef HAVE_CONFIG_H -#include "../config.h" +#include <config.h> #endif #include <string.h> #include <sys/time.h>
--- a/src/html.c Tue Jul 31 18:02:40 2001 +0000 +++ b/src/html.c Tue Jul 31 23:23:40 2001 +0000 @@ -20,7 +20,7 @@ */ #ifdef HAVE_CONFIG_H -#include "../config.h" +#include <config.h> #endif #include <string.h> #include <stdio.h>
--- a/src/idle.c Tue Jul 31 18:02:40 2001 +0000 +++ b/src/idle.c Tue Jul 31 23:23:40 2001 +0000 @@ -20,7 +20,7 @@ */ #ifdef HAVE_CONFIG_H -#include "../config.h" +#include <config.h> #endif #include <time.h> #include <stdio.h>
--- a/src/perl.c Tue Jul 31 18:02:40 2001 +0000 +++ b/src/perl.c Tue Jul 31 23:23:40 2001 +0000 @@ -25,7 +25,7 @@ */ #ifdef HAVE_CONFIG_H -#include "../config.h" +#include <config.h> #ifdef DEBUG #undef DEBUG #endif
--- a/src/plugins.c Tue Jul 31 18:02:40 2001 +0000 +++ b/src/plugins.c Tue Jul 31 23:23:40 2001 +0000 @@ -31,7 +31,7 @@ */ #ifdef HAVE_CONFIG_H -#include "../config.h" +#include <config.h> #endif #include <string.h>
--- a/src/prefs.c Tue Jul 31 18:02:40 2001 +0000 +++ b/src/prefs.c Tue Jul 31 23:23:40 2001 +0000 @@ -20,7 +20,7 @@ */ #ifdef HAVE_CONFIG_H -#include "../config.h" +#include <config.h> #endif #include <string.h> #include <sys/time.h>
--- a/src/protocols/icq/gaim_icq.c Tue Jul 31 18:02:40 2001 +0000 +++ b/src/protocols/icq/gaim_icq.c Tue Jul 31 23:23:40 2001 +0000 @@ -58,25 +58,25 @@ gint inpa; }; -static void gaim_icq_handler(gpointer data, gint source, GdkInputCondition cond) { - if (cond & GDK_INPUT_READ) +static void gaim_icq_handler(gpointer data, gint source, GaimInputCondition cond) { + if (cond & GAIM_INPUT_READ) icq_HandleReadySocket(source, ICQ_SOCKET_READ); - if (cond & GDK_INPUT_WRITE) + if (cond & GAIM_INPUT_WRITE) icq_HandleReadySocket(source, ICQ_SOCKET_WRITE); } static void icq_sock_notify(int socket, int type, int status) { struct gaim_sock *gs = NULL; if (status) { - GdkInputCondition cond; + GaimInputCondition cond; if (type == ICQ_SOCKET_READ) - cond = GDK_INPUT_READ; + cond = GAIM_INPUT_READ; else - cond = GDK_INPUT_WRITE; + cond = GAIM_INPUT_WRITE; gs = g_new0(struct gaim_sock, 1); gs->socket = socket; gs->type = type; - gs->inpa = gdk_input_add(socket, cond, gaim_icq_handler, NULL); + gs->inpa = gaim_input_add(socket, cond, gaim_icq_handler, NULL); sockets = g_list_append(sockets, gs); debug_printf("Adding socket notifier: %d %d (%d)\n", socket, type, gs->inpa); } else { @@ -88,7 +88,7 @@ m = g_list_next(m); } if (m) { - gdk_input_remove(gs->inpa); + gaim_input_remove(gs->inpa); sockets = g_list_remove(sockets, gs); debug_printf("Removing socket notifier: %d %d (%d)\n", socket, type, gs->inpa); g_free(gs);
--- a/src/protocols/irc/irc.c Tue Jul 31 18:02:40 2001 +0000 +++ b/src/protocols/irc/irc.c Tue Jul 31 23:23:40 2001 +0000 @@ -20,7 +20,7 @@ * */ -#include "../config.h" +#include <config.h> #include <netdb.h> @@ -568,7 +568,7 @@ -static void irc_callback(gpointer data, gint source, GdkInputCondition condition) +static void irc_callback(gpointer data, gint source, GaimInputCondition condition) { struct gaim_connection *gc = data; int i = 0; @@ -1835,10 +1835,10 @@ } if (gc->inpa) - gdk_input_remove(gc->inpa); + gaim_input_remove(gc->inpa); if (idata->inpa) - gdk_input_remove(idata->inpa); + gaim_input_remove(idata->inpa); close(idata->fd); g_free(gc->proto_data); @@ -1862,7 +1862,7 @@ g_free(buf); } -static void irc_login_callback(gpointer data, gint source, GdkInputCondition condition) +static void irc_login_callback(gpointer data, gint source, GaimInputCondition condition) { struct gaim_connection *gc = data; struct irc_data *idata; @@ -1893,7 +1893,7 @@ return; } - idata->inpa = gdk_input_add(idata->fd, GDK_INPUT_READ, irc_callback, gc); + idata->inpa = gaim_input_add(idata->fd, GAIM_INPUT_READ, irc_callback, gc); idata->inpa = 0; /* Now lets sign ourselves on */
--- a/src/protocols/jabber/jabber.c Tue Jul 31 18:02:40 2001 +0000 +++ b/src/protocols/jabber/jabber.c Tue Jul 31 23:23:40 2001 +0000 @@ -393,7 +393,7 @@ j->current = x; } -static void jabber_callback(gpointer data, gint source, GdkInputCondition condition) +static void jabber_callback(gpointer data, gint source, GaimInputCondition condition) { struct gaim_connection *gc = (struct gaim_connection *)data; struct jabber_data *jd = (struct jabber_data *)gc->proto_data; @@ -409,7 +409,7 @@ xmlnode_insert_cdata(j->current, s, slen); } -static void gjab_connected(gpointer data, gint source, GdkInputCondition cond) +static void gjab_connected(gpointer data, gint source, GaimInputCondition cond) { xmlnode x; char *t, *t2; @@ -452,7 +452,7 @@ STATE_EVT(JCONN_STATE_ON); gc = GJ_GC(j); - gc->inpa = gdk_input_add(j->fd, GDK_INPUT_READ, jabber_callback, gc); + gc->inpa = gaim_input_add(j->fd, GAIM_INPUT_READ, jabber_callback, gc); } static void gjab_start(gjconn j) @@ -1206,7 +1206,7 @@ struct jabber_data *jd = gc->proto_data; g_hash_table_foreach_remove(jd->hash, jabber_destroy_hash, NULL); g_hash_table_destroy(jd->hash); - gdk_input_remove(gc->inpa); + gaim_input_remove(gc->inpa); close(jd->jc->fd); gtk_timeout_add(50, jabber_free, jd->jc); jd->jc = NULL; @@ -1672,7 +1672,7 @@ static int catch = 0; switch (state) { case JCONN_STATE_OFF: - gdk_input_remove(reginpa); + gaim_input_remove(reginpa); reginpa = 0; jab_delete(j); break; @@ -1776,7 +1776,7 @@ xmlnode_free(p->x); } -static void regjcall(gpointer data, gint source, GdkInputCondition cond) +static void regjcall(gpointer data, gint source, GaimInputCondition cond) { gjab_recv((gjconn)regjconn); } @@ -1819,7 +1819,7 @@ jab_packet_handler(regjconn, regpacket); jab_start(regjconn); - reginpa = gdk_input_add(jab_getfd(regjconn), GDK_INPUT_READ, regjcall, NULL); + reginpa = gaim_input_add(jab_getfd(regjconn), GAIM_INPUT_READ, regjcall, NULL); } static char *jabber_normalize(const char *s)
--- a/src/protocols/msn/msn.c Tue Jul 31 18:02:40 2001 +0000 +++ b/src/protocols/msn/msn.c Tue Jul 31 23:23:40 2001 +0000 @@ -58,8 +58,8 @@ char *friend; }; -static void msn_login_callback(gpointer, gint, GdkInputCondition); -static void msn_login_xfr_connect(gpointer, gint, GdkInputCondition); +static void msn_login_callback(gpointer, gint, GaimInputCondition); +static void msn_login_xfr_connect(gpointer, gint, GaimInputCondition); #define GET_NEXT(tmp) while (*(tmp) && !isspace(*(tmp))) \ (tmp)++; \ @@ -322,7 +322,7 @@ struct msn_data *md = gc->proto_data; if (ms->inpa) - gdk_input_remove(ms->inpa); + gaim_input_remove(ms->inpa); close(ms->fd); if (ms->sessid) g_free(ms->sessid); @@ -339,7 +339,7 @@ g_free(ms); } -static void msn_switchboard_callback(gpointer data, gint source, GdkInputCondition cond) +static void msn_switchboard_callback(gpointer data, gint source, GaimInputCondition cond) { struct msn_switchboard *ms = data; struct gaim_connection *gc = ms->gc; @@ -494,7 +494,7 @@ } } -static void msn_rng_connect(gpointer data, gint source, GdkInputCondition cond) +static void msn_rng_connect(gpointer data, gint source, GaimInputCondition cond) { struct msn_switchboard *ms = data; struct gaim_connection *gc = ms->gc; @@ -523,10 +523,10 @@ } md->switches = g_slist_append(md->switches, ms); - ms->inpa = gdk_input_add(ms->fd, GDK_INPUT_READ, msn_switchboard_callback, ms); + ms->inpa = gaim_input_add(ms->fd, GAIM_INPUT_READ, msn_switchboard_callback, ms); } -static void msn_ss_xfr_connect(gpointer data, gint source, GdkInputCondition cond) +static void msn_ss_xfr_connect(gpointer data, gint source, GaimInputCondition cond) { struct msn_switchboard *ms = data; struct gaim_connection *gc = ms->gc; @@ -548,7 +548,7 @@ return; } - ms->inpa = gdk_input_add(ms->fd, GDK_INPUT_READ, msn_switchboard_callback, ms); + ms->inpa = gaim_input_add(ms->fd, GAIM_INPUT_READ, msn_switchboard_callback, ms); } struct msn_add_permit { @@ -577,7 +577,7 @@ g_free(map); } -static void msn_callback(gpointer data, gint source, GdkInputCondition cond) +static void msn_callback(gpointer data, gint source, GaimInputCondition cond) { struct gaim_connection *gc = data; struct msn_data *md = gc->proto_data; @@ -885,7 +885,7 @@ ms->fd = proxy_connect(host, port, msn_ss_xfr_connect, ms); } else { close(md->fd); - gdk_input_remove(md->inpa); + gaim_input_remove(md->inpa); md->inpa = 0; md->fd = 0; md->fd = proxy_connect(host, port, msn_login_xfr_connect, gc); @@ -897,7 +897,7 @@ } } -static void msn_login_xfr_connect(gpointer data, gint source, GdkInputCondition cond) +static void msn_login_xfr_connect(gpointer data, gint source, GaimInputCondition cond) { struct gaim_connection *gc = data; struct msn_data *md; @@ -924,10 +924,10 @@ return; } - md->inpa = gdk_input_add(md->fd, GDK_INPUT_READ, msn_login_callback, gc); + md->inpa = gaim_input_add(md->fd, GAIM_INPUT_READ, msn_login_callback, gc); } -static void msn_login_callback(gpointer data, gint source, GdkInputCondition cond) +static void msn_login_callback(gpointer data, gint source, GaimInputCondition cond) { struct gaim_connection *gc = data; struct msn_data *md = gc->proto_data; @@ -1004,8 +1004,8 @@ account_online(gc); serv_finish_login(gc); - gdk_input_remove(md->inpa); - md->inpa = gdk_input_add(md->fd, GDK_INPUT_READ, msn_callback, gc); + gaim_input_remove(md->inpa); + md->inpa = gaim_input_add(md->fd, GAIM_INPUT_READ, msn_callback, gc); } else if (strstr(buf, "MD5")) { char *challenge = buf; char buf2[MSN_BUF_LEN]; @@ -1065,7 +1065,7 @@ port = 1863; close(md->fd); - gdk_input_remove(md->inpa); + gaim_input_remove(md->inpa); md->inpa = 0; md->fd = 0; md->fd = proxy_connect(host, port, msn_login_xfr_connect, gc); @@ -1079,7 +1079,7 @@ } } -static void msn_login_connect(gpointer data, gint source, GdkInputCondition cond) +static void msn_login_connect(gpointer data, gint source, GaimInputCondition cond) { struct gaim_connection *gc = data; struct msn_data *md; @@ -1106,7 +1106,7 @@ return; } - md->inpa = gdk_input_add(md->fd, GDK_INPUT_READ, msn_login_callback, gc); + md->inpa = gaim_input_add(md->fd, GAIM_INPUT_READ, msn_login_callback, gc); set_login_progress(gc, 2, "Synching with server"); } @@ -1127,7 +1127,7 @@ struct msn_data *md = gc->proto_data; close(md->fd); if (md->inpa) - gdk_input_remove(md->inpa); + gaim_input_remove(md->inpa); while (md->switches) msn_kill_switch(md->switches->data); while (md->fl) {
--- a/src/protocols/napster/napster.c Tue Jul 31 18:02:40 2001 +0000 +++ b/src/protocols/napster/napster.c Tue Jul 31 23:23:40 2001 +0000 @@ -19,7 +19,7 @@ * */ -#include "../config.h" +#include <config.h> #include <netdb.h> #include <gtk/gtk.h> @@ -306,7 +306,7 @@ return NULL; } -static void nap_ctc_callback(gpointer data, gint source, GdkInputCondition condition) +static void nap_ctc_callback(gpointer data, gint source, GaimInputCondition condition) { struct gaim_connection *gc = (struct gaim_connection *)data; struct nap_data *ndata = (struct nap_data *)gc->proto_data; @@ -338,7 +338,7 @@ if (buf[0] != '1') { do_error_dialog("Uh Oh", "Uh Oh"); - gdk_input_remove(req->inpa); + gaim_input_remove(req->inpa); ndata->requests = g_slist_remove(ndata->requests, req); g_free(req->name); g_free(req->file); @@ -367,7 +367,7 @@ /* If we have a zero file size then something bad happened */ if (filesize == 0) { - gdk_input_remove(req->inpa); + gaim_input_remove(req->inpa); ndata->requests = g_slist_remove(ndata->requests, req); g_free(req->name); g_free(req->file); @@ -449,7 +449,7 @@ if (req->size >= req->total) { printf("Download complete.\n"); nap_write_packet(gc, 0xdb, "\n"); /* Tell the server we're finished */ - gdk_input_remove(req->inpa); + gaim_input_remove(req->inpa); ndata->requests = g_slist_remove(ndata->requests, req); @@ -465,7 +465,7 @@ } } -static void nap_get_file_connect(gpointer data, gint source, GdkInputCondition cond) +static void nap_get_file_connect(gpointer data, gint source, GaimInputCondition cond) { char buf[NAP_BUF_LEN]; struct nap_file_request *req = data; @@ -494,7 +494,7 @@ ndata->requests = g_slist_append(ndata->requests, req); /* And start monitoring */ - req->inpa = gdk_input_add(req->fd, GDK_INPUT_READ, nap_ctc_callback, gc); + req->inpa = gaim_input_add(req->fd, GAIM_INPUT_READ, nap_ctc_callback, gc); } static void nap_get_file(struct gaim_connection *gc, gchar *user, gchar *file, gchar *host, unsigned int port) @@ -518,7 +518,7 @@ } } -static void nap_callback(gpointer data, gint source, GdkInputCondition condition) +static void nap_callback(gpointer data, gint source, GaimInputCondition condition) { struct gaim_connection *gc = data; struct nap_data *ndata = gc->proto_data; @@ -835,7 +835,7 @@ } -static void nap_login_callback(gpointer data, gint source, GdkInputCondition condition) +static void nap_login_callback(gpointer data, gint source, GaimInputCondition condition) { struct gaim_connection *gc = data; struct nap_data *ndata = gc->proto_data; @@ -855,7 +855,7 @@ if (command == 0x00) { do_error_dialog(buf, "Gaim: Napster Error"); - gdk_input_remove(ndata->inpa); + gaim_input_remove(ndata->inpa); ndata->inpa = 0; close(source); signoff(gc); @@ -867,9 +867,9 @@ ndata->email = g_strdup(buf); /* Remove old inpa, add new one */ - gdk_input_remove(ndata->inpa); + gaim_input_remove(ndata->inpa); ndata->inpa = 0; - gc->inpa = gdk_input_add(ndata->fd, GDK_INPUT_READ, nap_callback, gc); + gc->inpa = gaim_input_add(ndata->fd, GAIM_INPUT_READ, nap_callback, gc); /* Our signon is complete */ account_online(gc); @@ -883,7 +883,7 @@ } -static void nap_login_connect(gpointer data, gint source, GdkInputCondition cond) +static void nap_login_connect(gpointer data, gint source, GaimInputCondition cond) { struct gaim_connection *gc = data; struct nap_data *ndata = gc->proto_data; @@ -903,7 +903,7 @@ nap_write_packet(gc, 0x02, buf); /* And set up the input watcher */ - ndata->inpa = gdk_input_add(ndata->fd, GDK_INPUT_READ, nap_login_callback, gc); + ndata->inpa = gaim_input_add(ndata->fd, GAIM_INPUT_READ, nap_login_callback, gc); } @@ -985,7 +985,7 @@ struct nap_file_request *req; if (gc->inpa) - gdk_input_remove(gc->inpa); + gaim_input_remove(gc->inpa); while (ndata->channels) { channel = (struct nap_channel *)ndata->channels->data; @@ -1007,7 +1007,7 @@ g_free(req->name); g_free(req->file); if (req->inpa) { - gdk_input_remove(req->inpa); + gaim_input_remove(req->inpa); } ndata->requests = g_slist_remove(ndata->requests, req); g_free(req);
--- a/src/protocols/oscar/oscar.c Tue Jul 31 18:02:40 2001 +0000 +++ b/src/protocols/oscar/oscar.c Tue Jul 31 23:23:40 2001 +0000 @@ -21,7 +21,7 @@ */ #ifdef HAVE_CONFIG_H -#include "../config.h" +#include <config.h> #endif @@ -318,7 +318,7 @@ static int msgerrreasonlen = 25; static void oscar_callback(gpointer data, gint source, - GdkInputCondition condition) { + GaimInputCondition condition) { struct aim_conn_t *conn = (struct aim_conn_t *)data; struct aim_session_t *sess = aim_conn_getsess(conn); struct gaim_connection *gc = sess ? sess->aux_data : NULL; @@ -339,12 +339,7 @@ return; } - if (condition & GDK_INPUT_EXCEPTION) { - hide_login_progress(gc, _("Disconnected.")); - signoff(gc); - return; - } - if (condition & GDK_INPUT_READ) { + if (condition & GAIM_INPUT_READ) { if (conn->type == AIM_CONN_TYPE_RENDEZVOUS_OUT) { debug_printf("got information on rendezvous\n"); if (aim_handlerendconnect(odata->sess, conn) < 0) { @@ -367,7 +362,7 @@ debug_printf("disconnected from chat room %s\n", c->name); c->conn = NULL; if (c->inpa > 0) - gdk_input_remove(c->inpa); + gaim_input_remove(c->inpa); c->inpa = 0; c->fd = -1; aim_conn_kill(odata->sess, &conn); @@ -375,7 +370,7 @@ do_error_dialog(buf, _("Chat Error!")); } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { if (odata->cnpa > 0) - gdk_input_remove(odata->cnpa); + gaim_input_remove(odata->cnpa); odata->cnpa = 0; debug_printf("removing chatnav input watcher\n"); if (odata->create_exchange) { @@ -388,7 +383,7 @@ aim_conn_kill(odata->sess, &conn); } else if (conn->type == AIM_CONN_TYPE_AUTH) { if (odata->paspa > 0) - gdk_input_remove(odata->paspa); + gaim_input_remove(odata->paspa); odata->paspa = 0; debug_printf("removing authconn input watcher\n"); aim_conn_kill(odata->sess, &conn); @@ -421,7 +416,7 @@ g_free(s); } -static void oscar_login_connect(gpointer data, gint source, GdkInputCondition cond) +static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond) { struct gaim_connection *gc = data; struct oscar_data *odata; @@ -444,7 +439,7 @@ } aim_conn_completeconnect(sess, conn); - gc->inpa = gdk_input_add(conn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, + gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, oscar_callback, conn); debug_printf(_("Password sent, waiting for response\n")); } @@ -505,7 +500,7 @@ while (odata->oscar_chats) { struct chat_connection *n = odata->oscar_chats->data; if (n->inpa > 0) - gdk_input_remove(n->inpa); + gaim_input_remove(n->inpa); g_free(n->name); g_free(n->show); odata->oscar_chats = g_slist_remove(odata->oscar_chats, n); @@ -514,7 +509,7 @@ while (odata->direct_ims) { struct direct_im *n = odata->direct_ims->data; if (n->watcher > 0) - gdk_input_remove(n->watcher); + gaim_input_remove(n->watcher); odata->direct_ims = g_slist_remove(odata->direct_ims, n); g_free(n); } @@ -537,11 +532,11 @@ } #endif if (gc->inpa > 0) - gdk_input_remove(gc->inpa); + gaim_input_remove(gc->inpa); if (odata->cnpa > 0) - gdk_input_remove(odata->cnpa); + gaim_input_remove(odata->cnpa); if (odata->paspa > 0) - gdk_input_remove(odata->paspa); + gaim_input_remove(odata->paspa); aim_session_kill(odata->sess); g_free(odata->sess); odata->sess = NULL; @@ -550,7 +545,7 @@ debug_printf(_("Signed off.\n")); } -static void oscar_bos_connect(gpointer data, gint source, GdkInputCondition cond) { +static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) { struct gaim_connection *gc = data; struct oscar_data *odata; struct aim_session_t *sess; @@ -572,7 +567,7 @@ } aim_conn_completeconnect(sess, bosconn); - gc->inpa = gdk_input_add(bosconn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, + gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ, oscar_callback, bosconn); set_login_progress(gc, 4, _("Connection established, cookie sent")); } @@ -718,7 +713,7 @@ return 0; } aim_auth_sendcookie(sess, bosconn, cookie); - gdk_input_remove(gc->inpa); + gaim_input_remove(gc->inpa); return 1; } @@ -732,7 +727,7 @@ unsigned int inpa; }; -static void damn_you(gpointer data, gint source, GdkInputCondition c) +static void damn_you(gpointer data, gint source, GaimInputCondition c) { struct pieceofcrap *pos = data; struct oscar_data *od = pos->gc->proto_data; @@ -752,7 +747,7 @@ if (in != '\n') { do_error_dialog("Gaim was unable to get a valid hash for logging into AIM." " You may be disconnected shortly.", "Login Error"); - gdk_input_remove(pos->inpa); + gaim_input_remove(pos->inpa); close(pos->fd); g_free(pos); return; @@ -763,13 +758,13 @@ for (x = 0; x < 16; x++) debug_printf("%02x ", (unsigned char)m[x]); debug_printf("\n"); - gdk_input_remove(pos->inpa); + gaim_input_remove(pos->inpa); close(pos->fd); aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH); g_free(pos); } -static void straight_to_hell(gpointer data, gint source, GdkInputCondition cond) { +static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) { struct pieceofcrap *pos = data; char buf[BUF_LONG]; @@ -788,7 +783,7 @@ write(pos->fd, buf, strlen(buf)); if (pos->modname) g_free(pos->modname); - pos->inpa = gdk_input_add(pos->fd, GDK_INPUT_READ, damn_you, pos); + pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos); return; } @@ -947,7 +942,7 @@ return 1; } -static void oscar_chatnav_connect(gpointer data, gint source, GdkInputCondition cond) +static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) { struct gaim_connection *gc = data; struct oscar_data *odata; @@ -970,12 +965,12 @@ } aim_conn_completeconnect(sess, tstconn); - odata->cnpa = gdk_input_add(tstconn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, + odata->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); debug_printf("chatnav: connected\n"); } -static void oscar_auth_connect(gpointer data, gint source, GdkInputCondition cond) +static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond) { struct gaim_connection *gc = data; struct oscar_data *odata; @@ -998,12 +993,12 @@ } aim_conn_completeconnect(sess, tstconn); - odata->paspa = gdk_input_add(tstconn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, + odata->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); debug_printf("chatnav: connected\n"); } -static void oscar_chat_connect(gpointer data, gint source, GdkInputCondition cond) +static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond) { struct chat_connection *ccon = data; struct gaim_connection *gc = ccon->gc; @@ -1032,8 +1027,8 @@ } aim_conn_completeconnect(sess, ccon->conn); - ccon->inpa = gdk_input_add(tstconn->fd, - GDK_INPUT_READ | GDK_INPUT_EXCEPTION, + ccon->inpa = gaim_input_add(tstconn->fd, + GAIM_INPUT_READ, oscar_callback, tstconn); odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon); aim_chat_attachname(tstconn, ccon->name); @@ -1220,12 +1215,12 @@ struct oscar_data *od = (struct oscar_data *)d->gc->proto_data; od->direct_ims = g_slist_remove(od->direct_ims, d); - gdk_input_remove(d->watcher); + gaim_input_remove(d->watcher); aim_conn_kill(od->sess, &d->conn); g_free(d); } -static void oscar_directim_callback(gpointer data, gint source, GdkInputCondition condition) { +static void oscar_directim_callback(gpointer data, gint source, GaimInputCondition condition) { struct direct_im *dim = data; struct gaim_connection *gc = dim->gc; struct oscar_data *od = gc->proto_data; @@ -1251,7 +1246,7 @@ gtk_signal_connect(GTK_OBJECT(dim->cnv->window), "destroy", GTK_SIGNAL_FUNC(delete_direct_im), dim); - dim->watcher = gdk_input_add(dim->conn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, + dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, oscar_callback, dim->conn); } @@ -1333,9 +1328,9 @@ struct oscar_data *od = (struct oscar_data *)gc->proto_data; gtk_widget_destroy(gt->window); - gdk_input_remove(gt->gip); + gaim_input_remove(gt->gip); if (gt->gop > 0) - gdk_input_remove(gt->gop); + gaim_input_remove(gt->gop); aim_conn_kill(od->sess, >->conn); od->getfiles = g_slist_remove(od->getfiles, gt); g_free(gt->receiver); @@ -1395,17 +1390,17 @@ return 1; } -static void getfile_send_callback(gpointer data, gint source, GdkInputCondition condition) { +static void getfile_send_callback(gpointer data, gint source, GaimInputCondition condition) { struct getfile_transfer *gt = (struct getfile_transfer *)data; int result; result = aim_getfile_send_chunk(gt->conn, gt->file, gt->fh, -1, 1024); gt->pos += result; if (result == 0) { - gdk_input_remove(gt->gop); gt->gop = 0; + gaim_input_remove(gt->gop); gt->gop = 0; } else if (result == -1) { do_error_dialog(_("Error in transfer"), "Gaim"); - gdk_input_remove(gt->gop); gt->gop = 0; + gaim_input_remove(gt->gop); gt->gop = 0; interrupt_getfile(NULL, gt); } } @@ -1441,7 +1436,7 @@ gt->fh = g_memdup(fh, sizeof(struct aim_fileheader_t)); fseek(gt->file, 0, SEEK_SET); - gt->gop = gdk_input_add(gt->conn->fd, GDK_INPUT_WRITE, getfile_send_callback, gt); + gt->gop = gaim_input_add(gt->conn->fd, GAIM_INPUT_WRITE, getfile_send_callback, gt); return 1; } @@ -1485,9 +1480,9 @@ gt = find_getfile_transfer(od, conn); od->getfiles = g_slist_remove(od->getfiles, gt); - gdk_input_remove(gt->gip); + gaim_input_remove(gt->gip); if (gt->gop > 0) - gdk_input_remove(gt->gop); + gaim_input_remove(gt->gop); g_free(gt->receiver); g_free(gt->filename); aim_conn_kill(sess, &conn); @@ -1499,13 +1494,13 @@ return 1; } -static void oscar_getfile_callback(gpointer data, gint source, GdkInputCondition condition) { +static void oscar_getfile_callback(gpointer data, gint source, GaimInputCondition condition) { struct getfile_transfer *gf = data; struct gaim_connection *gc = gf->gc; struct oscar_data *od = gc->proto_data; - gdk_input_remove(gf->gip); - gf->gip = gdk_input_add(source, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, oscar_callback, gf->conn); + gaim_input_remove(gf->gip); + gf->gip = gaim_input_add(source, GAIM_INPUT_READ, oscar_callback, gf->conn); aim_conn_addhandler(od->sess, gf->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_GETFILEFILEREQ, gaim_getfile_filereq, 0); aim_conn_addhandler(od->sess, gf->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_GETFILEFILESEND, gaim_getfile_filesend, 0); @@ -1573,7 +1568,7 @@ od->getfiles = g_slist_append(od->getfiles, gf); gf->conn = newconn; - gf->gip = gdk_input_add(newconn->fd, GDK_INPUT_WRITE, oscar_getfile_callback, gf); + gf->gip = gaim_input_add(newconn->fd, GAIM_INPUT_WRITE, oscar_getfile_callback, gf); } static int accept_getfile(gpointer w, struct ask_getfile *g) { @@ -2671,7 +2666,7 @@ if (odata) odata->oscar_chats = g_slist_remove(odata->oscar_chats, c); if (c->inpa > 0) - gdk_input_remove(c->inpa); + gaim_input_remove(c->inpa); if (g && odata->sess) aim_conn_kill(odata->sess, &c->conn); g_free(c->name); @@ -2773,9 +2768,9 @@ if (!dim->cnv) dim->cnv = new_conversation(priv->sn); gtk_signal_connect(GTK_OBJECT(dim->cnv->window), "destroy", GTK_SIGNAL_FUNC(delete_direct_im), dim); - gdk_input_remove(dim->watcher); + gaim_input_remove(dim->watcher); dim->conn = newconn; - dim->watcher = gdk_input_add(dim->conn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, + dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, oscar_callback, dim->conn); g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), priv->sn); write_to_conv(dim->cnv, buf, WFLAG_SYSTEM, NULL, time((time_t)NULL)); @@ -2831,7 +2826,7 @@ dim = find_direct_im(od, sn); od->direct_ims = g_slist_remove(od->direct_ims, dim); - gdk_input_remove(dim->watcher); + gaim_input_remove(dim->watcher); gtk_signal_disconnect_by_data(GTK_OBJECT(dim->cnv->window), dim); g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), sn); @@ -2888,7 +2883,7 @@ dim->conn = aim_directim_initiate(od->sess, od->conn, NULL, data->who); if (dim->conn != NULL) { od->direct_ims = g_slist_append(od->direct_ims, dim); - dim->watcher = gdk_input_add(dim->conn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, + dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, oscar_callback, dim->conn); aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINITIATE, gaim_directim_initiate, 0);
--- a/src/protocols/toc/toc.c Tue Jul 31 18:02:40 2001 +0000 +++ b/src/protocols/toc/toc.c Tue Jul 31 23:23:40 2001 +0000 @@ -22,7 +22,7 @@ #ifdef HAVE_CONFIG_H -#include "../config.h" +#include <config.h> #endif #include <netdb.h> #include <gtk/gtk.h> @@ -126,8 +126,8 @@ static GtkWidget *join_chat_spin = NULL; static GtkWidget *join_chat_entry = NULL; -static void toc_login_callback(gpointer, gint, GdkInputCondition); -static void toc_callback(gpointer, gint, GdkInputCondition); +static void toc_login_callback(gpointer, gint, GaimInputCondition); +static void toc_callback(gpointer, gint, GaimInputCondition); static unsigned char *roast_password(char *); static void accept_file_dialog(struct ft_request *); @@ -162,7 +162,7 @@ } } -static void toc_login_callback(gpointer data, gint source, GdkInputCondition cond) +static void toc_login_callback(gpointer data, gint source, GaimInputCondition cond) { struct gaim_connection *gc = data; struct toc_data *tdt; @@ -196,7 +196,7 @@ /* i know a lot of people like to look at gaim to see how TOC works. so i'll comment * on what this does. it's really simple. when there's data ready to be read from the * toc_fd file descriptor, toc_callback is called, with gc passed as its data arg. */ - gc->inpa = gdk_input_add(tdt->toc_fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, toc_callback, gc); + gc->inpa = gaim_input_add(tdt->toc_fd, GAIM_INPUT_READ, toc_callback, gc); g_snprintf(buf, sizeof(buf), "Signon: %s", gc->username); set_login_progress(gc, 2, buf); @@ -205,7 +205,7 @@ static void toc_close(struct gaim_connection *gc) { if (gc->inpa > 0) - gdk_input_remove(gc->inpa); + gaim_input_remove(gc->inpa); gc->inpa = 0; close(((struct toc_data *)gc->proto_data)->toc_fd); g_free(gc->proto_data); @@ -310,7 +310,7 @@ g_show_info_text(url_text); } -static void toc_callback(gpointer data, gint source, GdkInputCondition condition) +static void toc_callback(gpointer data, gint source, GaimInputCondition condition) { struct gaim_connection *gc = (struct gaim_connection *)data; struct toc_data *tdt = (struct toc_data *)gc->proto_data; @@ -319,13 +319,6 @@ char buf[8 * 1024], *c; char snd[BUF_LEN * 2]; - if (condition & GDK_INPUT_EXCEPTION) { - debug_printf("gdk_input exception! check internet connection\n"); - hide_login_progress(gc, _("Connection Closed")); - signoff(gc); - return; - } - /* there's data waiting to be read, so read it. */ if (wait_reply(gc, buf, 8 * 1024) <= 0) { hide_login_progress(gc, _("Connection Closed")); @@ -1411,26 +1404,13 @@ f->name); } -static void toc_send_file_callback(gpointer data, gint source, GdkInputCondition cond) +static void toc_send_file_callback(gpointer data, gint source, GaimInputCondition cond) { char buf[BUF_LONG]; int rt, i; struct file_transfer *ft = data; - if (cond & GDK_INPUT_EXCEPTION) { - gdk_input_remove(ft->inpa); - close(source); - g_free(ft->filename); - g_free(ft->user); - g_free(ft->ip); - g_free(ft->cookie); - if (ft->file) - fclose(ft->file); - g_free(ft); - return; - } - if (ft->hdr.hdrtype != 0x202) { char *buf; frombase64(ft->cookie, &buf, NULL); @@ -1452,7 +1432,7 @@ buf = g_strdup_printf("Could not open %s for writing!", ft->filename); do_error_dialog(buf, _("Error")); g_free(buf); - gdk_input_remove(ft->inpa); + gaim_input_remove(ft->inpa); close(source); g_free(ft->filename); g_free(ft->user); @@ -1469,7 +1449,7 @@ ft->hdr.name); do_error_dialog(buf, _("Error")); g_free(buf); - gdk_input_remove(ft->inpa); + gaim_input_remove(ft->inpa); close(source); g_free(ft->filename); g_free(ft->user); @@ -1485,7 +1465,7 @@ rt = read(source, buf, MIN(ntohl(ft->hdr.size) - ft->recvsize, 1024)); if (rt < 0) { do_error_dialog("File transfer failed; other side probably canceled.", "Error"); - gdk_input_remove(ft->inpa); + gaim_input_remove(ft->inpa); close(source); g_free(ft->user); g_free(ft->ip); @@ -1511,7 +1491,7 @@ ft->recvsize = 0; fclose(ft->file); if (ft->hdr.filesleft == 0) { - gdk_input_remove(ft->inpa); + gaim_input_remove(ft->inpa); close(source); g_free(ft->filename); g_free(ft->user); @@ -1522,7 +1502,7 @@ } } -static void toc_send_file_connect(gpointer data, gint src, GdkInputCondition cond) +static void toc_send_file_connect(gpointer data, gint src, GaimInputCondition cond) { struct file_transfer *ft = data; @@ -1536,7 +1516,7 @@ return; } - ft->inpa = gdk_input_add(src, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, toc_send_file_callback, ft); + ft->inpa = gaim_input_add(src, GAIM_INPUT_READ, toc_send_file_callback, ft); } static void toc_send_file(gpointer a, struct file_transfer *old_ft) @@ -1579,28 +1559,13 @@ } } -static void toc_get_file_callback(gpointer data, gint source, GdkInputCondition cond) +static void toc_get_file_callback(gpointer data, gint source, GaimInputCondition cond) { char buf[BUF_LONG]; struct file_transfer *ft = data; - if (cond & GDK_INPUT_EXCEPTION) { - do_error_dialog("The file tranfer has been aborted; the other side most likely" - " cancelled.", "Error"); - gdk_input_remove(ft->inpa); - close(source); - g_free(ft->filename); - g_free(ft->user); - g_free(ft->ip); - g_free(ft->cookie); - if (ft->file) - fclose(ft->file); - g_free(ft); - return; - } - - if (cond & GDK_INPUT_WRITE) { + if (cond & GAIM_INPUT_WRITE) { int remain = MIN(ntohl(ft->hdr.totsize) - ft->recvsize, 1024); int i; for (i = 0; i < remain; i++) @@ -1608,8 +1573,8 @@ write(source, buf, remain); ft->recvsize += remain; if (ft->recvsize == ntohl(ft->hdr.totsize)) { - gdk_input_remove(ft->inpa); - ft->inpa = gdk_input_add(source, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, + gaim_input_remove(ft->inpa); + ft->inpa = gaim_input_add(source, GAIM_INPUT_READ, toc_get_file_callback, ft); } return; @@ -1648,7 +1613,7 @@ if (ft->hdr.hdrtype != htons(0x120c)) { g_snprintf(buf, sizeof(buf), "%s decided to cancel the transfer", ft->user); do_error_dialog(buf, "Error"); - gdk_input_remove(ft->inpa); + gaim_input_remove(ft->inpa); close(source); g_free(ft->filename); g_free(ft->user); @@ -1672,8 +1637,8 @@ read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); debug_header(ft); - gdk_input_remove(ft->inpa); - ft->inpa = gdk_input_add(source, GDK_INPUT_WRITE | GDK_INPUT_EXCEPTION, + gaim_input_remove(ft->inpa); + ft->inpa = gaim_input_add(source, GAIM_INPUT_WRITE, toc_get_file_callback, ft); return; } @@ -1683,7 +1648,7 @@ read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); debug_header(ft); - gdk_input_remove(ft->inpa); + gaim_input_remove(ft->inpa); close(source); g_free(ft->filename); g_free(ft->user); @@ -1696,7 +1661,7 @@ } } -static void toc_get_file_connect(gpointer data, gint src, GdkInputCondition cond) +static void toc_get_file_connect(gpointer data, gint src, GaimInputCondition cond) { struct file_transfer *ft = data; struct file_header *hdr; @@ -1743,7 +1708,7 @@ return; } - ft->inpa = gdk_input_add(src, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, toc_get_file_callback, ft); + ft->inpa = gaim_input_add(src, GAIM_INPUT_READ, toc_get_file_callback, ft); } static void toc_get_file(gpointer a, struct file_transfer *old_ft)
--- a/src/protocols/yahoo/yay.c Tue Jul 31 18:02:40 2001 +0000 +++ b/src/protocols/yahoo/yay.c Tue Jul 31 23:23:40 2001 +0000 @@ -332,7 +332,7 @@ return 1; } -static void yahoo_pending(gpointer data, gint source, GdkInputCondition condition) { +static void yahoo_pending(gpointer data, gint source, GaimInputCondition condition) { struct gaim_connection *gc = (struct gaim_connection *)data; struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; @@ -347,7 +347,7 @@ struct conn *c = g_new0(struct conn, 1); c->socket = socket; c->type = type; - c->inpa = gdk_input_add(socket, type, yahoo_pending, gc); + c->inpa = gaim_input_add(socket, type, yahoo_pending, gc); yd->conns = g_list_append(yd->conns, c); } else { GList *c = yd->conns; @@ -355,7 +355,7 @@ struct conn *m = c->data; if ((m->socket == socket) && (m->type == type)) { yd->conns = g_list_remove(yd->conns, m); - gdk_input_remove(m->inpa); + gaim_input_remove(m->inpa); g_free(m); return; } @@ -364,7 +364,7 @@ } } -static void yahoo_got_connected(gpointer data, gint source, GdkInputCondition cond) { +static void yahoo_got_connected(gpointer data, gint source, GaimInputCondition cond) { struct connect *con = data; debug_printf("got connected (possibly)\n");
--- a/src/proxy.c Tue Jul 31 18:02:40 2001 +0000 +++ b/src/proxy.c Tue Jul 31 23:23:40 2001 +0000 @@ -24,7 +24,7 @@ , 2nd provide an easy way to add socks support */ #ifdef HAVE_CONFIG_H -#include "../config.h" +#include "config.h" #endif #include <stdio.h> #include <stdlib.h> @@ -36,10 +36,12 @@ #include <unistd.h> #include <fcntl.h> #include <errno.h> -#include <gtk/gtk.h> #include "gaim.h" #include "proxy.h" +#define GAIM_READ_COND (G_IO_IN | G_IO_HUP | G_IO_ERR) +#define GAIM_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR) + char proxyhost[128] = { 0 }; int proxyport = 0; int proxytype = 0; @@ -47,14 +49,61 @@ char proxypass[128] = { 0 }; struct PHB { - GdkInputFunction func; + GaimInputFunction func; gpointer data; char *host; int port; gint inpa; }; -static void no_one_calls(gpointer data, gint source, GdkInputCondition cond) +typedef struct _GaimIOClosure { + GaimInputFunction function; + gpointer data; +} GaimIOClosure; + +static gboolean gaim_io_invoke(GIOChannel *source, GIOCondition condition, gpointer data) +{ + GaimIOClosure *closure = data; + GaimInputCondition gaim_cond = 0; + + if (condition & GAIM_READ_COND) + gaim_cond |= GAIM_INPUT_READ; + if (condition & GAIM_READ_COND) + gaim_cond |= GAIM_INPUT_WRITE; + + closure->function(closure->data, g_io_channel_unix_get_fd(source), gaim_cond); + + return TRUE; +} + +gint gaim_input_add(gint source, GaimInputCondition condition, + GaimInputFunction function, gpointer data) +{ + guint result; + GaimIOClosure *closure = g_new0(GaimIOClosure, 1); + GIOChannel *channel; + GIOCondition cond = 0; + + closure->function = function; + closure->data = data; + + if (condition & GAIM_INPUT_READ) + cond |= GAIM_READ_COND; + if (condition & GAIM_INPUT_WRITE) + cond |= GAIM_WRITE_COND; + + channel = g_io_channel_unix_new(source); + result = g_io_add_watch(channel, cond, gaim_io_invoke, closure); + g_io_channel_unref(channel); + return result; +} + +void gaim_input_remove(gint tag) +{ + g_source_remove(tag); +} + +static void no_one_calls(gpointer data, gint source, GaimInputCondition cond) { struct PHB *phb = data; unsigned int len; @@ -63,14 +112,14 @@ len = sizeof(error); if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { close(source); - gdk_input_remove(phb->inpa); - phb->func(phb->data, -1, GDK_INPUT_READ); + gaim_input_remove(phb->inpa); + phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb); return; } fcntl(source, F_SETFL, 0); - gdk_input_remove(phb->inpa); - phb->func(phb->data, source, GDK_INPUT_READ); + gaim_input_remove(phb->inpa); + phb->func(phb->data, source, GAIM_INPUT_READ); g_free(phb); } @@ -78,7 +127,7 @@ { struct PHB *phb = data; - phb->func(phb->data, phb->port, GDK_INPUT_READ); + phb->func(phb->data, phb->port, GAIM_INPUT_READ); g_free(phb); return FALSE; @@ -112,7 +161,7 @@ if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { if ((errno == EINPROGRESS) || (errno == EINTR)) { debug_printf("Connect would have blocked\n"); - phb->inpa = gdk_input_add(fd, GDK_INPUT_WRITE, no_one_calls, phb); + phb->inpa = gaim_input_add(fd, GAIM_INPUT_WRITE, no_one_calls, phb); } else { close(fd); g_free(phb); @@ -130,9 +179,9 @@ } fcntl(fd, F_SETFL, 0); phb->port = fd; /* bleh */ - gtk_timeout_add(50, clean_connect, phb); /* we do this because we never - want to call our callback - before we return. */ + g_timeout_add(50, clean_connect, phb); /* we do this because we never + want to call our callback + before we return. */ } return fd; @@ -141,14 +190,14 @@ #define HTTP_GOODSTRING "HTTP/1.0 200 Connection established" #define HTTP_GOODSTRING2 "HTTP/1.1 200 Connection established" -static void http_canread(gpointer data, gint source, GdkInputCondition cond) +static void http_canread(gpointer data, gint source, GaimInputCondition cond) { int nlc = 0; int pos = 0; struct PHB *phb = data; char inputline[8192]; - gdk_input_remove(phb->inpa); + gaim_input_remove(phb->inpa); while ((nlc != 2) && (read(source, &inputline[pos++], 1) == 1)) { if (inputline[pos-1] == '\n') @@ -162,20 +211,20 @@ if ((memcmp(HTTP_GOODSTRING , inputline, strlen(HTTP_GOODSTRING )) == 0) || (memcmp(HTTP_GOODSTRING2, inputline, strlen(HTTP_GOODSTRING2)) == 0)) { - phb->func(phb->data, source, GDK_INPUT_READ); + phb->func(phb->data, source, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); return; } close(source); - phb->func(phb->data, -1, GDK_INPUT_READ); + phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); return; } -static void http_canwrite(gpointer data, gint source, GdkInputCondition cond) +static void http_canwrite(gpointer data, gint source, GaimInputCondition cond) { char cmd[384]; struct PHB *phb = data; @@ -183,11 +232,11 @@ int error = ETIMEDOUT; debug_printf("Connected\n"); if (phb->inpa > 0) - gdk_input_remove(phb->inpa); + gaim_input_remove(phb->inpa); len = sizeof(error); if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { close(source); - phb->func(phb->data, -1, GDK_INPUT_READ); + phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); return; @@ -197,7 +246,7 @@ g_snprintf(cmd, sizeof(cmd), "CONNECT %s:%d HTTP/1.1\r\n", phb->host, phb->port); if (send(source, cmd, strlen(cmd), 0) < 0) { close(source); - phb->func(phb->data, -1, GDK_INPUT_READ); + phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); return; @@ -212,7 +261,7 @@ g_free(t2); if (send(source, cmd, strlen(cmd), 0) < 0) { close(source); - phb->func(phb->data, -1, GDK_INPUT_READ); + phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); return; @@ -222,13 +271,13 @@ g_snprintf(cmd, sizeof(cmd), "\r\n"); if (send(source, cmd, strlen(cmd), 0) < 0) { close(source); - phb->func(phb->data, -1, GDK_INPUT_READ); + phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); return; } - phb->inpa = gdk_input_add(source, GDK_INPUT_READ, http_canread, phb); + phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, http_canread, phb); } static int proxy_connect_http(char *host, unsigned short port, struct PHB *phb) @@ -261,7 +310,7 @@ if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { if ((errno == EINPROGRESS) || (errno == EINTR)) { debug_printf("Connect would have blocked\n"); - phb->inpa = gdk_input_add(fd, GDK_INPUT_WRITE, http_canwrite, phb); + phb->inpa = gaim_input_add(fd, GAIM_INPUT_WRITE, http_canwrite, phb); } else { close(fd); g_free(phb->host); @@ -280,34 +329,34 @@ return -1; } fcntl(fd, F_SETFL, 0); - http_canwrite(phb, fd, GDK_INPUT_WRITE); + http_canwrite(phb, fd, GAIM_INPUT_WRITE); } return fd; } -static void s4_canread(gpointer data, gint source, GdkInputCondition cond) +static void s4_canread(gpointer data, gint source, GaimInputCondition cond) { unsigned char packet[12]; struct PHB *phb = data; - gdk_input_remove(phb->inpa); + gaim_input_remove(phb->inpa); memset(packet, 0, sizeof(packet)); if (read(source, packet, 9) >= 4 && packet[1] == 90) { - phb->func(phb->data, source, GDK_INPUT_READ); + phb->func(phb->data, source, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); return; } close(source); - phb->func(phb->data, -1, GDK_INPUT_READ); + phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); } -static void s4_canwrite(gpointer data, gint source, GdkInputCondition cond) +static void s4_canwrite(gpointer data, gint source, GaimInputCondition cond) { unsigned char packet[12]; struct hostent *hp; @@ -316,11 +365,11 @@ int error = ETIMEDOUT; debug_printf("Connected\n"); if (phb->inpa > 0) - gdk_input_remove(phb->inpa); + gaim_input_remove(phb->inpa); len = sizeof(error); if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { close(source); - phb->func(phb->data, -1, GDK_INPUT_READ); + phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); return; @@ -330,7 +379,7 @@ /* XXX does socks4 not support host name lookups by the proxy? */ if (!(hp = gethostbyname(phb->host))) { close(source); - phb->func(phb->data, -1, GDK_INPUT_READ); + phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); return; @@ -347,13 +396,13 @@ packet[8] = 0; if (write(source, packet, 9) != 9) { close(source); - phb->func(phb->data, -1, GDK_INPUT_READ); + phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); return; } - phb->inpa = gdk_input_add(source, GDK_INPUT_READ, s4_canread, phb); + phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, s4_canread, phb); } static int proxy_connect_socks4(char *host, unsigned short port, struct PHB *phb) @@ -386,7 +435,7 @@ if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { if ((errno == EINPROGRESS) || (errno == EINTR)) { debug_printf("Connect would have blocked\n"); - phb->inpa = gdk_input_add(fd, GDK_INPUT_WRITE, s4_canwrite, phb); + phb->inpa = gaim_input_add(fd, GAIM_INPUT_WRITE, s4_canwrite, phb); } else { close(fd); g_free(phb->host); @@ -405,24 +454,24 @@ return -1; } fcntl(fd, F_SETFL, 0); - s4_canwrite(phb, fd, GDK_INPUT_WRITE); + s4_canwrite(phb, fd, GAIM_INPUT_WRITE); } return fd; } -static void s5_canread_again(gpointer data, gint source, GdkInputCondition cond) +static void s5_canread_again(gpointer data, gint source, GaimInputCondition cond) { unsigned char buf[512]; struct PHB *phb = data; - gdk_input_remove(phb->inpa); + gaim_input_remove(phb->inpa); debug_printf("able to read again\n"); if (read(source, buf, 10) < 10) { debug_printf("or not...\n"); close(source); - phb->func(phb->data, -1, GDK_INPUT_READ); + phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); return; @@ -430,13 +479,13 @@ if ((buf[0] != 0x05) || (buf[1] != 0x00)) { debug_printf("bad data\n"); close(source); - phb->func(phb->data, -1, GDK_INPUT_READ); + phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); return; } - phb->func(phb->data, source, GDK_INPUT_READ); + phb->func(phb->data, source, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); return; @@ -459,26 +508,26 @@ if (write(source, buf, (5 + strlen(phb->host) + 2)) < (5 + strlen(phb->host) + 2)) { close(source); - phb->func(phb->data, -1, GDK_INPUT_READ); + phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); return; } - phb->inpa = gdk_input_add(source, GDK_INPUT_READ, s5_canread_again, phb); + phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, s5_canread_again, phb); } -static void s5_readauth(gpointer data, gint source, GdkInputCondition cond) +static void s5_readauth(gpointer data, gint source, GaimInputCondition cond) { unsigned char buf[512]; struct PHB *phb = data; - gdk_input_remove(phb->inpa); + gaim_input_remove(phb->inpa); debug_printf("got auth response\n"); if (read(source, buf, 2) < 2) { close(source); - phb->func(phb->data, -1, GDK_INPUT_READ); + phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); return; @@ -486,7 +535,7 @@ if ((buf[0] != 0x01) || (buf[1] == 0x00)) { close(source); - phb->func(phb->data, -1, GDK_INPUT_READ); + phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); return; @@ -495,17 +544,17 @@ s5_sendconnect(phb, source); } -static void s5_canread(gpointer data, gint source, GdkInputCondition cond) +static void s5_canread(gpointer data, gint source, GaimInputCondition cond) { unsigned char buf[512]; struct PHB *phb = data; - gdk_input_remove(phb->inpa); + gaim_input_remove(phb->inpa); debug_printf("able to read\n"); if (read(source, buf, 2) < 2) { close(source); - phb->func(phb->data, -1, GDK_INPUT_READ); + phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); return; @@ -513,7 +562,7 @@ if ((buf[0] != 0x05) || (buf[1] == 0xff)) { close(source); - phb->func(phb->data, -1, GDK_INPUT_READ); + phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); return; @@ -528,19 +577,19 @@ memcpy(buf+2+i+1, proxypass, j); if (write(source, buf, 3+i+j) < 3+i+j) { close(source); - phb->func(phb->data, -1, GDK_INPUT_READ); + phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); return; } - phb->inpa = gdk_input_add(source, GDK_INPUT_READ, s5_readauth, phb); + phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, s5_readauth, phb); } else { s5_sendconnect(phb, source); } } -static void s5_canwrite(gpointer data, gint source, GdkInputCondition cond) +static void s5_canwrite(gpointer data, gint source, GaimInputCondition cond) { unsigned char buf[512]; int i; @@ -549,11 +598,11 @@ int error = ETIMEDOUT; debug_printf("Connected\n"); if (phb->inpa > 0) - gdk_input_remove(phb->inpa); + gaim_input_remove(phb->inpa); len = sizeof(error); if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { close(source); - phb->func(phb->data, -1, GDK_INPUT_READ); + phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); return; @@ -576,13 +625,13 @@ if (write(source, buf, i) < i) { debug_printf("unable to write\n"); close(source); - phb->func(phb->data, -1, GDK_INPUT_READ); + phb->func(phb->data, -1, GAIM_INPUT_READ); g_free(phb->host); g_free(phb); return; } - phb->inpa = gdk_input_add(source, GDK_INPUT_READ, s5_canread, phb); + phb->inpa = gaim_input_add(source, GAIM_INPUT_READ, s5_canread, phb); } static int proxy_connect_socks5(char *host, unsigned short port, struct PHB *phb) @@ -615,7 +664,7 @@ if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { if ((errno == EINPROGRESS) || (errno == EINTR)) { debug_printf("Connect would have blocked\n"); - phb->inpa = gdk_input_add(fd, GDK_INPUT_WRITE, s5_canwrite, phb); + phb->inpa = gaim_input_add(fd, GAIM_INPUT_WRITE, s5_canwrite, phb); } else { close(fd); g_free(phb->host); @@ -634,13 +683,13 @@ return -1; } fcntl(fd, F_SETFL, 0); - s5_canwrite(phb, fd, GDK_INPUT_WRITE); + s5_canwrite(phb, fd, GAIM_INPUT_WRITE); } return fd; } -int proxy_connect(char *host, int port, GdkInputFunction func, gpointer data) +int proxy_connect(char *host, int port, GaimInputFunction func, gpointer data) { struct PHB *phb = g_new0(struct PHB, 1); phb->func = func;
--- a/src/proxy.h Tue Jul 31 18:02:40 2001 +0000 +++ b/src/proxy.h Tue Jul 31 23:23:40 2001 +0000 @@ -30,7 +30,7 @@ #include <sys/socket.h> #include <netdb.h> #include <netinet/in.h> -#include <gtk/gtk.h> +#include <glib.h> #define PROXY_NONE 0 #define PROXY_HTTP 1 @@ -43,6 +43,15 @@ extern char proxyuser[128]; extern char proxypass[128]; -extern int proxy_connect(char *host, int port, GdkInputFunction func, gpointer data); +typedef enum { + GAIM_INPUT_READ = 1 << 0, + GAIM_INPUT_WRITE = 1 << 1 +} GaimInputCondition; +typedef void (*GaimInputFunction)(gpointer, gint, GaimInputCondition); + +extern gint gaim_input_add(int, GaimInputCondition, GaimInputFunction, gpointer); +extern void gaim_input_remove(gint); + +extern int proxy_connect(char *host, int port, GaimInputFunction func, gpointer data); #endif
--- a/src/server.c Tue Jul 31 18:02:40 2001 +0000 +++ b/src/server.c Tue Jul 31 23:23:40 2001 +0000 @@ -20,7 +20,7 @@ */ #ifdef HAVE_CONFIG_H -#include "../config.h" +#include <config.h> #endif #include <time.h> #include <stdio.h>