/soc/2013/ankitkv/gobjectification: 216613e5e368: Removed local ...
Ankit Vani
a at nevitus.org
Mon Jun 17 12:20:54 EDT 2013
Changeset: 216613e5e36835cfd64ec871661b3f3338aef87f
Author: Ankit Vani <a at nevitus.org>
Date: 2013-06-17 21:50 +0530
Branch: soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/216613e5e368
Description:
Removed local and restore arguments to purple_account_privacy_[allow,deny]() as all calls to this function pass them as FALSE. purple_account_privacy_[permit,deny]_[add,remove] can be used to make local privacy changes.
diffstat:
libpurple/account.c | 70 +++++++++++++++++++---------------------------------
libpurple/account.h | 22 +++++++++-------
2 files changed, 38 insertions(+), 54 deletions(-)
diffs (167 lines):
diff --git a/libpurple/account.c b/libpurple/account.c
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -2686,15 +2686,8 @@ add_all_buddies_to_permit_list(PurpleAcc
}
}
-/*
- * TODO: All callers of this function pass in FALSE for local and
- * restore and I don't understand when you would ever want to
- * use TRUE for either of them. I think both parameters could
- * safely be removed in the next major version bump.
- */
void
-purple_account_privacy_allow(PurpleAccount *account, const char *who, gboolean local,
- gboolean restore)
+purple_account_privacy_allow(PurpleAccount *account, const char *who)
{
GSList *list;
PurpleAccountPrivacyType type = purple_account_get_privacy_type(account);
@@ -2703,29 +2696,27 @@ purple_account_privacy_allow(PurpleAccou
case PURPLE_ACCOUNT_PRIVACY_ALLOW_ALL:
return;
case PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS:
- purple_account_privacy_permit_add(account, who, local);
+ purple_account_privacy_permit_add(account, who, FALSE);
break;
case PURPLE_ACCOUNT_PRIVACY_DENY_USERS:
- purple_account_privacy_deny_remove(account, who, local);
+ purple_account_privacy_deny_remove(account, who, FALSE);
break;
case PURPLE_ACCOUNT_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_account_privacy_permit_remove(account, person, local);
- }
+ /* 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_account_privacy_permit_remove(account, person, FALSE);
}
- purple_account_privacy_permit_add(account, who, local);
+ purple_account_privacy_permit_add(account, who, FALSE);
purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS);
break;
case PURPLE_ACCOUNT_PRIVACY_ALLOW_BUDDYLIST:
if (!purple_find_buddy(account, who)) {
- add_all_buddies_to_permit_list(account, local);
- purple_account_privacy_permit_add(account, who, local);
+ add_all_buddies_to_permit_list(account, FALSE);
+ purple_account_privacy_permit_add(account, who, FALSE);
purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS);
}
break;
@@ -2738,46 +2729,37 @@ purple_account_privacy_allow(PurpleAccou
serv_set_permit_deny(purple_account_get_connection(account));
}
-/*
- * TODO: All callers of this function pass in FALSE for local and
- * restore and I don't understand when you would ever want to
- * use TRUE for either of them. I think both parameters could
- * safely be removed in the next major version bump.
- */
void
-purple_account_privacy_deny(PurpleAccount *account, const char *who, gboolean local,
- gboolean restore)
+purple_account_privacy_deny(PurpleAccount *account, const char *who)
{
GSList *list;
PurpleAccountPrivacyType type = purple_account_get_privacy_type(account);
switch (type) {
case PURPLE_ACCOUNT_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_account_privacy_deny_remove(account, person, local);
- }
+ /* 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_account_privacy_deny_remove(account, person, FALSE);
}
- purple_account_privacy_deny_add(account, who, local);
+ purple_account_privacy_deny_add(account, who, FALSE);
purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_DENY_USERS);
break;
case PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS:
- purple_account_privacy_permit_remove(account, who, local);
+ purple_account_privacy_permit_remove(account, who, FALSE);
break;
case PURPLE_ACCOUNT_PRIVACY_DENY_USERS:
- purple_account_privacy_deny_add(account, who, local);
+ purple_account_privacy_deny_add(account, who, FALSE);
break;
case PURPLE_ACCOUNT_PRIVACY_DENY_ALL:
break;
case PURPLE_ACCOUNT_PRIVACY_ALLOW_BUDDYLIST:
if (purple_find_buddy(account, who)) {
- add_all_buddies_to_permit_list(account, local);
- purple_account_privacy_permit_remove(account, who, local);
+ add_all_buddies_to_permit_list(account, FALSE);
+ purple_account_privacy_permit_remove(account, who, FALSE);
purple_account_set_privacy_type(account, PURPLE_ACCOUNT_PRIVACY_ALLOW_USERS);
}
break;
diff --git a/libpurple/account.h b/libpurple/account.h
--- a/libpurple/account.h
+++ b/libpurple/account.h
@@ -826,14 +826,13 @@ gboolean purple_account_privacy_deny_rem
* allow-list, and the user is also added to
* the allow-list.
*
+ * The changes are reflected on the server. The previous allow/deny list is not
+ * restored if the privacy setting is changed.
+ *
* @param account The account.
* @param who The name of the user.
- * @param local Whether the change is local-only.
- * @param restore Should the previous allow/deny list be restored if the
- * privacy setting is changed.
*/
-void purple_account_privacy_allow(PurpleAccount *account, const char *who,
- gboolean local, gboolean restore);
+void purple_account_privacy_allow(PurpleAccount *account, const char *who);
/**
* Block messages from a user. If current privacy setting for the account is:
@@ -851,14 +850,17 @@ void purple_account_privacy_allow(Purple
* the buddies are added to the allow-list, and
* this user is removed from the list.
*
+ * The changes are reflected on the server. The previous allow/deny list is not
+ * restored if the privacy setting is changed.
+ *
* @param account The account.
* @param who The name of the user.
- * @param local Whether the change is local-only.
- * @param restore Should the previous allow/deny list be restored if the
- * privacy setting is changed.
*/
-void purple_account_privacy_deny(PurpleAccount *account, const char *who,
- gboolean local, gboolean restore);
+void purple_account_privacy_deny(PurpleAccount *account, const char *who);
+
+gboolean purple_account_privacy_permitted();
+gboolean purple_account_privacy_denied();
+
/**
* Check the privacy-setting for a user.
More information about the Commits
mailing list