pidgin: 0d220fda: Handle multiple 319 (channels joined) me...

elb at pidgin.im elb at pidgin.im
Mon Mar 30 21:10:28 EDT 2009


-----------------------------------------------------------------
Revision: 0d220fdade88a561785e674e66d01a2a34bd4b1c
Ancestor: 0064869870b3507952491598f4d4b8d4a99fbc6b
Author: elb at pidgin.im
Date: 2009-03-31T01:08:29
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/0d220fdade88a561785e674e66d01a2a34bd4b1c

Modified files:
        libpurple/protocols/irc/irc.h libpurple/protocols/irc/msgs.c

ChangeLog: 

Handle multiple 319 (channels joined) messages for IRC WHOIS.
This additionally fixes a leak when multiple 319 messages were received.

Fixes #8827

-------------- next part --------------
============================================================
--- libpurple/protocols/irc/irc.h	a8868ca914d28d8cc42de7f923b89ac05c641554
+++ libpurple/protocols/irc/irc.h	3ec9f203e62e5297a814a6840b6f16379471533c
@@ -72,7 +72,7 @@ struct irc_conn {
 		char *name;
 		char *server;
 		char *serverinfo;
-		char *channels;
+		GString *channels;
 		int ircop;
 		int identified;
 		int idle;
============================================================
--- libpurple/protocols/irc/msgs.c	dbb4ea177269ee632ad39eb70e9e180d35ba9151
+++ libpurple/protocols/irc/msgs.c	02197c6d9614868ec489bd42af5cf22bda507f5f
@@ -336,7 +336,11 @@ void irc_msg_whois(struct irc_conn *irc,
 		if (args[3])
 			irc->whois.signon = (time_t)atoi(args[3]);
 	} else if (!strcmp(name, "319")) {
-		irc->whois.channels = g_strdup(args[2]);
+		if (irc->whois.channels == NULL) {
+			irc->whois.channels = g_string_new(args[2]);
+		} else {
+			irc->whois.channels = g_string_append(irc->whois.channels, args[2]);
+		}
 	} else if (!strcmp(name, "320")) {
 		irc->whois.identified = 1;
 	}
@@ -391,8 +395,8 @@ void irc_msg_endwhois(struct irc_conn *i
 		g_free(irc->whois.serverinfo);
 	}
 	if (irc->whois.channels) {
-		purple_notify_user_info_add_pair(user_info, _("Currently on"), irc->whois.channels);
-		g_free(irc->whois.channels);
+		purple_notify_user_info_add_pair(user_info, _("Currently on"), irc->whois.channels->str);
+		g_string_free(irc->whois.channels, TRUE);
 	}
 	if (irc->whois.idle) {
 		gchar *timex = purple_str_seconds_to_string(irc->whois.idle);


More information about the Commits mailing list