libpurple/protocols/novell/novell.c

branch
soc.2013.gobjectification
changeset 34578
cfb2f856a5d0
parent 34111
85b5efb9a873
child 34589
428e92c79631
--- a/libpurple/protocols/novell/novell.c	Mon Jun 17 21:59:32 2013 +0530
+++ b/libpurple/protocols/novell/novell.c	Mon Jun 17 23:39:13 2013 +0530
@@ -29,7 +29,6 @@
 #include "sslconn.h"
 #include "request.h"
 #include "network.h"
-#include "privacy.h"
 #include "status.h"
 #include "version.h"
 
@@ -726,6 +725,7 @@
 								   gpointer resp_data, gpointer user_data)
 {
 	PurpleConnection *gc;
+	PurpleAccount *account;
 	NMUserRecord *user_record = resp_data;
 	char *err;
 	gboolean allowed = GPOINTER_TO_INT(user_data);
@@ -736,21 +736,22 @@
 
 	gc = purple_account_get_connection(user->client_data);
 	display_id = nm_user_record_get_display_id(user_record);
+	account = purple_connection_get_account(gc);
 
 	if (ret_code == NM_OK) {
 
 		if (allowed) {
 
-			if (!g_slist_find_custom(purple_connection_get_account(gc)->permit,
+			if (!g_slist_find_custom(purple_account_privacy_get_denied(account),
 									 display_id, (GCompareFunc)purple_utf8_strcasecmp)) {
-				purple_privacy_permit_add(purple_connection_get_account(gc), display_id, TRUE);
+				purple_account_privacy_permit_add(account, display_id, TRUE);
 			}
 
 		} else {
 
-			if (!g_slist_find_custom(purple_connection_get_account(gc)->permit,
+			if (!g_slist_find_custom(purple_account_privacy_get_denied(account),
 									 display_id, (GCompareFunc)purple_utf8_strcasecmp)) {
-				purple_privacy_deny_add(purple_connection_get_account(gc), display_id, TRUE);
+				purple_account_privacy_deny_add(account, display_id, TRUE);
 			}
 		}
 
@@ -770,6 +771,7 @@
 								  gpointer resp_data, gpointer user_data)
 {
 	PurpleConnection *gc;
+	PurpleAccount *account;
 	NMUserRecord *user_record;
 	char *who = user_data;
 	char *err;
@@ -780,6 +782,7 @@
 		return;
 
 	gc = purple_account_get_connection(user->client_data);
+	account = purple_connection_get_account(gc);
 
 	if (ret_code == NM_OK) {
 
@@ -789,10 +792,10 @@
 
 		if (display_id) {
 
-			if (!g_slist_find_custom(purple_connection_get_account(gc)->deny,
+			if (!g_slist_find_custom(purple_account_privacy_get_denied(account),
 									 display_id, (GCompareFunc)purple_utf8_strcasecmp)) {
 
-				purple_privacy_deny_add(purple_connection_get_account(gc), display_id, TRUE);
+				purple_account_privacy_deny_add(account, display_id, TRUE);
 			}
 
 		} else {
@@ -821,6 +824,7 @@
 									gpointer resp_data, gpointer user_data)
 {
 	PurpleConnection *gc;
+	PurpleAccount *account;
 	NMUserRecord *user_record;
 	char *who = user_data;
 	char *err;
@@ -831,6 +835,7 @@
 		return;
 
 	gc = purple_account_get_connection(user->client_data);
+	account = purple_connection_get_account(gc);
 
 	if (ret_code == NM_OK) {
 
@@ -840,11 +845,11 @@
 
 		if (display_id) {
 
-			if (!g_slist_find_custom(purple_connection_get_account(gc)->permit,
+			if (!g_slist_find_custom(purple_account_privacy_get_permitted(account),
 									 display_id,
 									 (GCompareFunc)purple_utf8_strcasecmp)) {
 
-				purple_privacy_permit_add(purple_connection_get_account(gc), display_id, TRUE);
+				purple_account_privacy_permit_add(account, display_id, TRUE);
 			}
 
 		} else {
@@ -1386,6 +1391,7 @@
 {
 	GSList *node = NULL, *rem_list = NULL;
 	PurpleConnection *gc;
+	PurpleAccount *account;
 	const char *name, *dn;
 	NMUserRecord *user_record;
 
@@ -1396,18 +1402,20 @@
 	if (gc == NULL)
 		return;
 
+	account = purple_connection_get_account(gc);
+
 	/* Set the Purple privacy setting */
 	if (user->default_deny) {
 		if (user->allow_list == NULL) {
-			purple_account_set_privacy_type(purple_connection_get_account(gc), PURPLE_PRIVACY_DENY_ALL);
+			purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_DENY_ALL);
 		} else {
-			purple_account_set_privacy_type(purple_connection_get_account(gc), PURPLE_PRIVACY_ALLOW_USERS);
+			purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS);
 		}
 	} else {
 		if (user->deny_list == NULL) {
-			purple_account_set_privacy_type(purple_connection_get_account(gc), PURPLE_PRIVACY_ALLOW_ALL);
+			purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_ALLOW_ALL);
 		} else {
-			purple_account_set_privacy_type(purple_connection_get_account(gc), PURPLE_PRIVACY_DENY_USERS);
+			purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_DENY_USERS);
 		}
 	}
 
@@ -1419,9 +1427,9 @@
 		else
 			name =(char *)node->data;
 
-		if (!g_slist_find_custom(purple_connection_get_account(gc)->permit,
+		if (!g_slist_find_custom(purple_account_privacy_get_permitted(account),
 								 name, (GCompareFunc)purple_utf8_strcasecmp)) {
-			purple_privacy_permit_add(purple_connection_get_account(gc), name , TRUE);
+			purple_account_privacy_permit_add(account, name , TRUE);
 		}
 	}
 
@@ -1432,15 +1440,15 @@
 		else
 			name =(char *)node->data;
 
-		if (!g_slist_find_custom(purple_connection_get_account(gc)->deny,
+		if (!g_slist_find_custom(purple_account_privacy_get_denied(account),
 								 name, (GCompareFunc)purple_utf8_strcasecmp)) {
-			purple_privacy_deny_add(purple_connection_get_account(gc), name, TRUE);
+			purple_account_privacy_deny_add(account, name, TRUE);
 		}
 	}
 
 
 	/*  Remove stuff */
-	for (node = purple_connection_get_account(gc)->permit; node; node = node->next) {
+	for (node = purple_account_privacy_get_permitted(account); node; node = node->next) {
 		dn = nm_lookup_dn(user, (char *)node->data);
 		if (dn != NULL &&
 			!g_slist_find_custom(user->allow_list,
@@ -1451,13 +1459,13 @@
 
 	if (rem_list) {
 		for (node = rem_list; node; node = node->next) {
-			purple_privacy_permit_remove(purple_connection_get_account(gc), (char *)node->data, TRUE);
+			purple_account_privacy_permit_remove(account, (char *)node->data, TRUE);
 		}
 		g_slist_free(rem_list);
 		rem_list = NULL;
 	}
 
-	for (node = purple_connection_get_account(gc)->deny; node; node = node->next) {
+	for (node = purple_account_privacy_get_denied(account); node; node = node->next) {
 		dn = nm_lookup_dn(user, (char *)node->data);
 		if (dn != NULL &&
 			!g_slist_find_custom(user->deny_list,
@@ -1468,7 +1476,7 @@
 
 	if (rem_list) {
 		for (node = rem_list; node; node = node->next) {
-			purple_privacy_deny_remove(purple_connection_get_account(gc), (char *)node->data, TRUE);
+			purple_account_privacy_deny_remove(account, (char *)node->data, TRUE);
 		}
 		g_slist_free(rem_list);
 	}
@@ -3086,7 +3094,7 @@
 	/* Remove first -- we will add it back in when we get
 	 * the okay from the server
 	 */
-	purple_privacy_permit_remove(purple_connection_get_account(gc), who, TRUE);
+	purple_account_privacy_permit_remove(purple_connection_get_account(gc), who, TRUE);
 
 	if (nm_user_is_privacy_locked(user)) {
 		_show_privacy_locked_error(gc, user);
@@ -3130,7 +3138,7 @@
 	/* Remove first -- we will add it back in when we get
 	 * the okay from the server
 	 */
-	purple_privacy_deny_remove(purple_connection_get_account(gc), who, TRUE);
+	purple_account_privacy_deny_remove(purple_connection_get_account(gc), who, TRUE);
 
 	if (nm_user_is_privacy_locked(user)) {
 		_show_privacy_locked_error(gc, user);
@@ -3228,10 +3236,13 @@
 	int i, j, num_contacts, num_folders;
 	NMContact *contact;
 	NMFolder *folder = NULL;
+	PurpleAccount *account;
 
 	if (gc == NULL)
 		return;
 
+	account = purple_connection_get_account(gc);
+
 	user = purple_connection_get_protocol_data(gc);
 	if (user == NULL)
 		return;
@@ -3248,9 +3259,9 @@
 		return;
 	}
 
-	switch (purple_account_get_privacy_type(purple_connection_get_account(gc))) {
-
-		case PURPLE_PRIVACY_ALLOW_ALL:
+	switch (purple_account_get_privacy_type(account)) {
+
+		case PURPLE_ACCOUNT_PRIVACY_ALLOW_ALL:
 			rc = nm_send_set_privacy_default(user, FALSE,
 											 _set_privacy_default_resp_cb, NULL);
 			_check_for_disconnect(user, rc);
@@ -3270,7 +3281,7 @@
 			}
 			break;
 
-		case PURPLE_PRIVACY_DENY_ALL:
+		case PURPLE_ACCOUNT_PRIVACY_DENY_ALL:
 			rc = nm_send_set_privacy_default(user, TRUE,
 											 _set_privacy_default_resp_cb, NULL);
 			_check_for_disconnect(user, rc);
@@ -3290,7 +3301,7 @@
 			}
 			break;
 
-		case PURPLE_PRIVACY_ALLOW_USERS:
+		case PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS:
 
 			rc = nm_send_set_privacy_default(user, TRUE,
 											 _set_privacy_default_resp_cb, NULL);
@@ -3304,14 +3315,14 @@
 					if (user_record) {
 						name = nm_user_record_get_display_id(user_record);
 
-						if (!g_slist_find_custom(purple_connection_get_account(gc)->permit,
+						if (!g_slist_find_custom(purple_account_privacy_get_permitted(account),
 												 name, (GCompareFunc)purple_utf8_strcasecmp)) {
-							purple_privacy_permit_add(purple_connection_get_account(gc), name , TRUE);
+							purple_account_privacy_permit_add(account, name , TRUE);
 						}
 					}
 				}
 
-				for (node = purple_connection_get_account(gc)->permit; node; node = node->next) {
+				for (node = purple_account_privacy_get_permitted(account); node; node = node->next) {
 					dn = nm_lookup_dn(user, (char *)node->data);
 					if (dn) {
 
@@ -3322,13 +3333,13 @@
 															 g_strdup(dn));
 						}
 					} else {
-						purple_privacy_permit_remove(purple_connection_get_account(gc), (char *)node->data, TRUE);
+						purple_account_privacy_permit_remove(account, (char *)node->data, TRUE);
 					}
 				}
 			}
 			break;
 
-		case PURPLE_PRIVACY_DENY_USERS:
+		case PURPLE_ACCOUNT_PRIVACY_DENY_USERS:
 
 			/* set to default allow */
 			rc = nm_send_set_privacy_default(user, FALSE,
@@ -3343,14 +3354,14 @@
 					if (user_record) {
 						name = nm_user_record_get_display_id(user_record);
 
-						if (!g_slist_find_custom(purple_connection_get_account(gc)->deny,
+						if (!g_slist_find_custom(purple_account_privacy_get_denied(account),
 												 name, (GCompareFunc)purple_utf8_strcasecmp)) {
-							purple_privacy_deny_add(purple_connection_get_account(gc), name , TRUE);
+							purple_account_privacy_deny_add(account, name , TRUE);
 						}
 					}
 				}
 
-				for (node = purple_connection_get_account(gc)->deny; node; node = node->next) {
+				for (node = purple_account_privacy_get_denied(account); node; node = node->next) {
 
 					name = NULL;
 					dn = nm_lookup_dn(user, (char *)node->data);
@@ -3365,14 +3376,14 @@
 															 g_strdup(name));
 						}
 					} else {
-						purple_privacy_deny_remove(purple_connection_get_account(gc), (char *)node->data, TRUE);
+						purple_account_privacy_deny_remove(account, (char *)node->data, TRUE);
 					}
 				}
 
 			}
 			break;
 
-		case PURPLE_PRIVACY_ALLOW_BUDDYLIST:
+		case PURPLE_ACCOUNT_PRIVACY_ALLOW_BUDDYLIST:
 
 			/* remove users from allow list that are not in buddy list */
 			copy = g_slist_copy(user->allow_list);

mercurial