changeset 31474:1dcaaa68b245

Process 422 (ERR_NOMOTD) as a valid replacement for an actual MOTD during signin. Thanks to Thijs Alkemade for this patch. Fixes #8649 committer: Ethan Blanton <elb@pidgin.im>
author thijsalkemade@gmail.com
date Wed, 15 Dec 2010 00:35:10 +0000
parents fa1a0dccd4fa
children 9f28bc3ed160 9be4761c87d4
files COPYRIGHT libpurple/protocols/irc/msgs.c libpurple/protocols/irc/parse.c
diffstat 3 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/COPYRIGHT	Tue Dec 14 06:19:13 2010 +0000
+++ b/COPYRIGHT	Wed Dec 15 00:35:10 2010 +0000
@@ -20,6 +20,7 @@
 Saleem Abdulrasool
 Jakub Adam
 Dave Ahlswede
+Thijs Alkemade
 Manuel Amador
 Matt Amato
 Josef Andrysek
--- a/libpurple/protocols/irc/msgs.c	Tue Dec 14 06:19:13 2010 +0000
+++ b/libpurple/protocols/irc/msgs.c	Wed Dec 15 00:35:10 2010 +0000
@@ -597,9 +597,6 @@
 	if (!args || !args[0])
 		return;
 
-	if (!irc->motd)
-		irc->motd = g_string_new("");
-
 	if (!strcmp(name, "375")) {
 		if (irc->motd)
 			g_string_free(irc->motd, TRUE);
@@ -610,6 +607,15 @@
 		 * finalize the connection here if it is not already done. */
 		irc_connected(irc, args[0]);
 		return;
+	} else if (!strcmp(name, "422")) {
+		/* in case there is no 251, and no MOTD set, finalize the connection.
+		 * (and clear the motd for good measure). */
+		
+		if (irc->motd)
+			g_string_free(irc->motd, TRUE);
+		
+		irc_connected(irc, args[0]);
+		return;
 	}
 
 	if (!irc->motd) {
--- a/libpurple/protocols/irc/parse.c	Tue Dec 14 06:19:13 2010 +0000
+++ b/libpurple/protocols/irc/parse.c	Wed Dec 15 00:35:10 2010 +0000
@@ -86,6 +86,7 @@
 	{ "403", "nc:", irc_msg_nochan },	/* No such channel		*/
 	{ "404", "nt:", irc_msg_nosend },	/* Cannot send to chan		*/
 	{ "421", "nv:", irc_msg_unknown },	/* Unknown command		*/
+	{ "422", "n:", irc_msg_motd },		/* MOTD file missing		*/
 	{ "432", "vn:", irc_msg_badnick },	/* Erroneous nickname		*/
 	{ "433", "vn:", irc_msg_nickused },	/* Nickname already in use	*/
 	{ "437", "nc:", irc_msg_unavailable },  /* Nick/channel is unavailable */