changeset 1126:c8118e7ec981

[gaim-migrate @ 1136] would help if the name actually got added committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 22 Nov 2000 13:15:40 +0000
parents 1a3dbc0e6529
children ccfa5d52e4df
files src/dialogs.c
diffstat 1 files changed, 32 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/dialogs.c	Wed Nov 22 13:04:26 2000 +0000
+++ b/src/dialogs.c	Wed Nov 22 13:15:40 2000 +0000
@@ -1741,15 +1741,41 @@
         }
 
         if (d) {
-		build_block_list();
-		serv_add_deny(p->gc, name);
+		GSList *d = p->gc->deny;
+		char *n;
+		n = g_strdup(normalize(name));
+		while (d) {
+			if (!strcasecmp(n, normalize(d->data)))
+				break;
+			d = d->next;
+		}
+		g_free(n);
+		if (!d) {
+			p->gc->deny = g_slist_append(p->gc->deny, name);
+			build_block_list();
+			serv_add_deny(p->gc, name);
+			do_export(0, 0);
+		} else
+			g_free(name);
         } else {
-		build_allow_list();
-		serv_add_permit(p->gc, name);
+		GSList *d = p->gc->permit;
+		char *n;
+		n = g_strdup(normalize(name));
+		while (d) {
+			if (!strcasecmp(n, normalize(d->data)))
+				break;
+			d = d->next;
+		}
+		g_free(n);
+		if (!d) {
+			p->gc->permit = g_slist_append(p->gc->permit, name);
+			build_allow_list();
+			serv_add_permit(p->gc, name);
+			do_export(0, 0);
+		} else
+			g_free(name);
         }
 
-	do_export(0, 0);
-
         destroy_dialog(NULL, p->window);
 }