changeset 17205:d04b1617da3d

This should suppress an annoying 477 numeric on channel joins if you aren't identified on freenode. It might cause problems with *real* 477s if you get disconnected, but I'm not sure -- someone scream if it does.
author Ethan Blanton <elb@pidgin.im>
date Wed, 23 May 2007 18:29:23 +0000
parents 51fff4d9869f
children cb5bd3c045a9
files libpurple/protocols/irc/msgs.c
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/irc/msgs.c	Wed May 23 15:28:54 2007 +0000
+++ b/libpurple/protocols/irc/msgs.c	Wed May 23 18:29:23 2007 +0000
@@ -1089,11 +1089,21 @@
 void irc_msg_regonly(struct irc_conn *irc, const char *name, const char *from, char **args)
 {
 	PurpleConnection *gc = purple_account_get_connection(irc->account);
+	PurpleConversation *convo;
 	char *msg;
 
 	if (!args || !args[1] || !args[2] || !gc)
 		return;
 
+	convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[1], irc->account);
+	if (convo) {
+		/* This is a channel we're already in; for some reason,
+		 * freenode feels the need to notify us that in some
+		 * hypothetical other situation this might not have
+		 * succeeded.  Suppress that. */
+		return;
+	}
+
 	msg = g_strdup_printf(_("Cannot join %s: Registration is required."), args[1]);
 	purple_notify_error(gc, _("Cannot join channel"), msg, args[2]);
 	g_free(msg);