pidgin: e7fb4056: Notify the server when we change the pri...

sadrul at pidgin.im sadrul at pidgin.im
Mon Jun 2 22:45:43 EDT 2008


-----------------------------------------------------------------
Revision: e7fb4056cfb091389c5c657b97f95365799165e6
Ancestor: ffe11b98734ebc297dc36ad3e623bc945fdb5cc4
Author: sadrul at pidgin.im
Date: 2008-06-03T02:31:28
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/e7fb4056cfb091389c5c657b97f95365799165e6

Modified files:
        libpurple/privacy.c

ChangeLog: 

Notify the server when we change the privacy setting for an account.

-------------- next part --------------
============================================================
--- libpurple/privacy.c	a843321bbd13669d76484ed3429f9fe83b7361ae
+++ libpurple/privacy.c	aaccb228db3b3a76dda13d1ac48beed6a3f4ef91
@@ -241,6 +241,7 @@ purple_privacy_allow(PurpleAccount *acco
 						gboolean restore)
 {
 	GSList *list;
+	PurplePrivacyType type = account->perm_deny;
 
 	switch (account->perm_deny) {
 		case PURPLE_PRIVACY_ALLOW_ALL:
@@ -254,10 +255,12 @@ purple_privacy_allow(PurpleAccount *acco
 		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 @@ purple_privacy_allow(PurpleAccount *acco
 		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 @@ purple_privacy_deny(PurpleAccount *accou
 					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 @@ purple_privacy_deny(PurpleAccount *accou
 		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


More information about the Commits mailing list