changeset 3294:f50db65fda5f

[gaim-migrate @ 3312] I think this makes MSN privacy perfect committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sat, 01 Jun 2002 03:35:25 +0000
parents 3e37cfdcca73
children 5a56d8874c40
files ChangeLog src/protocols/msn/msn.c
diffstat 2 files changed, 58 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri May 31 07:35:51 2002 +0000
+++ b/ChangeLog	Sat Jun 01 03:35:25 2002 +0000
@@ -25,7 +25,8 @@
 	* Perl scripts can play Gaim sounds (thanks Andrew Rodland)
 	* Internal sounds can be played by commands (thanks Lex Spoon)
 	* Auto-login item in applet menu (thanks Chris Boyle)
-	* Fixed MSN "Unkown Error Code"
+	* Fixed MSN "Unkown Error Code", "Already there", and 
+	  "Already in opposite list" errors
 
 version 0.58 (05/13/2002):
 	* Bulgarian translation added (Thanks, Igel Itzo)
--- a/src/protocols/msn/msn.c	Fri May 31 07:35:51 2002 +0000
+++ b/src/protocols/msn/msn.c	Sat Jun 01 03:35:25 2002 +0000
@@ -1054,6 +1054,11 @@
 			b->friend = g_strdup(friend);
 			md->fl = g_slist_append(md->fl, b);
 		} else if (!g_strcasecmp(which, "AL") && pos) {
+			char *dupl;
+			if ((dupl = g_slist_find_custom(gc->deny, who, strcmp))) {
+				debug_printf("moving from deny to permit: %s", who);
+				gc->deny = g_slist_remove(gc->deny, dupl);
+			}
 			gc->permit = g_slist_append(gc->permit, g_strdup(who));
 		} else if (!g_strcasecmp(which, "BL") && pos) {
 			gc->deny = g_slist_append(gc->deny, g_strdup(who));
@@ -2204,11 +2209,16 @@
 		s = g_slist_nth(gc->permit, g_slist_length(md->permit));
 		while (s) {
 			char *who = s->data;
+			char *dupl;
 			s = s->next;
 			if (!strchr(who, '@')) {
 				t = g_slist_append(t, who);
 				continue;
 			}
+			if ((dupl = g_slist_find(md->deny, 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");
@@ -2233,11 +2243,16 @@
 		s = g_slist_nth(gc->deny, g_slist_length(md->deny));
 		while (s) {
 			char *who = s->data;
+			char *dupl;
 			s = s->next;
 			if (!strchr(who, '@')) {
 				t = g_slist_append(t, who);
 				continue;
 			}
+			if ((dupl = g_slist_find(md->deny, who))) {
+				t = g_slist_append(t, who);
+				continue;
+			}
 			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");
@@ -2262,6 +2277,7 @@
 {
 	struct msn_data *md = gc->proto_data;
 	char buf[MSN_BUF_LEN];
+	char *dupl;
 
 	if (!strchr(who, '@')) {
 		do_error_dialog(_("Invalid name"), _("MSN Error"));
@@ -2270,6 +2286,16 @@
 		return;
 	}
 
+	if ((dupl = g_slist_find(gc->deny, who))) {
+		debug_printf("MSN: Moving %s from BL to AL\n", who);
+		gc->deny = g_slist_remove(gc->deny, dupl);
+		g_snprintf(buf, sizeof(buf), "REM %d BL %s\r\n", ++md->trId, who);
+			if (msn_write(md->fd, buf, strlen(buf)) < 0) {
+				hide_login_progress(gc, "Write error");
+				signoff(gc);
+				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");
@@ -2289,13 +2315,22 @@
 		signoff(gc);
 		return;
 	}
+	
+	g_slist_append(gc->deny, who);
+	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");
+		signoff(gc);
+		return;
+	}
 }
 
 static void msn_add_deny(struct gaim_connection *gc, char *who)
 {
 	struct msn_data *md = gc->proto_data;
 	char buf[MSN_BUF_LEN];
-
+	char *dupl;
+	
 	if (!strchr(who, '@')) {
 		do_error_dialog(_("Invalid name"), _("MSN Error"));
 		gc->deny = g_slist_remove(gc->deny, who);
@@ -2303,6 +2338,18 @@
 		return;
 	}
 
+	if ((dupl = g_slist_find(gc->permit, who))) {
+		debug_printf("MSN: Moving %s from AL to BL\n", who);
+		gc->permit = g_slist_remove(gc->permit, dupl);
+		g_snprintf(buf, sizeof(buf), "REM %d AL %s\r\n", ++md->trId, who);
+		if (msn_write(md->fd, buf, strlen(buf)) < 0) {
+			hide_login_progress(gc, "Write error");
+			signoff(gc);
+			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");
@@ -2322,6 +2369,14 @@
 		signoff(gc);
 		return;
 	}
+	
+	g_slist_append(gc->permit, who);
+	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;
+	}
 }
 
 static void msn_buddy_free(struct buddy *b)