diff libpurple/protocols/irc/msgs.c @ 15439:8ff4af28c9f9

Recognize non-standard mode characters communicated in an 005 numeric for IRC
author Ethan Blanton <elb@pidgin.im>
date Sun, 28 Jan 2007 06:31:19 +0000
parents 21bc8d84974f
children 8c81db398f56
line wrap: on
line diff
--- a/libpurple/protocols/irc/msgs.c	Sun Jan 28 01:24:15 2007 +0000
+++ b/libpurple/protocols/irc/msgs.c	Sun Jan 28 06:31:19 2007 +0000
@@ -40,6 +40,8 @@
                                    const char *from, const char *to,
                                    const char *rawmsg, gboolean notice);
 
+static char *mode_chars = NULL;
+
 static char *irc_mask_nick(const char *mask)
 {
 	char *end, *buf;
@@ -75,6 +77,24 @@
 	gaim_debug(GAIM_DEBUG_INFO, "irc", "Unrecognized message: %s\n", args[0]);
 }
 
+void irc_msg_features(struct irc_conn *irc, const char *name, const char *from, char **args)
+{
+	gchar **features;
+	int i;
+
+	if (!args || !args[0] || !args[1])
+		return;
+
+	features = g_strsplit(args[1], " ", -1);
+	for (i = 0; features[i]; i++) {
+		char *val;
+		if (!strncmp(features[i], "PREFIX=", 7)) {
+			if ((val = strchr(features[i] + 7, ')')) != NULL)
+				mode_chars = g_strdup(val + 1);
+		}
+	}
+}
+
 void irc_msg_away(struct irc_conn *irc, const char *name, const char *from, char **args)
 {
 	GaimConnection *gc;
@@ -408,6 +428,9 @@
 				} else if(*cur == '+') {
 					f = GAIM_CBFLAGS_VOICE;
 					cur++;
+				} else if(mode_chars
+					  && strchr(mode_chars, *cur)) {
+					cur++;
 				}
 				tmp = g_strndup(cur, end - cur);
 				users = g_list_prepend(users, tmp);