soc.2009.privacy_rewrite: 28c7a256: Code Msn to store privacy information in...

sulabh at soc.pidgin.im sulabh at soc.pidgin.im
Wed Jul 22 17:25:27 EDT 2009


-----------------------------------------------------------------
Revision: 28c7a2562d2dd4139a6a3b2c4f9a7d5802733249
Ancestor: c89478f0b9cee28b0959b0a9394696244c215c58
Author: sulabh at soc.pidgin.im
Date: 2009-07-19T11:53:24
Branch: im.pidgin.soc.2009.privacy_rewrite
URL: http://d.pidgin.im/viewmtn/revision/info/28c7a2562d2dd4139a6a3b2c4f9a7d5802733249

Modified files:
        libpurple/privacy.c libpurple/protocols/msn/msn.c
        libpurple/protocols/msn/session.c
        libpurple/protocols/msn/userlist.c

ChangeLog: 

Code Msn to store privacy information in blist 

-------------- next part --------------
============================================================
--- libpurple/privacy.c	010644353dcf253a37505073057336d861aae143
+++ libpurple/privacy.c	3bb73baddcf70694875bd611f6a1dc43c00daa15
@@ -40,6 +40,8 @@ purple_privacy_permit_add(PurpleAccount 
 	g_return_val_if_fail(account != NULL, FALSE);
 	g_return_val_if_fail(who     != NULL, FALSE);
 
+	purple_debug_info("Privacy","In purple_privacy_permit_add\n"); /* remove me laters */
+
 	name = g_strdup(purple_normalize(account, who));
 
 	purple_privacy_update_contact(account, name, local_only, TRUE, TRUE);
@@ -75,6 +77,8 @@ purple_privacy_permit_remove(PurpleAccou
 	g_return_val_if_fail(account != NULL, FALSE);
 	g_return_val_if_fail(who     != NULL, FALSE);
 
+	purple_debug_info("Privacy","In purple_privacy_permit_remove\n"); /* remove me laters */
+
 	name = g_strdup(purple_normalize(account, who));
 
 	if(!(b = purple_find_buddy(account, name)))
@@ -120,6 +124,8 @@ purple_privacy_deny_add(PurpleAccount *a
 	g_return_val_if_fail(account != NULL, FALSE);
 	g_return_val_if_fail(who     != NULL, FALSE);
 
+	purple_debug_info("Privacy","In purple_privacy_deny_add\n"); /* remove me laters */
+
 	name = g_strdup(purple_normalize(account, who));
 	purple_privacy_update_contact(account, name, local_only, TRUE, TRUE);
 
@@ -151,6 +157,8 @@ purple_privacy_deny_remove(PurpleAccount
 	g_return_val_if_fail(account != NULL, FALSE);
 	g_return_val_if_fail(who     != NULL, FALSE);
 
+	purple_debug_info("Privacy","In purple_privacy_deny_remove\n"); /* remove me laters */
+
 	name = g_strdup(purple_normalize(account, who));
 
 	if(!(b = purple_find_buddy(account, name)))
============================================================
--- libpurple/protocols/msn/msn.c	e292085d960708bbbd15589eda9218d020af6c50
+++ libpurple/protocols/msn/msn.c	33a7e5e2c771e3158edb772eec77181fc74aa1f8
@@ -785,6 +785,7 @@ msn_tooltip_text(PurpleBuddy *buddy, Pur
 		}
 	}
 
+	/* Privacy laters: */
 	/* XXX: This is being shown in non-full tooltips because the
 	 * XXX: blocked icon overlay isn't always accurate for MSN.
 	 * XXX: This can die as soon as purple_privacy_check() knows that
============================================================
--- libpurple/protocols/msn/session.c	9c45d6773028eb5ac5adb35e17b2ed10dd9f92c6
+++ libpurple/protocols/msn/session.c	385d25cc9f9fb0c0b56fac9697890ea6c8311392
@@ -312,6 +312,29 @@ msn_session_sync_users(MsnSession *sessi
 	}
 }
 
+/* Sync FL, AL, BL with the privacy subsystem */
+static void
+msn_session_sync_privacy_lists(MsnSession *session)
+{
+	GList *l = NULL;
+	MsnUser *tmp = NULL;
+	GSList *buddy_l = NULL, *allow_l = NULL, *block_both_l = NULL;
+
+	for (l = session->userlist->users; l != NULL; l = l->next)
+	{
+		tmp = (MsnUser *)l->data;
+
+		if (tmp->list_op & MSN_LIST_FL_OP)
+			buddy_l = g_slist_prepend(buddy_l, tmp->passport);
+		if (tmp->list_op & MSN_LIST_AL_OP)
+			allow_l = g_slist_prepend(allow_l, tmp->passport);
+		if (tmp->list_op & MSN_LIST_BL_OP)
+			block_both_l = g_slist_prepend(block_both_l, tmp->passport);
+	}
+	purple_privacy_sync_lists(session->account, buddy_l, allow_l, NULL, block_both_l, NULL, NULL);
+	purple_debug_info("msn","Privacy Lists synchronized\n");
+}
+
 void
 msn_session_set_error(MsnSession *session, MsnErrorType error,
 					  const char *info)
@@ -446,6 +469,7 @@ msn_session_finish_login(MsnSession *ses
 
 		/* Sync users */
 		msn_session_sync_users(session);
+		msn_session_sync_privacy_lists(session);
 	}
 
 	msn_change_status(session);
============================================================
--- libpurple/protocols/msn/userlist.c	63770d720fd02e8faca4ac3386b747ac9d3aa528
+++ libpurple/protocols/msn/userlist.c	419804cc9412af515f3898439960332bf953f509
@@ -175,20 +175,6 @@ msn_got_lst_user(MsnSession *session, Ms
 		serv_got_alias(gc, passport, store);
 	}
 
-	if (list_op & MSN_LIST_AL_OP)
-	{
-		/* These are users who are allowed to see our status. */
-		purple_privacy_deny_remove(account, passport, TRUE);
-		purple_privacy_permit_add(account, passport, TRUE);
-	}
-
-	if (list_op & MSN_LIST_BL_OP)
-	{
-		/* These are users who are not allowed to see our status. */
-		purple_privacy_permit_remove(account, passport, TRUE);
-		purple_privacy_deny_add(account, passport, TRUE);
-	}
-
 	if (list_op & MSN_LIST_RL_OP)
 	{
 		/* These are users who have us on their buddy list. */
@@ -736,18 +722,7 @@ msn_userlist_load(MsnSession *session)
 		purple_buddy_set_protocol_data(buddy, user);
 		msn_user_set_op(user, MSN_LIST_FL_OP);
 	}
-	for (l = session->account->permit; l != NULL; l = l->next)
-	{
-		user = msn_userlist_find_add_user(session->userlist,
-						(char *)l->data,NULL);
-		msn_user_set_op(user, MSN_LIST_AL_OP);
-	}
-	for (l = session->account->deny; l != NULL; l = l->next)
-	{
-		user = msn_userlist_find_add_user(session->userlist,
-						(char *)l->data,NULL);
-		msn_user_set_op(user, MSN_LIST_BL_OP);
-	}
 
+	/* Privacy laters: Sync privacy lists */
 }
 


More information about the Commits mailing list