/soc/2015/akronix/master: e8e13e8e8fe1: merged account related m...
Abel 'Akronix' Serrano Juste
akronix5 at gmail.com
Wed Jun 24 20:30:56 EDT 2015
Changeset: e8e13e8e8fe16c2f76ffc53b467f294ab4e27720
Author: Abel 'Akronix' Serrano Juste <akronix5 at gmail.com>
Date: 2015-06-25 02:30 +0200
Branch: release-2.x.y
URL: https://hg.pidgin.im/soc/2015/akronix/master/rev/e8e13e8e8fe1
Description:
merged account related management from Instantbird.
diffstat:
libpurple/account.c | 28 ++++++++++++++++++++++++++--
libpurple/account.h | 4 ++++
2 files changed, 30 insertions(+), 2 deletions(-)
diffs (108 lines):
diff --git a/libpurple/account.c b/libpurple/account.c
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -41,6 +41,7 @@
#include "util.h"
#include "xmlnode.h"
+
typedef struct
{
PurpleConnectionErrorInfo *current_error;
@@ -2036,6 +2037,7 @@ void
purple_account_set_int(PurpleAccount *account, const char *name, int value)
{
PurpleAccountSetting *setting;
+ PurpleAccountUiOps *ui_ops;
g_return_if_fail(account != NULL);
g_return_if_fail(name != NULL);
@@ -2046,6 +2048,11 @@ purple_account_set_int(PurpleAccount *ac
setting->value.integer = value;
g_hash_table_insert(account->settings, g_strdup(name), setting);
+
+ ui_ops = purple_accounts_get_ui_ops();
+
+ if (ui_ops != NULL && ui_ops->set_int != NULL)
+ ui_ops->set_int(account, name, value);
schedule_accounts_save();
}
@@ -2055,6 +2062,7 @@ purple_account_set_string(PurpleAccount
const char *value)
{
PurpleAccountSetting *setting;
+ PurpleAccountUiOps *ui_ops;
g_return_if_fail(account != NULL);
g_return_if_fail(name != NULL);
@@ -2065,6 +2073,11 @@ purple_account_set_string(PurpleAccount
setting->value.string = g_strdup(value);
g_hash_table_insert(account->settings, g_strdup(name), setting);
+
+ ui_ops = purple_accounts_get_ui_ops();
+
+ if (ui_ops != NULL && ui_ops->set_string != NULL)
+ ui_ops->set_string(account, name, value);
schedule_accounts_save();
}
@@ -2073,6 +2086,7 @@ void
purple_account_set_bool(PurpleAccount *account, const char *name, gboolean value)
{
PurpleAccountSetting *setting;
+ PurpleAccountUiOps *ui_ops;
g_return_if_fail(account != NULL);
g_return_if_fail(name != NULL);
@@ -2084,6 +2098,11 @@ purple_account_set_bool(PurpleAccount *a
g_hash_table_insert(account->settings, g_strdup(name), setting);
+ ui_ops = purple_accounts_get_ui_ops();
+
+ if (ui_ops != NULL && ui_ops->set_bool != NULL)
+ ui_ops->set_bool(account, name, value);
+
schedule_accounts_save();
}
@@ -2455,6 +2474,7 @@ purple_account_get_string(const PurpleAc
const char *default_value)
{
PurpleAccountSetting *setting;
+ const char *value;
g_return_val_if_fail(account != NULL, default_value);
g_return_val_if_fail(name != NULL, default_value);
@@ -2465,8 +2485,12 @@ purple_account_get_string(const PurpleAc
return default_value;
g_return_val_if_fail(setting->type == PURPLE_PREF_STRING, default_value);
-
- return setting->value.string;
+
+ value = setting->value.string;
+ if (value == NULL || !*value)
+ return default_value;
+
+ return value;
}
gboolean
diff --git a/libpurple/account.h b/libpurple/account.h
--- a/libpurple/account.h
+++ b/libpurple/account.h
@@ -115,6 +115,10 @@ struct _PurpleAccountUiOps
*/
void (*close_account_request)(void *ui_handle);
+ void (*set_int)(PurpleAccount *account, const char *name, int value);
+ void (*set_string)(PurpleAccount *account, const char *name, const char *value);
+ void (*set_bool)(PurpleAccount *account, const char *name, gboolean value);
+
void (*_purple_reserved1)(void);
void (*_purple_reserved2)(void);
void (*_purple_reserved3)(void);
More information about the Commits
mailing list