changeset 8984:4623d24347d8

[gaim-migrate @ 9759] Oops, forgot about this. This keeps us from telling the other side to connect to us when we can't connect to them when the reason we were connecting to them in the first place was because they couldn't connect to us. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Thu, 20 May 2004 02:24:17 +0000
parents 460d02fe03df
children 8abc99ed5d93
files src/protocols/oscar/oscar.c
diffstat 1 files changed, 34 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/oscar.c	Thu May 20 02:03:34 2004 +0000
+++ b/src/protocols/oscar/oscar.c	Thu May 20 02:24:17 2004 +0000
@@ -143,6 +143,7 @@
 	gboolean connected;
 	gboolean gpc_pend;
 	gboolean killme;
+	gboolean donttryagain;
 };
 
 struct ask_direct {
@@ -150,6 +151,7 @@
 	char *sn;
 	char ip[64];
 	fu8_t cookie[8];
+	gboolean donttryagain;
 };
 
 /*
@@ -796,16 +798,21 @@
 	}
 
 	if (source < 0) {
-		fu8_t cookie[8];
-		char *who = g_strdup(dim->name);
-		const char *tmp = aim_odc_getcookie(dim->conn);
-
-		memcpy(cookie, tmp, 8);
-		oscar_direct_im_destroy(od, dim);
-		oscar_direct_im_initiate(gc, who, cookie);
-		gaim_debug_info("oscar", "asking direct im initiator to connect to us\n");
-		g_free(who);
-		return;
+		if (dim->donttryagain) {
+			oscar_direct_im_disconnect(od, dim);
+			return;
+		} else {
+			fu8_t cookie[8];
+			char *who = g_strdup(dim->name);
+			const char *tmp = aim_odc_getcookie(dim->conn);
+
+			memcpy(cookie, tmp, 8);
+			oscar_direct_im_destroy(od, dim);
+			oscar_direct_im_initiate(gc, who, cookie);
+			gaim_debug_info("oscar", "asking direct im initiator to connect to us\n");
+			g_free(who);
+			return;
+		}
 	}
 
 	dim->conn->fd = source;
@@ -820,16 +827,21 @@
 		gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL));
 		dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, oscar_callback, dim->conn);
 	} else {
-		fu8_t cookie[8];
-		char *who = g_strdup(dim->name);
-		const char *tmp = aim_odc_getcookie(dim->conn);
-
-		memcpy(cookie, tmp, 8);
-		oscar_direct_im_destroy(od, dim);
-		oscar_direct_im_initiate(gc, who, cookie);
-		gaim_debug_info("oscar", "asking direct im initiator to connect to us\n");
-		g_free(who);
-		return;
+		if (dim->donttryagain) {
+			oscar_direct_im_disconnect(od, dim);
+			return;
+		} else {
+			fu8_t cookie[8];
+			char *who = g_strdup(dim->name);
+			const char *tmp = aim_odc_getcookie(dim->conn);
+
+			memcpy(cookie, tmp, 8);
+			oscar_direct_im_destroy(od, dim);
+			oscar_direct_im_initiate(gc, who, cookie);
+			gaim_debug_info("oscar", "asking direct im initiator to connect to us\n");
+			g_free(who);
+			return;
+		}
 	}
 
 
@@ -860,6 +872,7 @@
 	}
 	dim = g_new0(struct oscar_direct_im, 1);
 	dim->gc = d->gc;
+	dim->donttryagain = d->donttryagain;
 	g_snprintf(dim->name, sizeof dim->name, "%s", d->sn);
 
 	dim->conn = aim_odc_connect(od->sess, d->sn, NULL, d->cookie);
@@ -3237,6 +3250,7 @@
 		memcpy(d->cookie, args->cookie, 8);
 		if (dim && !dim->connected && (!memcmp(aim_odc_getcookie(dim->conn), args->cookie, 8))) {
 			oscar_direct_im_destroy(od, dim);
+			d->donttryagain = TRUE;
 			accept_direct_im_request(d);
 		} else {
 			if (dim && !dim->connected)