# HG changeset patch
# Node ID f0d8eda3812e773ae6ad25fc3b0f94267364a2df
# Parent  a974441beed0fa886e07c5e1af412ef7af259ec7
diff --git a/protocols/ircv3/purpleircv3connection.c b/protocols/ircv3/purpleircv3connection.c
--- a/protocols/ircv3/purpleircv3connection.c
+++ b/protocols/ircv3/purpleircv3connection.c
@@ -139,64 +139,13 @@
 }
 
 /**
- * purple_ircv3_write_status_message: (skip)
- * @connection: The instance.
- * @ibis_message: The message to write.
- * @show_command: Whether or not to display the command.
- *
- * Writes @ibis_message to the status window of @connection.
- */
-static void
-purple_ircv3_write_status_message(PurpleIRCv3Connection *connection,
-                                  IbisMessage *ibis_message,
-                                  gboolean show_command)
-{
-	PurpleContact *contact = NULL;
-	PurpleMessage *purple_message = NULL;
-	GString *str = NULL;
-	GStrv params = NULL;
-	char *body = NULL;
-	char *stripped = NULL;
-
-	str = g_string_new("");
-
-	if(show_command) {
-		const char *command = NULL;
-
-		command = ibis_message_get_command(ibis_message);
-
-		if(!purple_strempty(command)) {
-			g_string_append_printf(str, "%s ", command);
-		}
-	}
-
-	params = ibis_message_get_params(ibis_message);
-	body = g_strjoinv(" ", params);
-	stripped = ibis_formatting_strip(body);
-	g_free(body);
-	g_string_append(str, stripped);
-	g_free(stripped);
-
-	contact = purple_ircv3_connection_find_or_create_contact(connection,
-	                                                         ibis_message);
-
-	purple_message = purple_message_new(PURPLE_CONTACT_INFO(contact),
-	                                    str->str);
-	g_string_free(str, TRUE);
-
-	purple_conversation_write_message(connection->status_conversation,
-	                                  purple_message);
-	g_clear_object(&purple_message);
-}
-
-/**
  * purple_ircv3_write_server_status_message: (skip)
  * @connection: The instance.
  * @message: The message to write to the status window.
  * @show_command: Whether or not to display the command.
  *
- * Like purple_ircv3_write_status_message() but removes the first parameter
- * which is the user's nick for server messages.
+ * Like purple_ircv3_connection_write_status_message() but removes the first
+ * parameter which is the user's nick for server messages.
  */
 static void
 purple_ircv3_write_server_status_message(PurpleIRCv3Connection *connection,
@@ -211,7 +160,8 @@
 	ibis_message_set_paramsv(message, extra_crispy);
 	g_strfreev(extra_crispy);
 
-	purple_ircv3_write_status_message(connection, message, show_command);
+	purple_ircv3_connection_write_status_message(connection, message,
+	                                             show_command);
 }
 
 /******************************************************************************
@@ -298,7 +248,7 @@
                                  IbisMessage *message,
                                  gpointer data)
 {
-	purple_ircv3_write_status_message(data, message, TRUE);
+	purple_ircv3_connection_write_status_message(data, message, TRUE);
 
 	return FALSE;
 }
@@ -316,7 +266,7 @@
 	ibis_message_set_paramsv(message, extra_crispy);
 	g_strfreev(extra_crispy);
 
-	purple_ircv3_write_status_message(data, message, FALSE);
+	purple_ircv3_connection_write_status_message(data, message, FALSE);
 
 	return TRUE;
 }
@@ -448,6 +398,9 @@
 	g_signal_connect_object(client, "message::" IBIS_RPL_UMODEIS,
 	                        G_CALLBACK(purple_ircv3_server_message_handler),
 	                        connection, G_CONNECT_DEFAULT);
+	g_signal_connect_object(client, "message::" IBIS_ERR_YOUREBANNEDCREEP,
+	                        G_CALLBACK(purple_ircv3_server_message_handler),
+	                        connection, G_CONNECT_DEFAULT);
 
 	g_signal_connect_object(client, "message::" IBIS_ERR_NOMOTD,
 	                        G_CALLBACK(purple_ircv3_server_no_motd_handler),
@@ -1034,3 +987,54 @@
 
 	return connection->status_conversation;
 }
+
+/**
+ * purple_ircv3_connection_write_status_message: (skip)
+ * @connection: The instance.
+ * @ibis_message: The message to write.
+ * @show_command: Whether or not to display the command.
+ *
+ * Writes @ibis_message to the status window of @connection.
+ */
+void
+purple_ircv3_connection_write_status_message(PurpleIRCv3Connection *connection,
+                                             IbisMessage *ibis_message,
+                                             gboolean show_command)
+{
+	PurpleContact *contact = NULL;
+	PurpleMessage *purple_message = NULL;
+	GString *str = NULL;
+	GStrv params = NULL;
+	char *body = NULL;
+	char *stripped = NULL;
+
+	str = g_string_new("");
+
+	if(show_command) {
+		const char *command = NULL;
+
+		command = ibis_message_get_command(ibis_message);
+
+		if(!purple_strempty(command)) {
+			g_string_append_printf(str, "%s ", command);
+		}
+	}
+
+	params = ibis_message_get_params(ibis_message);
+	body = g_strjoinv(" ", params);
+	stripped = ibis_formatting_strip(body);
+	g_free(body);
+	g_string_append(str, stripped);
+	g_free(stripped);
+
+	contact = purple_ircv3_connection_find_or_create_contact(connection,
+	                                                         ibis_message);
+
+	purple_message = purple_message_new(PURPLE_CONTACT_INFO(contact),
+	                                    str->str);
+	g_string_free(str, TRUE);
+
+	purple_conversation_write_message(connection->status_conversation,
+	                                  purple_message);
+	g_clear_object(&purple_message);
+}
diff --git a/protocols/ircv3/purpleircv3connection.h b/protocols/ircv3/purpleircv3connection.h
--- a/protocols/ircv3/purpleircv3connection.h
+++ b/protocols/ircv3/purpleircv3connection.h
@@ -164,6 +164,17 @@
 G_GNUC_INTERNAL
 PurpleConversation *purple_ircv3_connection_get_status_conversation(PurpleIRCv3Connection *connection);
 
+/**
+ * purple_ircv3_write_status_message: (skip)
+ * @connection: The instance.
+ * @ibis_message: The message to write.
+ * @show_command: Whether or not to display the command.
+ *
+ * Writes @ibis_message to the status window of @connection.
+ */
+G_GNUC_INTERNAL
+void purple_ircv3_connection_write_status_message(PurpleIRCv3Connection *connection, IbisMessage *ibis_message, gboolean show_command);
+
 G_END_DECLS
 
 #endif /* PURPLE_IRCV3_CONNECTION_H */
diff --git a/protocols/ircv3/purpleircv3messagehandlers.c b/protocols/ircv3/purpleircv3messagehandlers.c
--- a/protocols/ircv3/purpleircv3messagehandlers.c
+++ b/protocols/ircv3/purpleircv3messagehandlers.c
@@ -638,6 +638,7 @@
                                    IbisMessage *ibis_message,
                                    gpointer data)
 {
+	PurpleIRCv3Connection *v3_connection = data;
 	PurpleAccount *account = NULL;
 	PurpleConnection *connection = data;
 	GError *error = NULL;
@@ -656,6 +657,9 @@
 		reason = g_strdup(_("unknown error"));
 	}
 
+	purple_ircv3_connection_write_status_message(v3_connection, ibis_message,
+	                                             TRUE);
+
 	error = g_error_new_literal(PURPLE_IRCV3_DOMAIN, 0, reason);
 	g_clear_pointer(&reason, g_free);
 
