# HG changeset patch
# Node ID f89c45f62e82abb9eb8ace38bdbe13c9b21bc045
# Parent  581af7cd0603cddb1898aee81665375e9dfd8140
diff --git a/protocols/ircv3/purpleircv3connection.c b/protocols/ircv3/purpleircv3connection.c
--- a/protocols/ircv3/purpleircv3connection.c
+++ b/protocols/ircv3/purpleircv3connection.c
@@ -494,6 +494,9 @@
 	g_signal_connect_object(client, "message::" IBIS_RPL_ENDOFNAMES,
 	                        G_CALLBACK(purple_ircv3_message_handler_ignore),
 	                        connection, G_CONNECT_DEFAULT);
+	g_signal_connect_object(client, "message::" IBIS_MSG_WALLOPS,
+	                        G_CALLBACK(purple_ircv3_message_handler_wallops),
+	                        connection, G_CONNECT_DEFAULT);
 
 
 	g_signal_connect_object(client, "message",
diff --git a/protocols/ircv3/purpleircv3core.h b/protocols/ircv3/purpleircv3core.h
--- a/protocols/ircv3/purpleircv3core.h
+++ b/protocols/ircv3/purpleircv3core.h
@@ -34,6 +34,8 @@
 #define PURPLE_IRCV3_DEFAULT_PLAIN_PORT 6667
 #define PURPLE_IRCV3_DEFAULT_TLS_PORT 6697
 
+#define PURPLE_IRCV3_ICON_NAME "im-ircv3"
+
 #define PURPLE_IRCV3_DOMAIN (g_quark_from_static_string("ircv3-plugin"))
 
 #endif /* PURPLE_IRCV3_CORE_H */
diff --git a/protocols/ircv3/purpleircv3messagehandlers.c b/protocols/ircv3/purpleircv3messagehandlers.c
--- a/protocols/ircv3/purpleircv3messagehandlers.c
+++ b/protocols/ircv3/purpleircv3messagehandlers.c
@@ -665,3 +665,49 @@
 
 	return TRUE;
 }
+
+gboolean
+purple_ircv3_message_handler_wallops(G_GNUC_UNUSED IbisClient *client,
+                                     G_GNUC_UNUSED const char *command,
+                                     IbisMessage *ibis_message,
+                                     gpointer data)
+{
+	PurpleIRCv3Connection *v3_connection = data;
+	PurpleAccount *account = NULL;
+	PurpleConnection *connection = data;
+	PurpleContact *contact = NULL;
+	PurpleContactInfo *info = NULL;
+	PurpleNotification *notification = NULL;
+	PurpleNotificationManager *manager = NULL;
+	GStrv params = NULL;
+	char *wallops_title = NULL;
+	guint n_params = 0;
+
+	params = ibis_message_get_params(ibis_message);
+	n_params = g_strv_length(params);
+
+	if(n_params != 1) {
+		g_message("received WALLOPS with %u params, expected 1", n_params);
+		return FALSE;
+	}
+
+	contact = purple_ircv3_connection_find_or_create_contact(v3_connection,
+	                                                         ibis_message);
+	info = PURPLE_CONTACT_INFO(contact);
+
+	wallops_title = g_strdup_printf(_("WALLOPS from %s"),
+	                                purple_contact_info_get_name_for_display(info));
+	notification = purple_notification_new(NULL, wallops_title);
+	g_free(wallops_title);
+
+	account = purple_connection_get_account(connection);
+	purple_notification_set_account(notification, account);
+	purple_notification_set_subtitle(notification, params[0]);
+	purple_notification_set_icon_name(notification, PURPLE_IRCV3_ICON_NAME);
+
+	manager = purple_notification_manager_get_default();
+	purple_notification_manager_add(manager, notification);
+	g_clear_object(&notification);
+
+	return TRUE;
+}
diff --git a/protocols/ircv3/purpleircv3messagehandlers.h b/protocols/ircv3/purpleircv3messagehandlers.h
--- a/protocols/ircv3/purpleircv3messagehandlers.h
+++ b/protocols/ircv3/purpleircv3messagehandlers.h
@@ -47,6 +47,7 @@
 G_GNUC_INTERNAL gboolean purple_ircv3_message_handler_quit(IbisClient *client, const char *command, IbisMessage *message, gpointer data);
 G_GNUC_INTERNAL gboolean purple_ircv3_message_handler_nick(IbisClient *client, const char *command, IbisMessage *message, gpointer data);
 G_GNUC_INTERNAL gboolean purple_ircv3_message_handler_error(IbisClient *client, const char *command, IbisMessage *message, gpointer data);
+G_GNUC_INTERNAL gboolean purple_ircv3_message_handler_wallops(IbisClient *client, const char *command, IbisMessage *message, gpointer data);
 
 G_END_DECLS
 
diff --git a/protocols/ircv3/purpleircv3protocol.c b/protocols/ircv3/purpleircv3protocol.c
--- a/protocols/ircv3/purpleircv3protocol.c
+++ b/protocols/ircv3/purpleircv3protocol.c
@@ -252,7 +252,7 @@
 		"id", "prpl-ircv3",
 		"name", "IRCv3",
 		"description", _("Version 3 of Internet Relay Chat (IRC)."),
-		"icon-name", "im-ircv3",
+		"icon-name", PURPLE_IRCV3_ICON_NAME,
 		"icon-resource-path", "/im/pidgin/libpurple/ircv3/icons",
 		"options", OPT_PROTO_CHAT_TOPIC | OPT_PROTO_PASSWORD_OPTIONAL |
 		           OPT_PROTO_SLASH_COMMANDS_NATIVE,
