# HG changeset patch # User Ethan Blanton # Date 1088740454 0 # Node ID 00242c2419c35bb6dcd7a5f24c9f4e81fef8409d # Parent 023adfccd5249fa83aa7358344b1a487d33222c0 [gaim-migrate @ 10261] This should prevent any loops on connection errors for IRC committer: Tailor Script diff -r 023adfccd524 -r 00242c2419c3 src/protocols/irc/cmds.c --- 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; } diff -r 023adfccd524 -r 00242c2419c3 src/protocols/irc/irc.c --- 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; } diff -r 023adfccd524 -r 00242c2419c3 src/protocols/irc/irc.h --- 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 {