pidgin: c1ba1070: Process 422 (ERR_NOMOTD) as a valid repl...

elb at pidgin.im elb at pidgin.im
Tue Dec 14 19:40:42 EST 2010


----------------------------------------------------------------------
Revision: c1ba1070ea1b0fc82772aacc38d3158e1dcd2f2e
Parent:   fb1c260d832a5cda681f09a6e2ac440cd079a4c2
Author:   thijsalkemade at gmail.com
Date:     12/14/10 19:35:10
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/c1ba1070ea1b0fc82772aacc38d3158e1dcd2f2e

Changelog: 

Process 422 (ERR_NOMOTD) as a valid replacement for an actual MOTD
during signin.

Thanks to Thijs Alkemade for this patch.

Fixes #8649

Changes against parent fb1c260d832a5cda681f09a6e2ac440cd079a4c2

  patched  COPYRIGHT
  patched  libpurple/protocols/irc/msgs.c
  patched  libpurple/protocols/irc/parse.c

-------------- next part --------------
============================================================
--- libpurple/protocols/irc/msgs.c	9c58aa47064d764dfd1522881930892536a88481
+++ libpurple/protocols/irc/msgs.c	711c291ec1444e4cb5402313775691a4792cf15d
@@ -597,9 +597,6 @@ void irc_msg_motd(struct irc_conn *irc, 
 	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 @@ void irc_msg_motd(struct irc_conn *irc, 
 		 * 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) {
============================================================
--- libpurple/protocols/irc/parse.c	9608c9a118abec0867ba6c0a41838e62832d9fde
+++ libpurple/protocols/irc/parse.c	6b8993e4cc2b77b8e65973ac62fff5fcc60c64c5
@@ -86,6 +86,7 @@ static struct _irc_msg {
 	{ "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 */
============================================================
--- COPYRIGHT	073cee86d22553553b3ca60af4a90142835f6e75
+++ COPYRIGHT	f0880703dbbf72e1970f2def099113ad80175fa2
@@ -20,6 +20,7 @@ Dave Ahlswede
 Saleem Abdulrasool
 Jakub Adam
 Dave Ahlswede
+Thijs Alkemade
 Manuel Amador
 Matt Amato
 Josef Andrysek


More information about the Commits mailing list