Mercurial > pidgin
changeset 516:ee4e18868584
[gaim-migrate @ 526]
Make it obvious that it happens.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Fri, 21 Jul 2000 18:08:00 +0000 |
parents | b33ed0a7f49b |
children | dd4d415dbe52 |
files | src/conversation.c src/gaim.h src/oscar.c src/server.c |
diffstat | 4 files changed, 29 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- 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, _("<HR><B>Direct Connection with %s established.</B><BR><HR>"), + 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, _("<HR><B>Direct Connection with %s closed.</B><BR><HR>"), + c->name); + write_to_conv(c, buf, WFLAG_SYSTEM, NULL); + } +} + /* --------------------------------------------------- * Function to remove a log file entry * ---------------------------------------------------
--- 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 <gtk/gtk.h> #include <time.h> #include <stdio.h> +#include <aim.h> #ifdef USE_APPLET #include <applet-widget.h> #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 *);
--- 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); }
--- 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); } }