changeset 2630:5004f7eb3d4d

[gaim-migrate @ 2643] better ignoring committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 27 Oct 2001 21:45:17 +0000
parents b74421e92d55
children a2cf3cac7e66
files src/buddy_chat.c
diffstat 1 files changed, 23 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/buddy_chat.c	Sat Oct 27 08:27:40 2001 +0000
+++ b/src/buddy_chat.c	Sat Oct 27 21:45:17 2001 +0000
@@ -678,8 +678,18 @@
 	}
 
 	while (ignore) {
-		if (!g_strcasecmp(who, ignore->data))
+		char *ign = ignore->data;
+		if (!g_strcasecmp(who, ign))
+			return;
+		if (*ign == '+' && !g_strcasecmp(who, ign + 1))
 			return;
+		if (*ign == '@') {
+			ign++;
+			if (*ign == '+' && !g_strcasecmp(who, ign + 1))
+				return;
+			if (*ign != '+' && !g_strcasecmp(who, ign))
+				return;
+		}
 		ignore = ignore->next;
 	}
 
@@ -888,6 +898,15 @@
 
 	char tmp[BUF_LONG];
 
+	/* we need to check to see if they're ignored before we remove them from the list,
+	 * because otherwise the name is free'd (ignored and in_room point to the same char*'s)
+	 * and we can't search through ignored reliably anymore */
+	while (ignored) {
+		if (!g_strcasecmp(old, ignored->data))
+			break;
+		ignored = ignored->next;
+	}
+
 	while (names) {
 		if (!g_strcasecmp((char *)names->data, old)) {
 			char *tmp2 = names->data;
@@ -906,18 +925,14 @@
 		names = names->next;
 	}
 
-	if (!names)
+	if (!names) {
+		g_free(name);
 		return;
+	}
 
 	b->in_room = g_list_insert_sorted(b->in_room, name, insertname);
 	pos = g_list_index(b->in_room, name);
 
-	while (ignored) {
-		if (!g_strcasecmp(old, ignored->data))
-			break;
-		ignored = ignored->next;
-	}
-
 	if (ignored) {
 		b->ignored = g_list_remove(b->ignored, ignored->data);
 		b->ignored = g_list_append(b->ignored, name);