/soc/2013/ankitkv/gobjectification: 7adff7dc0f57: Refactored key...
Ankit Vani
a at nevitus.org
Mon Jul 29 06:32:14 EDT 2013
Changeset: 7adff7dc0f57240712c22aa290b90cf40c92306c
Author: Ankit Vani <a at nevitus.org>
Date: 2013-07-29 16:01 +0530
Branch: soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/7adff7dc0f57
Description:
Refactored keyring and log to use the initial GObject plugin API
diffstat:
libpurple/keyring.c | 9 +++++----
libpurple/log.c | 25 +++++++++++--------------
2 files changed, 16 insertions(+), 18 deletions(-)
diffs (105 lines):
diff --git a/libpurple/keyring.c b/libpurple/keyring.c
--- a/libpurple/keyring.c
+++ b/libpurple/keyring.c
@@ -1283,11 +1283,12 @@ purple_keyring_init(void)
for (it = purple_plugins_get_all(); it != NULL; it = it->next)
{
- PurplePlugin *plugin = (PurplePlugin *)it->data;
+ GPluginPlugin *plugin = GPLUGIN_PLUGIN(it->data);
+ GPluginPluginInfo *info = gplugin_plugin_get_info(plugin);
- if (plugin->info == NULL || plugin->info->id == NULL)
+ if (info == NULL || gplugin_plugin_info_get_id(info) == NULL)
continue;
- if (strncmp(plugin->info->id, "keyring-", 8) != 0)
+ if (strncmp(gplugin_plugin_info_get_id(info), "keyring-", 8) != 0)
continue;
if (purple_plugin_is_loaded(plugin))
@@ -1327,7 +1328,7 @@ purple_keyring_uninit(void)
for (it = g_list_first(purple_keyring_loaded_plugins); it != NULL;
it = g_list_next(it))
{
- PurplePlugin *plugin = (PurplePlugin *)it->data;
+ GPluginPlugin *plugin = GPLUGIN_PLUGIN(it->data);
if (g_list_find(purple_plugins_get_loaded(), plugin) == NULL)
continue;
purple_plugin_unload(plugin);
diff --git a/libpurple/log.c b/libpurple/log.c
--- a/libpurple/log.c
+++ b/libpurple/log.c
@@ -336,17 +336,16 @@ gboolean purple_log_delete(PurpleLog *lo
char *
purple_log_get_log_dir(PurpleLogType type, const char *name, PurpleAccount *account)
{
- PurplePlugin *prpl;
PurplePluginProtocolInfo *prpl_info;
const char *prpl_name;
char *acct_name;
const char *target;
char *dir;
- prpl = purple_find_protocol_info(purple_account_get_protocol_id(account));
- if (!prpl)
+ prpl_info = purple_find_protocol_info(purple_account_get_protocol_id(account));
+ if (!prpl_info)
return NULL;
- prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
prpl_name = prpl_info->list_icon(account, NULL);
acct_name = g_strdup(purple_escape_filename(purple_normalize(account,
@@ -1104,13 +1103,11 @@ static void log_get_log_sets_common(GHas
/* Find all the accounts for protocol. */
for (account_iter = purple_accounts_get_all() ; account_iter != NULL ; account_iter = account_iter->next) {
- PurplePlugin *prpl;
PurplePluginProtocolInfo *prpl_info;
- prpl = purple_find_protocol_info(purple_account_get_protocol_id((PurpleAccount *)account_iter->data));
- if (!prpl)
+ prpl_info = purple_find_protocol_info(purple_account_get_protocol_id((PurpleAccount *)account_iter->data));
+ if (!prpl_info)
continue;
- prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
if (purple_strequal(protocol_unescaped, prpl_info->list_icon((PurpleAccount *)account_iter->data, NULL)))
accounts = g_list_prepend(accounts, account_iter->data);
@@ -1406,13 +1403,13 @@ static gsize html_logger_write(PurpleLog
char *date;
char *header;
char *escaped_from;
- PurplePlugin *plugin = purple_find_protocol_info(purple_account_get_protocol_id(log->account));
+ PurplePluginProtocolInfo *prpl_info =
+ purple_find_protocol_info(purple_account_get_protocol_id(log->account));
PurpleLogCommonLoggerData *data = log->logger_data;
gsize written = 0;
if(!data) {
- const char *prpl =
- PURPLE_PLUGIN_PROTOCOL_INFO(plugin)->list_icon(log->account, NULL);
+ const char *prpl = prpl_info->list_icon(log->account, NULL);
const char *date;
purple_log_common_writer(log, ".html");
@@ -1561,7 +1558,8 @@ static gsize txt_logger_write(PurpleLog
const char *from, time_t time, const char *message)
{
char *date;
- PurplePlugin *plugin = purple_find_protocol_info(purple_account_get_protocol_id(log->account));
+ PurplePluginProtocolInfo *prpl_info =
+ purple_find_protocol_info(purple_account_get_protocol_id(log->account));
PurpleLogCommonLoggerData *data = log->logger_data;
char *stripped = NULL;
@@ -1572,8 +1570,7 @@ static gsize txt_logger_write(PurpleLog
* creating a new file there would result in empty files in the case
* that you open a convo with someone, but don't say anything.
*/
- const char *prpl =
- PURPLE_PLUGIN_PROTOCOL_INFO(plugin)->list_icon(log->account, NULL);
+ const char *prpl = prpl_info->list_icon(log->account, NULL);
purple_log_common_writer(log, ".txt");
data = log->logger_data;
More information about the Commits
mailing list