diff src/protocols/msn/msn.c @ 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 d324478ee203
children 37d80035e77f
line wrap: on
line diff
--- 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");