# HG changeset patch # User Eric Warmenhoven # Date 977196513 0 # Node ID 9c34f99af79ee9fd2dc23f817935eef64814c949 # Parent 4c5c2fcb83cd0cc2bdd9e6a6212a771a016552a7 [gaim-migrate @ 1313] if you ignore someone in chat, and they leave and return, they stay ignored. properly. committer: Tailor Script diff -r 4c5c2fcb83cd -r 9c34f99af79e src/buddy_chat.c --- a/src/buddy_chat.c Tue Dec 19 03:08:06 2000 +0000 +++ b/src/buddy_chat.c Tue Dec 19 03:28:33 2000 +0000 @@ -423,12 +423,25 @@ char tmp[BUF_LONG]; GtkWidget *list_item; int pos; + GList *ignored; plugin_event(event_chat_buddy_join, b->gc, b->name, name, 0); b->in_room = g_list_insert_sorted(b->in_room, name, insertname); pos = g_list_index(b->in_room, name); - list_item = gtk_list_item_new_with_label(name); + ignored = b->ignored; + while (ignored) { + if (!strcasecmp(name, ignored->data)) + break; + ignored = ignored->next; + } + + if (ignored) { + g_snprintf(tmp, sizeof(tmp), "X %s", name); + list_item = gtk_list_item_new_with_label(tmp); + } else + list_item = gtk_list_item_new_with_label(name); + gtk_object_set_user_data(GTK_OBJECT(list_item), name); gtk_list_insert_items(GTK_LIST(b->list), g_list_append(NULL, list_item), pos); gtk_widget_show(list_item); @@ -514,7 +527,7 @@ void ignore_callback(GtkWidget *w, struct conversation *b) { char *name; - GList *i; + GList *i, *ignored; int pos; GtkWidget *list_item; char tmp[80]; @@ -527,12 +540,19 @@ pos = gtk_list_child_position(GTK_LIST(b->list), i->data); - if (g_list_index(b->ignored, (gpointer)name) == -1) { - b->ignored = g_list_append(b->ignored, name); + ignored = b->ignored; + while (ignored) { + if (!strcasecmp(name, ignored->data)) + break; + ignored = ignored->next; + } + + if (ignored) { + b->ignored = g_list_remove(b->ignored, ignored->data); + g_snprintf(tmp, sizeof tmp, "%s", name); + } else { + b->ignored = g_list_append(b->ignored, g_strdup(name)); g_snprintf(tmp, sizeof tmp, "X %s", name); - } else { - b->ignored = g_list_remove(b->ignored, name); - g_snprintf(tmp, sizeof tmp, "%s", name); } list_item = gtk_list_item_new_with_label(tmp); diff -r 4c5c2fcb83cd -r 9c34f99af79e src/server.c --- a/src/server.c Tue Dec 19 03:08:06 2000 +0000 +++ b/src/server.c Tue Dec 19 03:28:33 2000 +0000 @@ -662,6 +662,11 @@ g_free(tmp); } + while (b->ignored) { + g_free(b->ignored->data); + b->ignored = g_list_remove(b->ignored, b->ignored->data); + } + g_free(b); }