soc.2009.privacy_rewrite: c89478f0: Privacy Rewrite - changes:

sulabh at soc.pidgin.im sulabh at soc.pidgin.im
Mon Jul 6 14:25:26 EDT 2009


-----------------------------------------------------------------
Revision: c89478f0b9cee28b0959b0a9394696244c215c58
Ancestor: 6836b6429243a0b1f36354530521dda81b509fb5
Author: sulabh at soc.pidgin.im
Date: 2009-07-06T18:14:17
Branch: im.pidgin.soc.2009.privacy_rewrite
URL: http://d.pidgin.im/viewmtn/revision/info/c89478f0b9cee28b0959b0a9394696244c215c58

Modified files:
        libpurple/account.h libpurple/blist.c libpurple/blist.h
        libpurple/privacy.c libpurple/privacy.h
        libpurple/protocols/yahoo/libymsg.c
        libpurple/protocols/yahoo/yahoochat.c pidgin/gtkprivacy.c

ChangeLog: 

Privacy Rewrite - changes:

        * Store privacy information as attributes to contacts in the blist
        * Store non-buddy contacts in PURPLE_PRIVACY_GROUP
        * Modify functions for storing and reloading blist accordingly
        * Do away with permit and deny list stored in account
        * Modify a few functions accordingly in blist.c
        * Modify several functions in privacy.c to support new privacy information storing method (incomplete)
        * Add functionality to change privacy settings for a contact, 
                check privacy settings for a contact,
                obtain different privacy lists per account,
                synchronize privacy lists for the account at the time of login
        * Modify Yahoo! prpl to follow the change (incomplete)
        * Modify Pidgin to follow the change (temporarily)


-------------- next part --------------
============================================================
--- libpurple/account.h	ea27697ac2f242986507da6d4844daf5af06dbc2
+++ libpurple/account.h	07f84856640894360f119b08eb20a59165b3bd57
@@ -131,17 +131,6 @@ struct _PurpleAccount
 	PurpleProxyInfo *proxy_info;  /**< Proxy information.  This will be set   */
 								/*   to NULL when the account inherits      */
 								/*   proxy settings from global prefs.      */
-
-	/*
-	 * TODO: Supplementing the next two linked lists with hash tables
-	 * should help performance a lot when these lists are long.  This
-	 * matters quite a bit for protocols like MSN, where all your
-	 * buddies are added to your permit list.  Currently we have to
-	 * iterate through the entire list if we want to check if someone
-	 * is permitted or denied.  We should do this for 3.0.0.
-	 */
-	GSList *permit;             /**< Permit list.                           */
-	GSList *deny;               /**< Deny list.                             */
 	PurplePrivacyType perm_deny;  /**< The permit/deny setting.               */
 
 	GList *status_types;        /**< Status types.                          */
============================================================
--- libpurple/blist.c	a186cba632bf7bbd1688dce209ebb46236eafd36
+++ libpurple/blist.c	ae291ef57ffa73499ec8d6e0766a036ab922d83c
@@ -173,8 +173,9 @@ buddy_to_xmlnode(PurpleBlistNode *bnode)
 static xmlnode *
 buddy_to_xmlnode(PurpleBlistNode *bnode)
 {
-	xmlnode *node, *child;
+	xmlnode *node, *child, *grandchild;
 	PurpleBuddy *buddy;
+	char *buf = NULL;
 
 	buddy = (PurpleBuddy *)bnode;
 
@@ -185,6 +186,20 @@ buddy_to_xmlnode(PurpleBlistNode *bnode)
 	child = xmlnode_new_child(node, "name");
 	xmlnode_insert_data(child, buddy->name, -1);
 
+	child = xmlnode_new_child(node, "privacy");
+	grandchild = xmlnode_new_child(child, "receive_message");
+	xmlnode_set_attrib(grandchild, "type", "bool");
+	buf = g_strdup_printf("%d", buddy->privacy_receive_message);
+	xmlnode_insert_data(grandchild, buf, -1);
+	grandchild = xmlnode_new_child(child, "send_presence");
+	xmlnode_set_attrib(grandchild, "type", "bool");
+	buf = g_strdup_printf("%d", buddy->privacy_send_presence);
+	xmlnode_insert_data(grandchild, buf, -1);
+	grandchild = xmlnode_new_child(child, "local_only");
+	xmlnode_set_attrib(grandchild, "type", "bool");
+	buf = g_strdup_printf("%d", buddy->local_only);
+	xmlnode_insert_data(grandchild, buf, -1);
+
 	if (buddy->alias != NULL)
 	{
 		child = xmlnode_new_child(node, "alias");
@@ -194,6 +209,7 @@ buddy_to_xmlnode(PurpleBlistNode *bnode)
 	/* Write buddy settings */
 	g_hash_table_foreach(buddy->node.settings, value_to_xmlnode, node);
 
+	g_free(buf);
 	return node;
 }
 
@@ -296,8 +312,7 @@ accountprivacy_to_xmlnode(PurpleAccount 
 static xmlnode *
 accountprivacy_to_xmlnode(PurpleAccount *account)
 {
-	xmlnode *node, *child;
-	GSList *cur;
+	xmlnode *node;
 	char buf[10];
 
 	node = xmlnode_new("account");
@@ -306,18 +321,6 @@ accountprivacy_to_xmlnode(PurpleAccount 
 	g_snprintf(buf, sizeof(buf), "%d", account->perm_deny);
 	xmlnode_set_attrib(node, "mode", buf);
 
-	for (cur = account->permit; cur; cur = cur->next)
-	{
-		child = xmlnode_new_child(node, "permit");
-		xmlnode_insert_data(child, cur->data, -1);
-	}
-
-	for (cur = account->deny; cur; cur = cur->next)
-	{
-		child = xmlnode_new_child(node, "block");
-		xmlnode_insert_data(child, cur->data, -1);
-	}
-
 	return node;
 }
 
@@ -420,9 +423,9 @@ parse_buddy(PurpleGroup *group, PurpleCo
 {
 	PurpleAccount *account;
 	PurpleBuddy *buddy;
-	char *name = NULL, *alias = NULL;
+	char *name = NULL, *alias = NULL, *temp = NULL;
 	const char *acct_name, *proto, *protocol;
-	xmlnode *x;
+	xmlnode *x, *y;
 
 	acct_name = xmlnode_get_attrib(bnode, "account");
 	protocol = xmlnode_get_attrib(bnode, "protocol");
@@ -451,6 +454,28 @@ parse_buddy(PurpleGroup *group, PurpleCo
 	purple_blist_add_buddy(buddy, contact, group,
 			purple_blist_get_last_child((PurpleBlistNode*)contact));
 
+	if ((x = xmlnode_get_child(bnode, "privacy")))
+	{
+		if ((y = xmlnode_get_child(x, "receive_message")))
+		{
+			temp = xmlnode_get_data(y);
+			buddy->privacy_receive_message = atoi(temp);
+			g_free(temp);
+		}
+		if ((y = xmlnode_get_child(x, "send_presence")))
+		{
+			temp = xmlnode_get_data(y);
+			buddy->privacy_send_presence = atoi(temp);
+			g_free(temp);
+		}
+		if ((y = xmlnode_get_child(x, "local_only")))
+		{
+			temp = xmlnode_get_data(y);
+			buddy->local_only = atoi(temp);
+			g_free(temp);
+		}
+	}
+
 	for (x = xmlnode_get_child(bnode, "setting"); x; x = xmlnode_get_next_twin(x)) {
 		parse_setting((PurpleBlistNode*)buddy, x);
 	}
@@ -587,7 +612,6 @@ purple_blist_load()
 	if (privacy) {
 		xmlnode *anode;
 		for (anode = privacy->child; anode; anode = anode->next) {
-			xmlnode *x;
 			PurpleAccount *account;
 			int imode;
 			const char *acct_name, *proto, *mode, *protocol;
@@ -607,22 +631,6 @@ purple_blist_load()
 
 			imode = atoi(mode);
 			account->perm_deny = (imode != 0 ? imode : PURPLE_PRIVACY_ALLOW_ALL);
-
-			for (x = anode->child; x; x = x->next) {
-				char *name;
-				if (x->type != XMLNODE_TYPE_TAG)
-					continue;
-
-				if (purple_strequal(x->name, "permit")) {
-					name = xmlnode_get_data(x);
-					purple_privacy_permit_add(account, name, TRUE);
-					g_free(name);
-				} else if (purple_strequal(x->name, "block")) {
-					name = xmlnode_get_data(x);
-					purple_privacy_deny_add(account, name, TRUE);
-					g_free(name);
-				}
-			}
 		}
 	}
 
@@ -1325,6 +1333,12 @@ PurpleBuddy *purple_buddy_new(PurpleAcco
 
 	purple_blist_node_initialize_settings((PurpleBlistNode *)buddy);
 
+	/* set new buddy's privacy settings, later: check if buddy exists in some privacy list, set settings accordingly, also 
+		check what local/server settings needed */
+	buddy->privacy_receive_message = TRUE;
+	buddy->privacy_send_presence = TRUE;
+	buddy->local_only = FALSE;
+
 	if (ops && ops->new_node)
 		ops->new_node((PurpleBlistNode *)buddy);
 
@@ -2351,6 +2365,10 @@ PurpleBuddy *purple_find_buddy(PurpleAcc
 	g_return_val_if_fail(account != NULL, NULL);
 	g_return_val_if_fail((name != NULL) && (*name != '\0'), NULL);
 
+	/* If "name" is in PURPLE_PRIVACY_GROUP, it isn't a buddy */
+	if(purple_find_buddy_in_group(account, name, purple_find_group(PURPLE_PRIVACY_GROUP)))
+		return NULL;
+
 	hb.account = account;
 	hb.name = g_strdup(purple_normalize(account, name));
 
@@ -2386,6 +2404,22 @@ PurpleBuddy *purple_find_buddy_in_group(
 	return ret;
 }
 
+PurpleBuddy *purple_find_privacy_contact(PurpleAccount *account, const char *name)
+{
+	PurpleBuddy *b;
+
+	g_return_val_if_fail(purplebuddylist != NULL, NULL);
+	g_return_val_if_fail(account != NULL, NULL);
+	g_return_val_if_fail((name != NULL) && (*name != '\0'), NULL);
+
+	if((b = purple_find_buddy(account, name)))
+		return b;
+	if((b = purple_find_buddy_in_group(account, name, purple_find_group(PURPLE_PRIVACY_GROUP))))
+		return b;
+
+	return NULL;
+}
+
 static void find_acct_buddies(gpointer key, gpointer value, gpointer data)
 {
 	PurpleBuddy *buddy = value;
@@ -2394,7 +2428,7 @@ static void find_acct_buddies(gpointer k
 	*list = g_slist_prepend(*list, buddy);
 }
 
-GSList *purple_find_buddies(PurpleAccount *account, const char *name)
+GSList *purple_find_privacy_contacts(PurpleAccount *account, const char *name)
 {
 	PurpleBuddy *buddy;
 	PurpleBlistNode *node;
@@ -2425,6 +2459,30 @@ GSList *purple_find_buddies(PurpleAccoun
 	return ret;
 }
 
+GSList *purple_find_buddies(PurpleAccount *account, const char *name)
+{
+	GSList *l_tmp = NULL, *lp = NULL;
+	PurpleBuddy *b = NULL;
+	const char *tmp = NULL;
+
+	g_return_val_if_fail(purplebuddylist != NULL, NULL);
+	g_return_val_if_fail(account != NULL, NULL);
+	g_return_val_if_fail((name != NULL) && (*name != '\0'), NULL);
+ 
+	if (!(lp = purple_find_privacy_contacts(account, name)))
+		return NULL;
+
+	for(l_tmp = lp; l_tmp; l_tmp = l_tmp->next)
+	{
+		b = l_tmp->data;
+		tmp = purple_group_get_name( purple_buddy_get_group(b) );
+		if( strcmp(tmp, PURPLE_PRIVACY_GROUP) == 0 )
+			lp = g_slist_remove(lp, l_tmp);
+	}
+
+	return lp;
+}
+
 PurpleGroup *purple_find_group(const char *name)
 {
 	PurpleBlistNode *node;
============================================================
--- libpurple/blist.h	9580da3d4ae9096b2e4b8cbb88ca57a84f03f901
+++ libpurple/blist.h	ed04ba00b79a0f21b90b4c74a94112bf823644b8
@@ -108,6 +108,7 @@ typedef enum
 
 #include "account.h"
 #include "buddyicon.h"
+#include "privacy.h"
 #include "status.h"
 
 /**************************************************************************/
@@ -143,6 +144,9 @@ struct _PurpleBuddy {
 	PurpleBuddyIcon *icon;                    /**< The buddy icon. */
 	PurpleAccount *account;					/**< the account this buddy belongs to */
 	PurplePresence *presence;
+	gboolean privacy_receive_message;		/**< Are messages from this contact allowed >**/
+	gboolean privacy_send_presence;		/**< Do we send presence to this contact >**/
+	gboolean local_only;			/**< Specifies if this contact is on any of server's lists >**/
 };
 
 /**
@@ -872,7 +876,6 @@ GSList *purple_find_buddies(PurpleAccoun
  */
 GSList *purple_find_buddies(PurpleAccount *account, const char *name);
 
-
 /**
  * Finds a group by name
  *
@@ -1196,6 +1199,20 @@ void purple_blist_uninit(void);
 
 /*@}*/
 
+/**************************************************************************/
+/** @name Privacy Related Functions					  */
+/**************************************************************************/
+/*@{*/
+
+/* Return privacy contact, given name and account */
+PurpleBuddy *purple_find_privacy_contact(PurpleAccount *account, const char *name);
+
+/* Return list of privacy contacts for a given account */
+/* privacy laters: change name to be not so similar to purple_find_privacy_contact */
+GSList *purple_find_privacy_contacts(PurpleAccount *account, const char *name);
+
+/*@{*/
+
 #ifdef __cplusplus
 }
 #endif
============================================================
--- libpurple/privacy.c	5e9715a02d5433f53c7de47f703619bc84be82f5
+++ libpurple/privacy.c	010644353dcf253a37505073057336d861aae143
@@ -22,54 +22,42 @@
 #include "internal.h"
 
 #include "account.h"
+#include "debug.h"
 #include "privacy.h"
 #include "server.h"
 #include "util.h"
 
 static PurplePrivacyUiOps *privacy_ops = NULL;
+GSList *get_account_members(PurpleAccount *account, PurplePrivacyListType type);
 
 gboolean
 purple_privacy_permit_add(PurpleAccount *account, const char *who,
 						gboolean local_only)
 {
-	GSList *l;
-	char *name;
-	PurpleBuddy *buddy;
+	PurpleBuddy *buddy = NULL;
+	char *name = NULL;
 
 	g_return_val_if_fail(account != NULL, FALSE);
 	g_return_val_if_fail(who     != NULL, FALSE);
 
 	name = g_strdup(purple_normalize(account, who));
 
-	for (l = account->permit; l != NULL; l = l->next) {
-		if (g_str_equal(name, l->data))
-			/* This buddy already exists */
-			break;
-	}
+	purple_privacy_update_contact(account, name, local_only, TRUE, TRUE);
 
-	if (l != NULL)
-	{
-		/* This buddy already exists, so bail out */
-		g_free(name);
-		return FALSE;
-	}
-
-	account->permit = g_slist_append(account->permit, name);
-
 	if (!local_only && purple_account_is_connected(account))
-		serv_add_permit(purple_account_get_connection(account), who);
+		serv_add_permit(purple_account_get_connection(account), name);
 
 	if (privacy_ops != NULL && privacy_ops->permit_added != NULL)
-		privacy_ops->permit_added(account, who);
+		privacy_ops->permit_added(account, name);
 
-	purple_blist_schedule_save();
-
+	/* privacy laters: Change signals later */
 	/* This lets the UI know a buddy has had its privacy setting changed */
 	buddy = purple_find_buddy(account, name);
 	if (buddy != NULL) {
 		purple_signal_emit(purple_blist_get_handle(),
                 "buddy-privacy-changed", buddy);
 	}
+	g_free(name);
 	return TRUE;
 }
 
@@ -77,46 +65,48 @@ purple_privacy_permit_remove(PurpleAccou
 purple_privacy_permit_remove(PurpleAccount *account, const char *who,
 						   gboolean local_only)
 {
-	GSList *l;
-	const char *name;
-	PurpleBuddy *buddy;
-	char *del;
+	/* privacy laters: privacy settings after removing from the allow list would depend upon the account type and its privacy state.
+	For now, lets assume that if you are not in buddy list and have been removed from the allow list, you are "everyone else".
+	so there needs to be no information stored about you. If you are in buddy list then it depends on account type and state */
 
+	PurpleBuddy *b = NULL;
+	char *name = NULL;
+ 
 	g_return_val_if_fail(account != NULL, FALSE);
 	g_return_val_if_fail(who     != NULL, FALSE);
 
-	name = purple_normalize(account, who);
+	name = g_strdup(purple_normalize(account, who));
 
-	for (l = account->permit; l != NULL; l = l->next) {
-		if (g_str_equal(name, l->data))
-			/* We found the buddy we were looking for */
-			break;
+	if(!(b = purple_find_buddy(account, name)))
+	{
+		if(!(b = purple_find_privacy_contact(account, name)))
+		{
+			g_free(name);
+			return FALSE;
+		}
+		else
+			purple_blist_remove_buddy(b);	/* when in allow list,  you are in no other privacy list */
 	}
+	else
+	{
+		/* privacy laters: This now depends upon the account type and state, for now set TRUE, TRUE */
+		purple_privacy_update_contact(account, name, local_only, TRUE, TRUE);
+	}
 
-	if (l == NULL)
-		/* We didn't find the buddy we were looking for, so bail out */
-		return FALSE;
+	/* privacy laters: we have freed the buddy, check if some function in following statements don't require any data that we freed */
 
-	/* We should not free l->data just yet. There can be occasions where
-	 * l->data == who. In such cases, freeing l->data here can cause crashes
-	 * later when who is used. */
-	del = l->data;
-	account->permit = g_slist_delete_link(account->permit, l);
-
 	if (!local_only && purple_account_is_connected(account))
-		serv_rem_permit(purple_account_get_connection(account), who);
+		serv_rem_permit(purple_account_get_connection(account), name);
 
 	if (privacy_ops != NULL && privacy_ops->permit_removed != NULL)
-		privacy_ops->permit_removed(account, who);
+		privacy_ops->permit_removed(account, name);
 
-	purple_blist_schedule_save();
-
-	buddy = purple_find_buddy(account, name);
-	if (buddy != NULL) {
+	b = purple_find_buddy(account, name);
+	if (b != NULL) {
 		purple_signal_emit(purple_blist_get_handle(),
-                "buddy-privacy-changed", buddy);
+                "buddy-privacy-changed", b);
 	}
-	g_free(del);
+	g_free(name);
 	return TRUE;
 }
 
@@ -124,43 +114,29 @@ purple_privacy_deny_add(PurpleAccount *a
 purple_privacy_deny_add(PurpleAccount *account, const char *who,
 					  gboolean local_only)
 {
-	GSList *l;
-	char *name;
-	PurpleBuddy *buddy;
+	PurpleBuddy *buddy = NULL;
+	char *name = NULL;
 
 	g_return_val_if_fail(account != NULL, FALSE);
 	g_return_val_if_fail(who     != NULL, FALSE);
 
 	name = g_strdup(purple_normalize(account, who));
+	purple_privacy_update_contact(account, name, local_only, TRUE, TRUE);
 
-	for (l = account->deny; l != NULL; l = l->next) {
-		if (g_str_equal(name, l->data))
-			/* This buddy already exists */
-			break;
-	}
-
-	if (l != NULL)
-	{
-		/* This buddy already exists, so bail out */
-		g_free(name);
-		return FALSE;
-	}
-
-	account->deny = g_slist_append(account->deny, name);
-
 	if (!local_only && purple_account_is_connected(account))
-		serv_add_deny(purple_account_get_connection(account), who);
+		serv_add_deny(purple_account_get_connection(account), name);
 
 	if (privacy_ops != NULL && privacy_ops->deny_added != NULL)
-		privacy_ops->deny_added(account, who);
+		privacy_ops->deny_added(account, name);
 
-	purple_blist_schedule_save();
-
+	/* privacy laters: Change signals later */
+	/* This lets the UI know a buddy has had its privacy setting changed */
 	buddy = purple_find_buddy(account, name);
 	if (buddy != NULL) {
 		purple_signal_emit(purple_blist_get_handle(),
                 "buddy-privacy-changed", buddy);
 	}
+	g_free(name);
 	return TRUE;
 }
 
@@ -168,45 +144,49 @@ purple_privacy_deny_remove(PurpleAccount
 purple_privacy_deny_remove(PurpleAccount *account, const char *who,
 						 gboolean local_only)
 {
-	GSList *l;
-	const char *normalized;
-	char *name;
-	PurpleBuddy *buddy;
+	/* privacy laters: privacy settings according to account type and state */
+	PurpleBuddy *b = NULL;
+	char *name = NULL;
 
 	g_return_val_if_fail(account != NULL, FALSE);
 	g_return_val_if_fail(who     != NULL, FALSE);
 
-	normalized = purple_normalize(account, who);
+	name = g_strdup(purple_normalize(account, who));
 
-	for (l = account->deny; l != NULL; l = l->next) {
-		if (g_str_equal(normalized, l->data))
-			/* We found the buddy we were looking for */
-			break;
+	if(!(b = purple_find_buddy(account, name)))
+	{
+		if(!(b = purple_find_privacy_contact(account, name)))
+		{
+			g_free(name);
+			return FALSE;
+		}
+		else
+		{
+			/* privacy laters: you can be (in)visible list along with block list, will figure out how laters, for now remove 
+			this contact from list */
+			purple_blist_remove_buddy(b);
+		}
 	}
+	else
+	{
+		/* privacy laters: This now depends upon the account type and state, for now set TRUE, TRUE */
+		purple_privacy_update_contact(account, name, local_only, TRUE, TRUE);
+	}
 
-	if (l == NULL)
-		/* We didn't find the buddy we were looking for, so bail out */
-		return FALSE;
+	/* privacy laters: we have freed the buddy, check if some function in following statements don't require any data that we freed */
 
-	buddy = purple_find_buddy(account, normalized);
-
-	name = l->data;
-	account->deny = g_slist_delete_link(account->deny, l);
-
 	if (!local_only && purple_account_is_connected(account))
 		serv_rem_deny(purple_account_get_connection(account), name);
 
 	if (privacy_ops != NULL && privacy_ops->deny_removed != NULL)
-		privacy_ops->deny_removed(account, who);
+		privacy_ops->deny_removed(account, name);
 
-	if (buddy != NULL) {
+	b = purple_find_buddy(account, name);
+	if (b != NULL) {
 		purple_signal_emit(purple_blist_get_handle(),
-                "buddy-privacy-changed", buddy);
+                "buddy-privacy-changed", b);
 	}
-
 	g_free(name);
-	purple_blist_schedule_save();
-
 	return TRUE;
 }
 
@@ -214,30 +194,26 @@ purple_privacy_deny_remove(PurpleAccount
  * This makes sure your permit list contains all buddies from your
  * buddy list and ONLY buddies from your buddy list.
  */
-static void
+static gboolean 
 add_all_buddies_to_permit_list(PurpleAccount *account, gboolean local)
 {
-	GSList *list;
+	GSList *p_list = NULL, *l_tmp = NULL;
+	PurpleBuddy *b = NULL;
 
-	/* Remove anyone in the permit list who is not in the buddylist */
-	for (list = account->permit; list != NULL; ) {
-		char *person = list->data;
-		list = list->next;
-		if (!purple_find_buddy(account, person))
-			purple_privacy_permit_remove(account, person, local);
-	}
+	g_return_val_if_fail(account != NULL, FALSE);
 
-	/* Now make sure everyone in the buddylist is in the permit list */
-	list = purple_find_buddies(account, NULL);
-	while (list != NULL)
+	p_list = purple_find_privacy_contacts(account, NULL);
+	for(l_tmp = p_list; l_tmp; l_tmp = l_tmp->next)
 	{
-		PurpleBuddy *buddy = list->data;
-		const gchar *name = purple_buddy_get_name(buddy);
+		b = l_tmp->data;
+		if(purple_find_buddy(account, b->name))
+			purple_privacy_permit_add(account, b->name, local);
+		else
+			purple_privacy_permit_remove(account, b->name, local);
+	}
 
-		if (!g_slist_find_custom(account->permit, name, (GCompareFunc)g_utf8_collate))
-			purple_privacy_permit_add(account, name, local);
-		list = g_slist_delete_link(list, list);
-	}
+	g_slist_free(p_list);
+	return TRUE; 
 }
 
 /*
@@ -250,8 +226,9 @@ purple_privacy_allow(PurpleAccount *acco
 purple_privacy_allow(PurpleAccount *account, const char *who, gboolean local,
 						gboolean restore)
 {
-	GSList *list;
+	GSList *list = NULL, *l_tmp = NULL;
 	PurplePrivacyType type = account->perm_deny;
+	PurpleBuddy *b = NULL;
 
 	switch (account->perm_deny) {
 		case PURPLE_PRIVACY_ALLOW_ALL:
@@ -265,12 +242,11 @@ 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 *person = list->data;
-					list = list->next;
-					if (!purple_strequal(norm, person))
-						purple_privacy_permit_remove(account, person, local);
+				list = purple_find_privacy_contacts(account, NULL);
+				for(l_tmp = list; l_tmp; l_tmp=l_tmp->next)
+				{
+					b = l_tmp->data;
+					purple_privacy_permit_remove(account, b->name, local);
 				}
 			}
 			purple_privacy_permit_add(account, who, local);
@@ -287,6 +263,7 @@ purple_privacy_allow(PurpleAccount *acco
 			g_return_if_reached();
 	}
 
+	g_slist_free(list);
 	/* 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));
@@ -302,19 +279,19 @@ purple_privacy_deny(PurpleAccount *accou
 purple_privacy_deny(PurpleAccount *account, const char *who, gboolean local,
 					gboolean restore)
 {
-	GSList *list;
+	GSList *list = NULL, *l_tmp = NULL;
+	PurpleBuddy *b = NULL;
 	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;
-					if (!purple_strequal(norm, person))
-						purple_privacy_deny_remove(account, person, local);
+				list = purple_find_privacy_contacts(account, NULL);
+				for(l_tmp = list; l_tmp; l_tmp=l_tmp->next)
+				{
+					b = l_tmp->data;
+					purple_privacy_deny_remove(account, b->name, local);
 				}
 			}
 			purple_privacy_deny_add(account, who, local);
@@ -339,47 +316,63 @@ purple_privacy_deny(PurpleAccount *accou
 			g_return_if_reached();
 	}
 
+	g_slist_free(list);
 	/* 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
-purple_privacy_check(PurpleAccount *account, const char *who)
+purple_privacy_check_message(PurpleAccount *account, const char *who)
 {
-	GSList *list;
+	/* Privacy later: When functions that set privacy will work based on account types/states, then this function will work perfectly */
+	PurpleBuddy *b = NULL;
+	char *name = NULL;
+	gboolean receive_message;
 
-	switch (account->perm_deny) {
-		case PURPLE_PRIVACY_ALLOW_ALL:
-			return TRUE;
+	b = purple_find_privacy_contact(account, who);
+	name = 	g_strdup(purple_normalize(account, who));
 
-		case PURPLE_PRIVACY_DENY_ALL:
-			return FALSE;
+	if(b)
+		receive_message = b->privacy_receive_message;
+	else
+	{
+		/* privacy later: depends upon account type/state, for now return false */
+		receive_message = FALSE;
+	}
+	g_free(name);
+	return receive_message;
+}
 
-		case PURPLE_PRIVACY_ALLOW_USERS:
-			who = purple_normalize(account, who);
-			for (list=account->permit; list!=NULL; list=list->next) {
-				if (g_str_equal(who, list->data))
-					return TRUE;
-			}
-			return FALSE;
+gboolean
+purple_privacy_check_presence(PurpleAccount *account, const char *who)
+{
+	/* Privacy later: When functions that set privacy will work based on account types/states, then this function will work perfectly */
+	PurpleBuddy *b = NULL;
+	char *name = NULL;
+	gboolean send_presence;
 
-		case PURPLE_PRIVACY_DENY_USERS:
-			who = purple_normalize(account, who);
-			for (list=account->deny; list!=NULL; list=list->next) {
-				if (g_str_equal(who, list->data))
-					return FALSE;
-			}
-			return TRUE;
+	b = purple_find_privacy_contact(account, who);
+	name = 	g_strdup(purple_normalize(account, who));
 
-		case PURPLE_PRIVACY_ALLOW_BUDDYLIST:
-			return (purple_find_buddy(account, who) != NULL);
+	if(b)
+		send_presence = b->privacy_send_presence;
+	else
+	{
+		/* privacy later: depends upon account type/state, for now return false */
+		send_presence = FALSE;
+	}
+	g_free(name);
+	return send_presence;
+}
 
-		default:
-			g_return_val_if_reached(TRUE);
-	}
+gboolean
+purple_privacy_check(PurpleAccount *account, const char *who)
+{
+	return purple_privacy_check_message(account,who);
 }
 
+
 void
 purple_privacy_set_ui_ops(PurplePrivacyUiOps *ops)
 {
@@ -396,3 +389,250 @@ purple_privacy_init(void)
 purple_privacy_init(void)
 {
 }
+
+gboolean purple_privacy_update_contact(PurpleAccount *account, const char *who, gboolean local_only, gboolean receive_message, gboolean send_presence)
+{
+	PurpleBuddy *b;
+	PurpleGroup *g;
+	char *name = NULL;
+
+	g_return_val_if_fail(account != NULL, FALSE);
+	g_return_val_if_fail(who     != NULL, FALSE);
+
+	name = g_strdup(purple_normalize(account, who));
+
+	if((b = purple_find_privacy_contact(account, name)))
+	{
+		b->privacy_receive_message = receive_message;
+		b->privacy_send_presence = send_presence;
+		b->local_only = local_only;
+	}
+	else
+	{
+		if(!(g = purple_find_group(PURPLE_PRIVACY_GROUP)))
+		{
+			g = purple_group_new(PURPLE_PRIVACY_GROUP);
+			purple_blist_add_group(g, NULL);
+		}
+
+		b = purple_buddy_new(account, name, NULL);
+		b->privacy_receive_message = receive_message;
+		b->privacy_send_presence = send_presence;
+		b->local_only = local_only;
+		purple_blist_add_buddy(b, NULL, g, NULL);
+	}
+
+	g_free(name);
+	return TRUE;
+
+	/* put the name in list on the server 
+	if (!local_only && purple_account_is_connected(account))
+		serv_add_deny(purple_account_get_connection(account), name); */
+
+	/* notify UI that a user was denied
+	if (privacy_ops != NULL && privacy_ops->deny_added != NULL)
+		privacy_ops->deny_added(account, name); */
+
+	/* emit signal
+	buddy = purple_find_buddy(account, name);
+	if (buddy != NULL) {
+		purple_signal_emit(purple_blist_get_handle(),
+                "buddy-privacy-changed", buddy);
+	}
+	return TRUE; */
+}
+
+gboolean purple_privacy_update_presence_setting(PurpleAccount *account, const char *who, gboolean send_presence)
+{
+	PurpleBuddy *b = NULL;
+	char *name = NULL;
+
+	g_return_val_if_fail(account != NULL, FALSE);
+	g_return_val_if_fail(who     != NULL, FALSE);
+
+	name = g_strdup(purple_normalize(account, who));
+
+	if((b = purple_find_privacy_contact(account, name)))
+	{
+		b->privacy_send_presence = send_presence;
+		g_free(name);
+		return TRUE;
+	}
+	else
+	{
+		g_free(name);
+		return FALSE;
+	}
+
+	/* notify UI that a user was denied
+	if (privacy_ops != NULL && privacy_ops->deny_added != NULL)
+		privacy_ops->deny_added(account, name); */
+
+	/* emit signal
+	buddy = purple_find_buddy(account, name);
+	if (buddy != NULL) {
+		purple_signal_emit(purple_blist_get_handle(),
+                "buddy-privacy-changed", buddy);
+	}*/
+
+}
+
+gboolean purple_privacy_update_message_setting(PurpleAccount *account, const char *who, gboolean receive_message)
+{
+	PurpleBuddy *b = NULL;
+	char *name = NULL;
+
+	g_return_val_if_fail(account != NULL, FALSE);
+	g_return_val_if_fail(who     != NULL, FALSE);
+
+	name = g_strdup(purple_normalize(account, who));
+
+	if((b = purple_find_privacy_contact(account, name)))
+	{
+		b->privacy_receive_message = receive_message;
+		g_free(name);
+		return TRUE;
+	}
+	else
+	{
+		g_free(name);
+		return FALSE;
+	}
+
+	/* notify UI that a user was denied
+	if (privacy_ops != NULL && privacy_ops->deny_added != NULL)
+		privacy_ops->deny_added(account, name); */
+
+	/* emit signal
+	buddy = purple_find_buddy(account, name);
+	if (buddy != NULL) {
+		purple_signal_emit(purple_blist_get_handle(),
+                "buddy-privacy-changed", buddy);
+	}*/
+
+}
+		
+GSList *get_account_members(PurpleAccount *account, PurplePrivacyListType type)
+{
+	GSList *account_buddies = NULL, *list = NULL, *l_tmp = NULL;
+	PurpleBuddy *b = NULL;
+	gboolean receive_message = FALSE, send_presence = FALSE;
+
+	switch(type)
+	{
+		case PURPLE_PRIVACY_ALLOW_LIST:
+			receive_message = TRUE;
+			send_presence = TRUE;
+			break;
+		case PURPLE_PRIVACY_BLOCK_MESSAGE_LIST:
+			receive_message = FALSE;
+			send_presence = TRUE;
+			break;
+		case PURPLE_PRIVACY_BLOCK_BOTH_LIST:
+			receive_message = FALSE;
+			send_presence = FALSE;
+			break;
+		case PURPLE_PRIVACY_INVISIBLE_LIST:
+			receive_message = TRUE;
+			send_presence = FALSE;
+			break;
+		case PURPLE_PRIVACY_BUDDY_LIST:
+		case PURPLE_PRIVACY_VISIBLE_LIST:
+			/* do nothing, we won't reach here anyways */
+			break;
+	}
+
+	account_buddies = purple_find_privacy_contacts(account, NULL);
+	for(l_tmp = account_buddies; l_tmp ; l_tmp=l_tmp->next)
+	{
+		b = l_tmp->data;
+		if((b->privacy_receive_message == receive_message) && (b->privacy_send_presence == send_presence))
+			list = g_slist_prepend(list, b->name);
+	}
+
+	g_slist_free(account_buddies);
+	return list;
+}
+
+/* Privacy laters: GSList *purple_privacy_list_get_members(PurplePrivacyListType type) */
+
+GSList *purple_privacy_list_get_members_by_account(PurpleAccount *account, PurplePrivacyListType type)
+{
+	g_return_val_if_fail(account != NULL, FALSE);
+
+	if(type == PURPLE_PRIVACY_BUDDY_LIST)
+		return purple_find_buddies(account, NULL);
+
+	if(type != PURPLE_PRIVACY_VISIBLE_LIST)
+		return get_account_members(account, type);
+	else
+	{
+		GSList *l_allow = NULL, *l_block_msg = NULL;
+		l_allow = get_account_members(account, PURPLE_PRIVACY_ALLOW_LIST);
+		l_block_msg = get_account_members(account, PURPLE_PRIVACY_BLOCK_MESSAGE_LIST);
+		return g_slist_concat(l_allow, l_block_msg);
+	}
+}
+
+gboolean purple_privacy_sync_lists(PurpleAccount *account, GSList *buddy_l, GSList *allow_l, GSList *block_msg_l, GSList *block_both_l, GSList *visible_l, GSList *invisible_l)
+{
+	GSList *p_contacts = NULL, *l_tmp = NULL;
+	PurpleBuddy *b = NULL;
+	
+	g_return_val_if_fail(account != NULL, FALSE);
+	
+	p_contacts = purple_find_privacy_contacts(account, NULL);
+
+	/* Remove any contact not local, and not in any of the lists */
+	for(l_tmp = p_contacts; l_tmp != NULL; l_tmp = l_tmp->next)
+	{
+		b = l_tmp->data;
+		if(b->local_only == FALSE)
+			if(	(g_slist_find_custom(buddy_l, b->name,(GCompareFunc)strcmp) == NULL) &&
+				(g_slist_find_custom(allow_l, b->name,(GCompareFunc)strcmp) == NULL) &&
+				(g_slist_find_custom(block_msg_l, b->name,(GCompareFunc)strcmp) == NULL) &&
+				(g_slist_find_custom(block_both_l, b->name,(GCompareFunc)strcmp) == NULL) &&
+				(g_slist_find_custom(visible_l, b->name,(GCompareFunc)strcmp) == NULL) &&
+				(g_slist_find_custom(invisible_l, b->name,(GCompareFunc)strcmp) == NULL) )
+
+					purple_blist_remove_buddy(b);
+	}
+
+	/* What if there was a non-buddy contact in some privacy list(s), but now you have added it in your buddy list */
+	/* remove contact from privacy group, if now its in the buddy list */
+	for(l_tmp = buddy_l; l_tmp != NULL; l_tmp = l_tmp->next)
+		if((b = purple_find_buddy_in_group(account, (const char *)l_tmp->data, purple_find_group(PURPLE_PRIVACY_GROUP))))
+			purple_blist_remove_buddy(b);
+
+	/* Add the contacts from the master list to the blist */
+	/* Process buddy list first. Assuming that we want to receive message
+	and send presence from buddies in case they don't exist on any other list */
+
+	for(l_tmp = buddy_l ; l_tmp != NULL; l_tmp = l_tmp->next)
+		purple_privacy_update_contact(account, l_tmp->data, FALSE, TRUE, TRUE);
+
+	for(l_tmp = allow_l ; l_tmp != NULL; l_tmp = l_tmp->next)
+		purple_privacy_update_contact(account, l_tmp->data, FALSE, TRUE, TRUE);
+
+	for(l_tmp = block_msg_l ; l_tmp != NULL; l_tmp = l_tmp->next)
+		purple_privacy_update_contact(account, l_tmp->data, FALSE, FALSE, TRUE);
+
+	for(l_tmp = block_both_l ; l_tmp != NULL; l_tmp = l_tmp->next)
+		purple_privacy_update_contact(account, l_tmp->data, FALSE, FALSE, FALSE);
+
+	/* Can't determine contact's message privacy setting by its presence on visible/invisible list alone. So we process these cases in the last, 		assuming message privacy setting has already been done or assumed to be willing to receive messages */
+	/* Create contact with TRUE, TRUE state first, before updating its presence according to visible/invisible list */
+	for(l_tmp = visible_l ; l_tmp != NULL; l_tmp = l_tmp->next)
+	{		
+		purple_privacy_update_contact(account, l_tmp->data, FALSE, TRUE, TRUE);
+		purple_privacy_update_presence_setting(account, l_tmp->data, TRUE);
+	}
+	for(l_tmp = invisible_l ; l_tmp != NULL; l_tmp = l_tmp->next)
+	{		
+		purple_privacy_update_contact(account, l_tmp->data, FALSE, TRUE, TRUE);
+		purple_privacy_update_presence_setting(account, l_tmp->data, FALSE);
+	}
+	g_slist_free(p_contacts);
+
+	return TRUE;	
+}
============================================================
--- libpurple/privacy.h	0dc640630e620a4c92edfb2c4c880a6cfac87f20
+++ libpurple/privacy.h	92b25c7fcd317d01588b092c9fc494eb69aa237c
@@ -26,6 +26,8 @@
 #ifndef _PURPLE_PRIVACY_H_
 #define _PURPLE_PRIVACY_H_
 
+#define PURPLE_PRIVACY_GROUP	"_Privacy"
+
 #include "account.h"
 
 /**
@@ -40,6 +42,16 @@ typedef enum _PurplePrivacyType
 	PURPLE_PRIVACY_ALLOW_BUDDYLIST
 } PurplePrivacyType;
 
+typedef enum _PurplePrivacyListType
+{
+	PURPLE_PRIVACY_ALLOW_LIST = 1,
+	PURPLE_PRIVACY_BLOCK_MESSAGE_LIST,
+	PURPLE_PRIVACY_BLOCK_BOTH_LIST,
+	PURPLE_PRIVACY_VISIBLE_LIST,
+	PURPLE_PRIVACY_INVISIBLE_LIST,
+	PURPLE_PRIVACY_BUDDY_LIST
+} PurplePrivacyListType;
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -164,7 +176,7 @@ void purple_privacy_deny(PurpleAccount *
  * @param account	The account.
  * @param who		The name of the user.
  *
- * @return @c FALSE if the specified account's privacy settings block the user or @c TRUE otherwise. The meaning of "block" is protocol-dependent and generally relates to status and/or sending of messages.
+ * @return @c FALSE if the specified account's privacy settings block the user or @c TRUE otherwise. The meaning of "block" relates to sending of messages.
  */
 gboolean purple_privacy_check(PurpleAccount *account, const char *who);
 
@@ -187,6 +199,28 @@ void purple_privacy_init(void);
  */
 void purple_privacy_init(void);
 
+/* privacy laters: detailed description laters */
+/* Sets the privacy settings for a contact */
+gboolean purple_privacy_update_contact(PurpleAccount *account, const char *who, gboolean local_only, gboolean receive_message, gboolean send_presence);
+
+/* Returns account specific privacy lists */
+GSList *purple_privacy_list_get_members_by_account(PurpleAccount *account, PurplePrivacyListType type);
+
+/* Sets privacy setting for receiving messages, leaves presence setting untouched */
+gboolean purple_privacy_update_message_setting(PurpleAccount *account, const char *who, gboolean receive_message);
+
+/* Sets privacy setting for sending presence, leaves message setting untouched */
+gboolean purple_privacy_update_presence_setting(PurpleAccount *account, const char *who, gboolean send_presence);
+
+/* called by prpls with all the privacy lists + buddy list. Synchronizes the local master list (blist) */
+gboolean purple_privacy_sync_lists(PurpleAccount *account, GSList *buddy_l, GSList *allow_l, GSList *block_msg_l, GSList *block_both_l, GSList *visible_l, GSList *invisible_l);
+
+/* returns if sending presence information is allowed to the contact "who" */
+gboolean purple_privacy_check_presence(PurpleAccount *account, const char *who);
+
+/* returns if receiving messages from the contact "who" is allowed */
+gboolean purple_privacy_check_message(PurpleAccount *account, const char *who);
+
 #ifdef __cplusplus
 }
 #endif
============================================================
--- libpurple/protocols/yahoo/libymsg.c	6b798aab2b884c129bf8c912234defaa54d059ac
+++ libpurple/protocols/yahoo/libymsg.c	2c4ebd8f9d237b79aa50e7093ff2d02f1195cd1c
@@ -486,6 +486,7 @@ static void yahoo_process_list_15(Purple
 	PurpleGroup *g;
 	int protocol = 0;
 	int stealth = 0;
+	GSList *buddy_list = NULL, *block_both_list = NULL, *invisible_list = NULL;
 
 
 	ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free);
@@ -527,12 +528,18 @@ static void yahoo_process_list_15(Purple
 						purple_blist_add_buddy(b, NULL, g, NULL);
 					}
 					yahoo_do_group_check(account, ht, norm_bud, yd->current_list15_grp);
+					/* Prepare buddy list to be passed to privacy subsystem */
+					buddy_list = g_slist_prepend(buddy_list, g_strdup(norm_bud));
 					if(protocol != 0) {
 						f->protocol = protocol;
 						purple_debug_info("yahoo", "Setting protocol to %d\n", f->protocol);
 					}
 					if(stealth == 2)
+					{
 						f->presence = YAHOO_PRESENCE_PERM_OFFLINE;
+						/* Prepare invisible list to be passed to privacy subsystem */
+						invisible_list = g_slist_prepend(invisible_list, g_strdup(norm_bud));
+					}
 
 					/* set p2p status not connected and no p2p packet sent */
 					if(protocol == 0) {
@@ -543,7 +550,8 @@ static void yahoo_process_list_15(Purple
 				} else {
 					/* This buddy is on the ignore list (and therefore in no group) */
 					purple_debug_info("yahoo", "%s adding %s to the deny list because of the ignore list / no group was found\n",account->username, norm_bud);
-					purple_privacy_deny_add(account, norm_bud, 1);
+					/* Prepare block list (blocks message and presence) to be passed to privacy subsystem */
+					block_both_list = g_slist_prepend(block_both_list, g_strdup(norm_bud));
 				}
 
 				protocol = 0;
@@ -588,6 +596,14 @@ static void yahoo_process_list_15(Purple
 	yahoo_set_status(account, purple_account_get_active_status(account));
 	purple_debug_info("yahoo","Authentication: Connection established\n");
 
+	/* Provide the privacy subsystem with the lists on the server*/ 
+	purple_privacy_sync_lists(account, buddy_list, NULL, NULL, block_both_list, NULL, invisible_list);
+	purple_debug_info("yahoo","Privacy Lists synchronized\n");
+
+	g_slist_free(buddy_list);
+	g_slist_free(block_both_list);
+	g_slist_free(invisible_list);
+
 	g_hash_table_destroy(ht);
 	g_free(norm_bud);
 	g_free(temp);
@@ -4743,25 +4759,27 @@ void yahoo_set_permit_deny(PurpleConnect
 void yahoo_set_permit_deny(PurpleConnection *gc)
 {
 	PurpleAccount *account;
-	GSList *deny;
+	GSList *deny = NULL, *l = NULL;
 
 	account = purple_connection_get_account(gc);
+	deny = purple_privacy_list_get_members_by_account(account, PURPLE_PRIVACY_BLOCK_BOTH_LIST);
 
 	switch (account->perm_deny)
 	{
 		case PURPLE_PRIVACY_ALLOW_ALL:
-			for (deny = account->deny; deny; deny = deny->next)
-				yahoo_rem_deny(gc, deny->data);
+			for (l = deny; l; l = l->next)
+				yahoo_rem_deny(gc, l->data);
 			break;
 
 		case PURPLE_PRIVACY_ALLOW_BUDDYLIST:
 		case PURPLE_PRIVACY_ALLOW_USERS:
 		case PURPLE_PRIVACY_DENY_USERS:
 		case PURPLE_PRIVACY_DENY_ALL:
-			for (deny = account->deny; deny; deny = deny->next)
-				yahoo_add_deny(gc, deny->data);
+			for (l = deny; l; l = l->next)
+				yahoo_add_deny(gc, l->data);
 			break;
 	}
+	g_slist_free(deny);
 }
 
 void yahoo_change_buddys_group(PurpleConnection *gc, const char *who,
============================================================
--- libpurple/protocols/yahoo/yahoochat.c	c17ab176eebafd1a5f147a791ddf5aada864c737
+++ libpurple/protocols/yahoo/yahoochat.c	d06d3bdd5cdbc2cfd5c2094976470e306981326f
@@ -430,7 +430,7 @@ void yahoo_process_chat_join(PurpleConne
 	PurpleAccount *account = purple_connection_get_account(gc);
 	struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data;
 	PurpleConversation *c = NULL;
-	GSList *l;
+	GSList *l = NULL, *deny = NULL;
 	GList *members = NULL;
 	GList *roomies = NULL;
 	char *room = NULL;
@@ -560,9 +560,11 @@ void yahoo_process_chat_join(PurpleConne
 		yahoo_chat_add_users(PURPLE_CONV_CHAT(c), members);
 	}
 
-	if (account->deny && c) {
+	deny = purple_privacy_list_get_members_by_account(account, PURPLE_PRIVACY_BLOCK_BOTH_LIST);
+
+	if (deny && c) {
 		PurpleConversationUiOps *ops = purple_conversation_get_ui_ops(c);
-		for (l = account->deny; l != NULL; l = l->next) {
+		for (l = deny; l != NULL; l = l->next) {
 			for (roomies = members; roomies; roomies = roomies->next) {
 				if (!purple_utf8_strcasecmp((char *)l->data, roomies->data)) {
 					purple_debug_info("yahoo", "Ignoring room member %s in room %s\n" , (char *)roomies->data, room ? room : "");
@@ -572,6 +574,7 @@ void yahoo_process_chat_join(PurpleConne
 			}
 		}
 	}
+	g_slist_free(deny);
 	g_list_free(roomies);
 	g_list_free(members);
 	g_free(room);
============================================================
--- pidgin/gtkprivacy.c	0539636ae120a83ed054e2fc0defb5fc235fd35a
+++ pidgin/gtkprivacy.c	da09153a53a01c4dcb19733faa1345d852031076
@@ -92,29 +92,33 @@ rebuild_allow_list(PidginPrivacyDialog *
 static void
 rebuild_allow_list(PidginPrivacyDialog *dialog)
 {
-	GSList *l;
+	GSList *l = NULL, *list = NULL;
 	GtkTreeIter iter;
 
 	gtk_list_store_clear(dialog->allow_store);
+	list = purple_privacy_list_get_members_by_account(dialog->account, PURPLE_PRIVACY_ALLOW_LIST);
 
-	for (l = dialog->account->permit; l != NULL; l = l->next) {
+	for (l = list; l != NULL; l = l->next) {
 		gtk_list_store_append(dialog->allow_store, &iter);
-		gtk_list_store_set(dialog->allow_store, &iter, 0, l->data, -1);
+		gtk_list_store_set(dialog->allow_store, &iter, 0, (char *)l->data, -1);
 	}
+	g_slist_free(list);
 }
 
 static void
 rebuild_block_list(PidginPrivacyDialog *dialog)
 {
-	GSList *l;
+	GSList *l = NULL, *list = NULL;
 	GtkTreeIter iter;
 
 	gtk_list_store_clear(dialog->block_store);
+	list = purple_privacy_list_get_members_by_account(dialog->account, PURPLE_PRIVACY_BLOCK_BOTH_LIST);
 
-	for (l = dialog->account->deny; l != NULL; l = l->next) {
+	for (l = list; l != NULL; l = l->next) {
 		gtk_list_store_append(dialog->block_store, &iter);
-		gtk_list_store_set(dialog->block_store, &iter, 0, l->data, -1);
+		gtk_list_store_set(dialog->block_store, &iter, 0, (char *)l->data, -1);
 	}
+	g_slist_free(list);
 }
 
 static void
@@ -311,11 +315,11 @@ removeall_cb(GtkWidget *button, PidginPr
 static void
 removeall_cb(GtkWidget *button, PidginPrivacyDialog *dialog)
 {
-	GSList *l;
+	GSList *l = NULL, *list = NULL;
 	if (dialog->in_allow_list)
-		l = dialog->account->permit;
+		l = list = purple_privacy_list_get_members_by_account(dialog->account, PURPLE_PRIVACY_ALLOW_LIST);
 	else
-		l = dialog->account->deny;
+		l = list = purple_privacy_list_get_members_by_account(dialog->account, PURPLE_PRIVACY_BLOCK_BOTH_LIST);
 	while (l) {
 		char *user;
 		user = l->data;
@@ -325,6 +329,7 @@ removeall_cb(GtkWidget *button, PidginPr
 		else
 			purple_privacy_deny_remove(dialog->account, user, FALSE);
 	}
+	g_slist_free(list);
 }
 
 static void


More information about the Commits mailing list