changeset 2665:b0478af51be0

[gaim-migrate @ 2678] hi committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 02 Nov 2001 20:55:55 +0000
parents 0b4ef57035af
children 511d2af5bcca
files src/dialogs.c src/protocols/msn/msn.c
diffstat 2 files changed, 44 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/dialogs.c	Fri Nov 02 10:30:39 2001 +0000
+++ b/src/dialogs.c	Fri Nov 02 20:55:55 2001 +0000
@@ -1748,8 +1748,8 @@
 		g_free(n);
 		if (!d) {
 			p->gc->deny = g_slist_append(p->gc->deny, name);
+			serv_add_deny(p->gc, name);
 			build_block_list();
-			serv_add_deny(p->gc, name);
 			do_export(p->gc);
 		} else
 			g_free(name);
@@ -1765,8 +1765,8 @@
 		g_free(n);
 		if (!d) {
 			p->gc->permit = g_slist_append(p->gc->permit, name);
+			serv_add_permit(p->gc, name);
 			build_allow_list();
-			serv_add_permit(p->gc, name);
 			do_export(p->gc);
 		} else
 			g_free(name);
--- a/src/protocols/msn/msn.c	Fri Nov 02 10:30:39 2001 +0000
+++ b/src/protocols/msn/msn.c	Fri Nov 02 20:55:55 2001 +0000
@@ -1579,7 +1579,7 @@
 {
 	struct msn_data *md = gc->proto_data;
 	char buf[MSN_BUF_LEN];
-	GSList *s;
+	GSList *s, *t = NULL;
 
 	if (gc->permdeny == PERMIT_ALL || gc->permdeny == DENY_SOME)
 		g_snprintf(buf, sizeof(buf), "BLP %d AL\r\n", ++md->trId);
@@ -1609,28 +1609,53 @@
 	s = g_slist_nth(gc->permit, g_slist_length(md->permit));
 	while (s) {
 		char *who = s->data;
+		s = s->next;
+		if (!strchr(who, '@')) {
+			t = g_slist_append(t, who);
+			continue;
+		}
 		g_snprintf(buf, sizeof(buf), "ADD %d AL %s %s\r\n", ++md->trId, who, who);
 		if (msn_write(md->fd, buf, strlen(buf)) < 0) {
 			hide_login_progress(gc, "Write error");
 			signoff(gc);
 			return;
 		}
-		s = s->next;
 	}
+	while (t) {
+		char *who = t->data;
+		gc->permit = g_slist_remove(gc->permit, who);
+		g_free(who);
+		t = t->next;
+	}
+	if (t)
+		g_slist_free(t);
+	t = NULL;
 	g_slist_free(md->permit);
 	md->permit = NULL;
 
 	s = g_slist_nth(gc->deny, g_slist_length(md->deny));
 	while (s) {
 		char *who = s->data;
+		s = s->next;
+		if (!strchr(who, '@')) {
+			t = g_slist_append(t, who);
+			continue;
+		}
 		g_snprintf(buf, sizeof(buf), "ADD %d AL %s %s\r\n", ++md->trId, who, who);
 		if (msn_write(md->fd, buf, strlen(buf)) < 0) {
 			hide_login_progress(gc, "Write error");
 			signoff(gc);
 			return;
 		}
-		s = s->next;
 	}
+	while (t) {
+		char *who = t->data;
+		gc->deny = g_slist_remove(gc->deny, who);
+		g_free(who);
+		t = t->next;
+	}
+	if (t)
+		g_slist_free(t);
 	g_slist_free(md->deny);
 	md->deny = NULL;
 }
@@ -1640,6 +1665,13 @@
 	struct msn_data *md = gc->proto_data;
 	char buf[MSN_BUF_LEN];
 
+	if (!strchr(who, '@')) {
+		do_error_dialog(_("Invalid name"), _("MSN Error"));
+		gc->permit = g_slist_remove(gc->permit, who);
+		g_free(who);
+		return;
+	}
+
 	g_snprintf(buf, sizeof(buf), "ADD %d AL %s %s\r\n", ++md->trId, who, who);
 	if (msn_write(md->fd, buf, strlen(buf)) < 0) {
 		hide_login_progress(gc, "Write error");
@@ -1666,6 +1698,13 @@
 	struct msn_data *md = gc->proto_data;
 	char buf[MSN_BUF_LEN];
 
+	if (!strchr(who, '@')) {
+		do_error_dialog(_("Invalid name"), _("MSN Error"));
+		gc->deny = g_slist_remove(gc->deny, who);
+		g_free(who);
+		return;
+	}
+
 	g_snprintf(buf, sizeof(buf), "ADD %d BL %s %s\r\n", ++md->trId, who, who);
 	if (msn_write(md->fd, buf, strlen(buf)) < 0) {
 		hide_login_progress(gc, "Write error");