changeset 1325:08aa745310f6

[gaim-migrate @ 1335] Segfault Fix Notices when people leave a channel Mem leak fix committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Wed, 20 Dec 2000 04:31:05 +0000
parents faee6f18b2a8
children 3d82e8f8b786
files plugins/napster.c
diffstat 1 files changed, 28 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/napster.c	Wed Dec 20 04:06:11 2000 +0000
+++ b/plugins/napster.c	Wed Dec 20 04:31:05 2000 +0000
@@ -105,10 +105,12 @@
 
 	while (channels) {
 		channel = (struct nap_channel *)channels->data;
-		if (!g_strcasecmp(name, channel->name)) {
-			return channel;
+
+		if (channel) {
+			if (!g_strcasecmp(name, channel->name)) {
+				return channel;
+			}
 		}
-
 		channels = g_slist_next(channels);
 	}
 
@@ -242,6 +244,23 @@
 		return;
 	}
 
+	if (command == 0x197) {
+		struct nap_channel *channel;
+		struct conversation *convo;
+		gchar **res;
+
+		res = g_strsplit(buf, " ", 0);
+		
+		channel = find_channel_by_name(gc, res[0]);
+		convo = find_conversation_by_id(gc, channel->id);
+
+		remove_chat_buddy(convo, res[1]);
+		
+		g_strfreev(res);
+		free(buf);
+		return;
+	}
+
 	if (command == 0x193) {
 		gchar **res;
 		struct nap_channel *channel;
@@ -436,7 +455,7 @@
 
 	nap_write_packet(gc, 0x191, channel->name);
 	
-	channels = g_slist_remove(channels, channel);
+	ndata->channels = g_slist_remove(ndata->channels, channel);
 	g_free(channel->name);
 	g_free(channel);
 	
@@ -480,13 +499,14 @@
 	if (gc->inpa)
 		gdk_input_remove(gc->inpa);
 
-	while (channels) {
-		channel = (struct nap_channel *)channels->data;
+	while (ndata->channels) {
+		channel = (struct nap_channel *)ndata->channels->data;
 		g_free(channel->name);
-		channels = g_slist_remove(channels, channel);
+		ndata->channels = g_slist_remove(ndata->channels, channel);
 		g_free(channel);
 	}
-	
+
+	free(gc->proto_data);
 }
 
 static void nap_add_buddies(struct gaim_connection *gc, GList *buddies)