/soc/2013/ankitkv/gobjectification: 67a520874aa9: Exposed some f...
Ankit Vani
a at nevitus.org
Wed Jun 19 06:22:08 EDT 2013
Changeset: 67a520874aa9f6941d1e400a05fae64ffdce31fc
Author: Ankit Vani <a at nevitus.org>
Date: 2013-06-19 15:34 +0530
Branch: soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/67a520874aa9
Description:
Exposed some functions to the header files to resolve dependencies.
* set_current_error(account, error) is now purple_account_set_current_error(account, error)
* schedule_accounts_save() is now purple_accounts_schedule_save()
diffstat:
libpurple/account.c | 56 ++++++++++++++++++++++++++++++---------------------
libpurple/account.h | 11 ++++++++++
libpurple/accounts.c | 31 +++++++++-------------------
libpurple/accounts.h | 5 ++++
4 files changed, 59 insertions(+), 44 deletions(-)
diffs (truncated from 335 to 300 lines):
diff --git a/libpurple/account.c b/libpurple/account.c
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -132,9 +132,6 @@ enum
static GObjectClass *parent_class = NULL;
static GList *handles = NULL;
-static void set_current_error(PurpleAccount *account,
- PurpleConnectionErrorInfo *new_err);
-
void
purple_account_set_register_callback(PurpleAccount *account, PurpleAccountRegistrationCb cb, void *user_data)
@@ -717,7 +714,7 @@ purple_account_set_username(PurpleAccoun
g_free(priv->username);
priv->username = g_strdup(username);
- schedule_accounts_save();
+ purple_accounts_schedule_save();
/* if the name changes, we should re-write the buddy list
* to disk with the new name */
@@ -739,7 +736,7 @@ purple_account_set_password(PurpleAccoun
purple_str_wipe(priv->password);
priv->password = g_strdup(password);
- schedule_accounts_save();
+ purple_accounts_schedule_save();
if (!purple_account_get_remember_password(account)) {
purple_debug_info("account",
@@ -779,7 +776,7 @@ purple_account_set_alias(PurpleAccount *
account, old);
g_free(old);
- schedule_accounts_save();
+ purple_accounts_schedule_save();
}
}
@@ -795,7 +792,7 @@ purple_account_set_user_info(PurpleAccou
g_free(priv->user_info);
priv->user_info = g_strdup(user_info);
- schedule_accounts_save();
+ purple_accounts_schedule_save();
}
void purple_account_set_buddy_icon_path(PurpleAccount *account, const char *path)
@@ -809,7 +806,7 @@ void purple_account_set_buddy_icon_path(
g_free(priv->buddy_icon_path);
priv->buddy_icon_path = g_strdup(path);
- schedule_accounts_save();
+ purple_accounts_schedule_save();
}
void
@@ -825,7 +822,7 @@ purple_account_set_protocol_id(PurpleAcc
g_free(priv->protocol_id);
priv->protocol_id = g_strdup(protocol_id);
- schedule_accounts_save();
+ purple_accounts_schedule_save();
}
void
@@ -849,7 +846,7 @@ purple_account_set_remember_password(Pur
priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
priv->remember_pass = value;
- schedule_accounts_save();
+ purple_accounts_schedule_save();
}
void
@@ -906,7 +903,7 @@ purple_account_set_proxy_info(PurpleAcco
priv->proxy_info = info;
- schedule_accounts_save();
+ purple_accounts_schedule_save();
}
void
@@ -987,7 +984,7 @@ purple_account_set_status_list(PurpleAcc
* Our current statuses are saved to accounts.xml (so that when we
* reconnect, we go back to the previous status).
*/
- schedule_accounts_save();
+ purple_accounts_schedule_save();
}
struct public_alias_closure
@@ -1090,6 +1087,17 @@ purple_account_set_silence_suppression(P
purple_account_set_bool(account, "silence-suppression", value);
}
+static void
+delete_setting(void *data)
+{
+ PurpleAccountSetting *setting = (PurpleAccountSetting *)data;
+
+ g_free(setting->ui);
+ g_value_unset(&setting->value);
+
+ g_free(setting);
+}
+
void
purple_account_clear_settings(PurpleAccount *account)
{
@@ -1135,7 +1143,7 @@ purple_account_set_int(PurpleAccount *ac
g_hash_table_insert(priv->settings, g_strdup(name), setting);
- schedule_accounts_save();
+ purple_accounts_schedule_save();
}
void
@@ -1157,7 +1165,7 @@ purple_account_set_string(PurpleAccount
g_hash_table_insert(priv->settings, g_strdup(name), setting);
- schedule_accounts_save();
+ purple_accounts_schedule_save();
}
void
@@ -1178,7 +1186,7 @@ purple_account_set_bool(PurpleAccount *a
g_hash_table_insert(priv->settings, g_strdup(name), setting);
- schedule_accounts_save();
+ purple_accounts_schedule_save();
}
static GHashTable *
@@ -1219,7 +1227,7 @@ purple_account_set_ui_int(PurpleAccount
g_hash_table_insert(table, g_strdup(name), setting);
- schedule_accounts_save();
+ purple_accounts_schedule_save();
}
void
@@ -1243,7 +1251,7 @@ purple_account_set_ui_string(PurpleAccou
g_hash_table_insert(table, g_strdup(name), setting);
- schedule_accounts_save();
+ purple_accounts_schedule_save();
}
void
@@ -1267,7 +1275,7 @@ purple_account_set_ui_bool(PurpleAccount
g_hash_table_insert(table, g_strdup(name), setting);
- schedule_accounts_save();
+ purple_accounts_schedule_save();
}
static PurpleConnectionState
@@ -2376,8 +2384,9 @@ gboolean purple_account_supports_offline
return prpl_info->offline_message(buddy);
}
-static void
-set_current_error(PurpleAccount *account, PurpleConnectionErrorInfo *new_err)
+void
+purple_account_set_current_error(PurpleAccount *account,
+ PurpleConnectionErrorInfo *new_err)
{
PurpleConnectionErrorInfo *old_err;
PurpleAccountPrivate *priv;
@@ -2395,7 +2404,7 @@ set_current_error(PurpleAccount *account
purple_signal_emit(purple_accounts_get_handle(),
"account-error-changed",
account, old_err, new_err);
- schedule_accounts_save();
+ purple_accounts_schedule_save();
if(old_err)
g_free(old_err->description);
@@ -2415,11 +2424,12 @@ purple_account_get_current_error(PurpleA
void
purple_account_clear_current_error(PurpleAccount *account)
{
- set_current_error(account, NULL);
+ purple_account_set_current_error(account, NULL);
}
static xmlnode *
-status_attr_to_xmlnode(const PurpleStatus *status, const PurpleStatusType *type, const PurpleStatusAttr *attr)
+status_attr_to_xmlnode(const PurpleStatus *status, const PurpleStatusType *type,
+ const PurpleStatusAttr *attr)
{
xmlnode *node;
const char *id;
diff --git a/libpurple/account.h b/libpurple/account.h
--- a/libpurple/account.h
+++ b/libpurple/account.h
@@ -1137,6 +1137,17 @@ void purple_account_change_password(Purp
gboolean purple_account_supports_offline_message(PurpleAccount *account, PurpleBuddy *buddy);
/**
+ * Sets the error that caused the account to be disconnected.
+ * You should not ever need to call this function directly, the error is set
+ * by the accouts subsystem. You should only need to retrieve this error.
+ *
+ * @param account The account whose error should be set.
+ * @param new_err The new error.
+ */
+void purple_account_set_current_error(PurpleAccount *account,
+ PurpleConnectionErrorInfo *new_err);
+
+/**
* Get the error that caused the account to be disconnected, or @c NULL if the
* account is happily connected or disconnected without an error.
*
diff --git a/libpurple/accounts.c b/libpurple/accounts.c
--- a/libpurple/accounts.c
+++ b/libpurple/accounts.c
@@ -28,6 +28,8 @@
#include "core.h"
#include "dbus-maybe.h"
#include "debug.h"
+#include "network.h"
+#include "pounce.h"
static PurpleAccountUiOps *account_ui_ops = NULL;
@@ -84,8 +86,8 @@ save_cb(gpointer data)
return FALSE;
}
-static void
-schedule_accounts_save(void)
+void
+purple_accounts_schedule_save(void)
{
if (save_timer == 0)
save_timer = purple_timeout_add_seconds(5, save_cb, NULL);
@@ -452,7 +454,7 @@ parse_current_error(xmlnode *node, Purpl
current_error->type = type;
current_error->description = description;
- set_current_error(account, current_error);
+ purple_account_set_current_error(account, current_error);
}
static PurpleAccount *
@@ -600,19 +602,6 @@ load_accounts(void)
_purple_buddy_icons_account_loaded_cb();
}
-
-static void
-delete_setting(void *data)
-{
- PurpleAccountSetting *setting = (PurpleAccountSetting *)data;
-
- g_free(setting->ui);
- g_value_unset(&setting->value);
-
- g_free(setting);
-}
-
-
void
purple_accounts_add(PurpleAccount *account)
{
@@ -623,7 +612,7 @@ purple_accounts_add(PurpleAccount *accou
accounts = g_list_append(accounts, account);
- schedule_accounts_save();
+ purple_accounts_schedule_save();
purple_signal_emit(purple_accounts_get_handle(), "account-added", account);
}
@@ -635,7 +624,7 @@ purple_accounts_remove(PurpleAccount *ac
accounts = g_list_remove(accounts, account);
- schedule_accounts_save();
+ purple_accounts_schedule_save();
/* Clearing the error ensures that account-error-changed is emitted,
* which is the end of the guarantee that the the error's pointer is
@@ -757,7 +746,7 @@ purple_accounts_reorder(PurpleAccount *a
/* Insert it where it should go. */
accounts = g_list_insert(accounts, account, new_index);
- schedule_accounts_save();
+ purple_accounts_schedule_save();
}
More information about the Commits
mailing list