changeset 9440:00242c2419c3

[gaim-migrate @ 10261] This should prevent any loops on connection errors for IRC committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Fri, 02 Jul 2004 03:54:14 +0000
parents 023adfccd524
children eaa9aa1fad61
files src/protocols/irc/cmds.c src/protocols/irc/irc.c src/protocols/irc/irc.h
diffstat 3 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/irc/cmds.c	Thu Jul 01 23:32:47 2004 +0000
+++ b/src/protocols/irc/cmds.c	Fri Jul 02 03:54:14 2004 +0000
@@ -362,9 +362,13 @@
 {
 	char *buf;
 
-	buf = irc_format(irc, "v:", "QUIT", (args && args[0]) ? args[0] : "Download Gaim: " GAIM_WEBSITE);
-	irc_send(irc, buf);
-	g_free(buf);
+	if (!irc->quitting) {
+		buf = irc_format(irc, "v:", "QUIT", (args && args[0]) ? args[0] : "Download Gaim: " GAIM_WEBSITE);
+		irc_send(irc, buf);
+		g_free(buf);
+
+		irc->quitting = TRUE;
+	}
 
 	return 0;
 }
--- a/src/protocols/irc/irc.c	Thu Jul 01 23:32:47 2004 +0000
+++ b/src/protocols/irc/irc.c	Fri Jul 02 03:54:14 2004 +0000
@@ -82,11 +82,17 @@
 
 int irc_send(struct irc_conn *irc, const char *buf)
 {
+	int ret;
+
 	if (irc->fd < 0)
 		return -1;
 
 	/* gaim_debug(GAIM_DEBUG_MISC, "irc", "sent: %s", buf); */
-	return write(irc->fd, buf, strlen(buf));
+	if ((ret = write(irc->fd, buf, strlen(buf))) < 0)
+		gaim_connection_error(gaim_account_get_connection(irc->account),
+				      _("Server has disconnected"));
+
+	return ret;
 }
 
 /* XXX I don't like messing directly with these buddies */
@@ -387,7 +393,7 @@
 		gaim_connection_error(gc, _("Read error"));
 		return;
 	} else if (len == 0) {
-		/* Remote closed the connection, probably */
+		gaim_connection_error(gc, _("Server has disconnected"));
 		return;
 	}
 
--- a/src/protocols/irc/irc.h	Thu Jul 01 23:32:47 2004 +0000
+++ b/src/protocols/irc/irc.h	Fri Jul 02 03:54:14 2004 +0000
@@ -69,6 +69,8 @@
 		time_t signon;
 	} whois;
 	GaimRoomlist *roomlist;
+
+	gboolean quitting;
 };
 
 struct irc_buddy {