changeset 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 a415922e2882
children 6e2c5584c965
files libpurple/protocols/irc/irc.h libpurple/protocols/irc/msgs.c libpurple/protocols/irc/parse.c
diffstat 3 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/irc/irc.h	Sun Jan 28 01:24:15 2007 +0000
+++ b/libpurple/protocols/irc/irc.h	Sun Jan 28 06:31:19 2007 +0000
@@ -116,6 +116,7 @@
 void irc_msg_chanmode(struct irc_conn *irc, const char *name, const char *from, char **args);
 void irc_msg_endwhois(struct irc_conn *irc, const char *name, const char *from, char **args);
 void irc_msg_endmotd(struct irc_conn *irc, const char *name, const char *from, char **args);
+void irc_msg_features(struct irc_conn *irc, const char *name, const char *from, char **args);
 void irc_msg_invite(struct irc_conn *irc, const char *name, const char *from, char **args);
 void irc_msg_inviteonly(struct irc_conn *irc, const char *name, const char *from, char **args);
 void irc_msg_ison(struct irc_conn *irc, const char *name, const char *from, char **args);
--- 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);
--- a/libpurple/protocols/irc/parse.c	Sun Jan 28 01:24:15 2007 +0000
+++ b/libpurple/protocols/irc/parse.c	Sun Jan 28 06:31:19 2007 +0000
@@ -52,6 +52,7 @@
 	char *format;
 	void (*cb)(struct irc_conn *irc, const char *name, const char *from, char **args);
 } _irc_msgs[] = {
+	{ "005", "n*", irc_msg_features },	/* Feature list			*/
 	{ "301", "nn:", irc_msg_away },		/* User is away			*/
 	{ "303", "n:", irc_msg_ison },		/* ISON reply			*/
 	{ "311", "nnvvv:", irc_msg_whois },	/* Whois user			*/