# HG changeset patch # User Eric Warmenhoven # Date 964202880 0 # Node ID ee4e188685846ae527e50eb8646e06bb152dc550 # Parent b33ed0a7f49bc75e20fdbd96a54429e9976f4271 [gaim-migrate @ 526] Make it obvious that it happens. committer: Tailor Script diff -r b33ed0a7f49b -r ee4e18868584 src/conversation.c --- a/src/conversation.c Fri Jul 21 06:01:35 2000 +0000 +++ b/src/conversation.c Fri Jul 21 18:08:00 2000 +0000 @@ -150,7 +150,28 @@ } return t; } - + +void make_direct(struct conversation *c, gboolean direct, struct aim_conn_t *conn, gint watcher) +{ + char buf[BUF_LONG]; + if (c == NULL) return; + c->is_direct = direct; + if (direct) { + c->conn = conn; + c->watcher = watcher; + g_snprintf(buf, sizeof buf, _("
Direct Connection with %s established.

"), + c->name); + write_to_conv(c, buf, WFLAG_SYSTEM, NULL); + } else { + c->conn = NULL; + gdk_input_remove(c->watcher); + c->watcher = -1; + g_snprintf(buf, sizeof buf, _("
Direct Connection with %s closed.

"), + c->name); + write_to_conv(c, buf, WFLAG_SYSTEM, NULL); + } +} + /* --------------------------------------------------- * Function to remove a log file entry * --------------------------------------------------- diff -r b33ed0a7f49b -r ee4e18868584 src/gaim.h --- a/src/gaim.h Fri Jul 21 06:01:35 2000 +0000 +++ b/src/gaim.h Fri Jul 21 18:08:00 2000 +0000 @@ -25,6 +25,7 @@ #include #include #include +#include #ifdef USE_APPLET #include #endif /* USE_APPLET */ @@ -381,7 +382,7 @@ #define TYPE_SIGNOFF 4 #define TYPE_KEEPALIVE 5 -#define REVISION "gaim:$Revision: 525 $" +#define REVISION "gaim:$Revision: 526 $" #define FLAPON "FLAPON\r\n\r\n" #define ROAST "Tic/Toc" @@ -594,6 +595,7 @@ extern void serv_rvous_cancel(char *, char *, char *); /* Functions in conversation.c */ +extern void make_direct(struct conversation *, gboolean, struct aim_conn_t *, gint); extern void write_to_conv(struct conversation *, char *, int, char *); extern void show_conv(struct conversation *); extern struct conversation *new_conversation(char *); diff -r b33ed0a7f49b -r ee4e18868584 src/oscar.c --- a/src/oscar.c Fri Jul 21 06:01:35 2000 +0000 +++ b/src/oscar.c Fri Jul 21 18:08:00 2000 +0000 @@ -122,9 +122,7 @@ struct conversation *cnv = find_conversation(direct); debug_print("connection error for directim\n"); if (cnv) { - cnv->is_direct = 0; - cnv->conn = NULL; - gdk_input_remove(cnv->watcher); + make_direct(cnv, FALSE, NULL, 0); } } aim_conn_kill(gaim_sess, &conn); @@ -968,8 +966,7 @@ void oscar_do_directim(char *name) { struct aim_conn_t *newconn = aim_directim_initiate(gaim_sess, gaim_conn, NULL, name); struct conversation *cnv = find_conversation(name); /* this will never be null because it just got set up */ - cnv->is_direct = TRUE; - cnv->conn = newconn; - cnv->watcher = gdk_input_add(newconn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, oscar_callback, newconn); + int watcher = gdk_input_add(newconn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, oscar_callback, newconn); + make_direct(cnv, TRUE, newconn, watcher); aim_conn_addhandler(gaim_sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINITIATE, gaim_directim_initiate, 0); } diff -r b33ed0a7f49b -r ee4e18868584 src/server.c --- a/src/server.c Fri Jul 21 06:01:35 2000 +0000 +++ b/src/server.c Fri Jul 21 18:08:00 2000 +0000 @@ -1121,8 +1121,6 @@ } else { struct conversation *cnv = find_conversation(name); if (!cnv) cnv = new_conversation(name); - cnv->is_direct = 1; - cnv->conn = conn; - cnv->watcher = watcher; + make_direct(cnv, TRUE, conn, watcher); } }