changeset 23275:d9767a3993af

merge of '0de80ccd44f6ce7fe6942baa1e0dfc95a2878d05' and 'e7fb4056cfb091389c5c657b97f95365799165e6'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Tue, 03 Jun 2008 05:12:51 +0000
parents 242fd82b5fe6 (current diff) e61fd3bf9019 (diff)
children b87ce62751a2
files
diffstat 1 files changed, 17 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/privacy.c	Tue Jun 03 03:53:14 2008 +0000
+++ b/libpurple/privacy.c	Tue Jun 03 05:12:51 2008 +0000
@@ -241,6 +241,7 @@
 						gboolean restore)
 {
 	GSList *list;
+	PurplePrivacyType type = account->perm_deny;
 
 	switch (account->perm_deny) {
 		case PURPLE_PRIVACY_ALLOW_ALL:
@@ -254,10 +255,12 @@
 		case PURPLE_PRIVACY_DENY_ALL:
 			if (!restore) {
 				/* Empty the allow-list. */
+				const char *norm = purple_normalize(account, who);
 				for (list = account->permit; list != NULL;) {
-					char *who = list->data;
+					char *person = list->data;
 					list = list->next;
-					purple_privacy_permit_remove(account, who, local);
+					if (strcmp(norm, person) != 0)
+						purple_privacy_permit_remove(account, person, local);
 				}
 			}
 			purple_privacy_permit_add(account, who, local);
@@ -273,6 +276,10 @@
 		default:
 			g_return_if_reached();
 	}
+
+	/* Notify the server if the privacy setting was changed */
+	if (type != account->perm_deny && purple_account_is_connected(account))
+		serv_set_permit_deny(purple_account_get_connection(account));
 }
 
 /*
@@ -286,15 +293,18 @@
 					gboolean restore)
 {
 	GSList *list;
+	PurplePrivacyType type = account->perm_deny;
 
 	switch (account->perm_deny) {
 		case PURPLE_PRIVACY_ALLOW_ALL:
 			if (!restore) {
 				/* Empty the deny-list. */
+				const char *norm = purple_normalize(account, who);
 				for (list = account->deny; list != NULL; ) {
 					char *person = list->data;
 					list = list->next;
-					purple_privacy_deny_remove(account, person, local);
+					if (strcmp(norm, person) != 0)
+						purple_privacy_deny_remove(account, person, local);
 				}
 			}
 			purple_privacy_deny_add(account, who, local);
@@ -318,6 +328,10 @@
 		default:
 			g_return_if_reached();
 	}
+
+	/* Notify the server if the privacy setting was changed */
+	if (type != account->perm_deny && purple_account_is_connected(account))
+		serv_set_permit_deny(purple_account_get_connection(account));
 }
 
 gboolean