/soc/2013/ankitkv/gobjectification: 9e68a23150cf: Replaced purpl...

Ankit Vani a at nevitus.org
Sun Jul 28 14:24:43 EDT 2013


Changeset: 9e68a23150cf2cae6d235faf89209fcc21592140
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-07-28 23:36 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/9e68a23150cf

Description:

Replaced purple_find_prpl() with purple_find_protocol_info().
* Changed its return type from PurplePlugin * to PurplePluginProtocolInfo *
* Added id to PurplePluginProtocolInfo

diffstat:

 finch/gntblist.c                      |   4 ++--
 finch/gntlog.c                        |   2 +-
 libpurple/account.c                   |   6 +++---
 libpurple/blistnodetypes.c            |   4 ++--
 libpurple/buddylist.c                 |   2 +-
 libpurple/connection.c                |   4 ++--
 libpurple/conversation.c              |   2 +-
 libpurple/log.c                       |   8 ++++----
 libpurple/plugins/idle.c              |   2 +-
 libpurple/plugins/log_reader.c        |   6 +++---
 libpurple/plugins/perl/common/Prpl.xs |   2 +-
 libpurple/prpl.c                      |   8 ++++----
 libpurple/prpl.h                      |   6 ++++--
 libpurple/server.c                    |   2 +-
 libpurple/util.c                      |   2 +-
 pidgin/gtkaccount.c                   |  10 +++++-----
 pidgin/gtkblist.c                     |  18 +++++++++---------
 pidgin/gtkconv.c                      |   6 +++---
 pidgin/gtkdialogs.c                   |   2 +-
 pidgin/gtklog.c                       |   2 +-
 pidgin/gtkstatusbox.c                 |   4 ++--
 pidgin/gtkthemes.c                    |   2 +-
 pidgin/gtkutils.c                     |   2 +-
 pidgin/plugins/xmppconsole.c          |   2 +-
 pidgin/smileyparser.c                 |   2 +-
 25 files changed, 56 insertions(+), 54 deletions(-)

diffs (truncated from 559 to 300 lines):

diff --git a/finch/gntblist.c b/finch/gntblist.c
--- a/finch/gntblist.c
+++ b/finch/gntblist.c
@@ -1414,7 +1414,7 @@ static void showlog_cb(PurpleBlistNode *
 		PurplePluginProtocolInfo *prpl_info = NULL;
 		type = PURPLE_LOG_CHAT;
 		account = purple_chat_get_account(c);
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_find_prpl(purple_account_get_protocol_id(account)));
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_find_protocol_info(purple_account_get_protocol_id(account)));
 		if (prpl_info && prpl_info->get_chat_name) {
 			name = prpl_info->get_chat_name(purple_chat_get_components(c));
 		}
@@ -1737,7 +1737,7 @@ tooltip_for_buddy(PurpleBuddy *buddy, GS
 	purple_notify_user_info_add_pair_plaintext(user_info, _("Account"), tmp);
 	g_free(tmp);
 
-	prpl = purple_find_prpl(purple_account_get_protocol_id(account));
+	prpl = purple_find_protocol_info(purple_account_get_protocol_id(account));
 	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 	if (prpl_info && prpl_info->tooltip_text) {
 		prpl_info->tooltip_text(buddy, user_info, full);
diff --git a/finch/gntlog.c b/finch/gntlog.c
--- a/finch/gntlog.c
+++ b/finch/gntlog.c
@@ -505,7 +505,7 @@ void finch_syslog_show()
 	for(accounts = purple_accounts_get_all(); accounts != NULL; accounts = accounts->next) {
 
 		PurpleAccount *account = (PurpleAccount *)accounts->data;
-		if(purple_find_prpl(purple_account_get_protocol_id(account)) == NULL)
+		if(purple_find_protocol_info(purple_account_get_protocol_id(account)) == NULL)
 			continue;
 
 		logs = g_list_concat(purple_log_get_system_logs(account), logs);
diff --git a/libpurple/account.c b/libpurple/account.c
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -324,7 +324,7 @@ purple_account_connect(PurpleAccount *ac
 		return;
 	}
 
-	prpl = purple_find_prpl(purple_account_get_protocol_id(account));
+	prpl = purple_find_protocol_info(purple_account_get_protocol_id(account));
 	if (prpl == NULL) {
 		gchar *message;
 
@@ -1433,7 +1433,7 @@ purple_account_get_protocol_name(const P
 
 	g_return_val_if_fail(account != NULL, NULL);
 
-	p = purple_find_prpl(purple_account_get_protocol_id(account));
+	p = purple_find_protocol_info(purple_account_get_protocol_id(account));
 
 	return ((p && p->info->name) ? _(p->info->name) : _("Unknown"));
 }
@@ -2920,7 +2920,7 @@ purple_account_constructed(GObject *obje
 	purple_signal_emit(purple_accounts_get_handle(), "account-created",
 			account);
 
-	prpl = purple_find_prpl(protocol_id);
+	prpl = purple_find_protocol_info(protocol_id);
 	if (prpl == NULL) {
 		g_free(username);
 		g_free(protocol_id);
diff --git a/libpurple/blistnodetypes.c b/libpurple/blistnodetypes.c
--- a/libpurple/blistnodetypes.c
+++ b/libpurple/blistnodetypes.c
@@ -635,7 +635,7 @@ purple_buddy_dispose(GObject *object)
 	 * Tell the owner PRPL that we're about to free the buddy so it
 	 * can free proto_data
 	 */
-	prpl = purple_find_prpl(purple_account_get_protocol_id(priv->account));
+	prpl = purple_find_protocol_info(purple_account_get_protocol_id(priv->account));
 	if (prpl) {
 		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 		if (prpl_info && prpl_info->buddy_free)
@@ -1125,7 +1125,7 @@ const char *purple_chat_get_name_only(Pu
 
 	g_return_val_if_fail(priv != NULL, NULL);
 
-	prpl = purple_find_prpl(purple_account_get_protocol_id(priv->account));
+	prpl = purple_find_protocol_info(purple_account_get_protocol_id(priv->account));
 	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 
 	if (prpl_info->chat_info) {
diff --git a/libpurple/buddylist.c b/libpurple/buddylist.c
--- a/libpurple/buddylist.c
+++ b/libpurple/buddylist.c
@@ -1635,7 +1635,7 @@ purple_blist_find_chat(PurpleAccount *ac
 	if (!purple_account_is_connected(account))
 		return NULL;
 
-	prpl = purple_find_prpl(purple_account_get_protocol_id(account));
+	prpl = purple_find_protocol_info(purple_account_get_protocol_id(account));
 	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 
 	if (prpl_info->find_blist_chat != NULL)
diff --git a/libpurple/connection.c b/libpurple/connection.c
--- a/libpurple/connection.c
+++ b/libpurple/connection.c
@@ -873,7 +873,7 @@ void
 	if (!purple_account_is_disconnected(account))
 		return;
 
-	prpl = purple_find_prpl(purple_account_get_protocol_id(account));
+	prpl = purple_find_protocol_info(purple_account_get_protocol_id(account));
 
 	if (prpl != NULL)
 		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
@@ -940,7 +940,7 @@ void
 
 	g_return_if_fail(account != NULL);
 
-	prpl = purple_find_prpl(purple_account_get_protocol_id(account));
+	prpl = purple_find_protocol_info(purple_account_get_protocol_id(account));
 
 	if (prpl != NULL)
 		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
diff --git a/libpurple/conversation.c b/libpurple/conversation.c
--- a/libpurple/conversation.c
+++ b/libpurple/conversation.c
@@ -528,7 +528,7 @@ purple_conversation_write(PurpleConversa
 	}
 
 	if (account != NULL) {
-		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_find_prpl(purple_account_get_protocol_id(account)));
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_find_protocol_info(purple_account_get_protocol_id(account)));
 
 		if (PURPLE_IS_IM_CONVERSATION(conv) ||
 			!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) {
diff --git a/libpurple/log.c b/libpurple/log.c
--- a/libpurple/log.c
+++ b/libpurple/log.c
@@ -343,7 +343,7 @@ purple_log_get_log_dir(PurpleLogType typ
 	const char *target;
 	char *dir;
 
-	prpl = purple_find_prpl(purple_account_get_protocol_id(account));
+	prpl = purple_find_protocol_info(purple_account_get_protocol_id(account));
 	if (!prpl)
 		return NULL;
 	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
@@ -1107,7 +1107,7 @@ static void log_get_log_sets_common(GHas
 			PurplePlugin *prpl;
 			PurplePluginProtocolInfo *prpl_info;
 
-			prpl = purple_find_prpl(purple_account_get_protocol_id((PurpleAccount *)account_iter->data));
+			prpl = purple_find_protocol_info(purple_account_get_protocol_id((PurpleAccount *)account_iter->data));
 			if (!prpl)
 				continue;
 			prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
@@ -1406,7 +1406,7 @@ static gsize html_logger_write(PurpleLog
 	char *date;
 	char *header;
 	char *escaped_from;
-	PurplePlugin *plugin = purple_find_prpl(purple_account_get_protocol_id(log->account));
+	PurplePlugin *plugin = purple_find_protocol_info(purple_account_get_protocol_id(log->account));
 	PurpleLogCommonLoggerData *data = log->logger_data;
 	gsize written = 0;
 
@@ -1561,7 +1561,7 @@ static gsize txt_logger_write(PurpleLog 
 							 const char *from, time_t time, const char *message)
 {
 	char *date;
-	PurplePlugin *plugin = purple_find_prpl(purple_account_get_protocol_id(log->account));
+	PurplePlugin *plugin = purple_find_protocol_info(purple_account_get_protocol_id(log->account));
 	PurpleLogCommonLoggerData *data = log->logger_data;
 	char *stripped = NULL;
 
diff --git a/libpurple/plugins/idle.c b/libpurple/plugins/idle.c
--- a/libpurple/plugins/idle.c
+++ b/libpurple/plugins/idle.c
@@ -53,7 +53,7 @@ idleable_filter(PurpleAccount *account)
 {
 	PurplePlugin *prpl;
 
-	prpl = purple_find_prpl(purple_account_get_protocol_id(account));
+	prpl = purple_find_protocol_info(purple_account_get_protocol_id(account));
 	g_return_val_if_fail(prpl != NULL, FALSE);
 
 	return (PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->set_idle != NULL);
diff --git a/libpurple/plugins/log_reader.c b/libpurple/plugins/log_reader.c
--- a/libpurple/plugins/log_reader.c
+++ b/libpurple/plugins/log_reader.c
@@ -82,7 +82,7 @@ static GList *adium_logger_list(PurpleLo
 	if (!logdir || !*logdir)
 		return NULL;
 
-	plugin = purple_find_prpl(purple_account_get_protocol_id(account));
+	plugin = purple_find_protocol_info(purple_account_get_protocol_id(account));
 	if (!plugin)
 		return NULL;
 
@@ -1226,7 +1226,7 @@ static GList *trillian_logger_list(Purpl
 	if (!logdir || !*logdir)
 		return NULL;
 
-	plugin = purple_find_prpl(purple_account_get_protocol_id(account));
+	plugin = purple_find_protocol_info(purple_account_get_protocol_id(account));
 	if (!plugin)
 		return NULL;
 
@@ -1786,7 +1786,7 @@ static GList *qip_logger_list(PurpleLogT
 	if (!logdir || !*logdir)
 		return NULL;
 
-	plugin = purple_find_prpl(purple_account_get_protocol_id(account));
+	plugin = purple_find_protocol_info(purple_account_get_protocol_id(account));
 	if (!plugin)
 		return NULL;
 
diff --git a/libpurple/plugins/perl/common/Prpl.xs b/libpurple/plugins/perl/common/Prpl.xs
--- a/libpurple/plugins/perl/common/Prpl.xs
+++ b/libpurple/plugins/perl/common/Prpl.xs
@@ -4,7 +4,7 @@ MODULE = Purple::Prpl  PACKAGE = Purple:
 PROTOTYPES: ENABLE
 
 Purple::Plugin
-purple_find_prpl(id)
+purple_find_protocol_info(id)
 	const char *id
 
 MODULE = Purple::Prpl  PACKAGE = Purple::Prpl  PREFIX = purple_prpl_
diff --git a/libpurple/prpl.c b/libpurple/prpl.c
--- a/libpurple/prpl.c
+++ b/libpurple/prpl.c
@@ -373,7 +373,7 @@ do_prpl_change_account_status(PurpleAcco
 		 */
 		return;
 
-	prpl = purple_find_prpl(purple_account_get_protocol_id(account));
+	prpl = purple_find_protocol_info(purple_account_get_protocol_id(account));
 
 	if (prpl == NULL)
 		return;
@@ -447,7 +447,7 @@ purple_prpl_send_attention(PurpleConnect
 	g_return_if_fail(gc != NULL);
 	g_return_if_fail(who != NULL);
 
-	prpl = purple_find_prpl(purple_account_get_protocol_id(purple_connection_get_account(gc)));
+	prpl = purple_find_protocol_info(purple_account_get_protocol_id(purple_connection_get_account(gc)));
 	send_attention = PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention;
 	g_return_if_fail(send_attention != NULL);
 
@@ -630,8 +630,8 @@ purple_prpl_got_media_caps(PurpleAccount
  * Protocol Plugin Subsystem API
  **************************************************************************/
 
-PurplePlugin *
-purple_find_prpl(const char *id)
+PurplePluginProtocolInfo *
+purple_find_protocol_info(const char *id)
 {
 	GList *l;
 	PurplePlugin *plugin;
diff --git a/libpurple/prpl.h b/libpurple/prpl.h
--- a/libpurple/prpl.h
+++ b/libpurple/prpl.h
@@ -218,6 +218,8 @@ typedef enum
  */
 struct _PurplePluginProtocolInfo
 {
+	const char *id;
+
 	/**
 	 * The size of the PurplePluginProtocolInfo. This should always be sizeof(PurplePluginProtocolInfo).
 	 * This allows adding more functions to this struct without requiring a major version bump.
@@ -954,11 +956,11 @@ void purple_prpl_got_media_caps(PurpleAc
 /*@{*/
 
 /**
- * Finds a protocol plugin structure of the specified type.
+ * Finds a protocol plugin info structure of the specified type.
  *
  * @param id The protocol plugin;
  */
-PurplePlugin *purple_find_prpl(const char *id);
+PurplePluginProtocolInfo *purple_find_protocol_info(const char *id);
 
 /*@}*/
 
diff --git a/libpurple/server.c b/libpurple/server.c
--- a/libpurple/server.c
+++ b/libpurple/server.c
@@ -308,7 +308,7 @@ PurpleAttentionType *purple_get_attentio
 
 	g_return_val_if_fail(account != NULL, NULL);
 
-	prpl = purple_find_prpl(purple_account_get_protocol_id(account));
+	prpl = purple_find_protocol_info(purple_account_get_protocol_id(account));
 
 	/* Lookup the attention type in the protocol's attention_types list, if any. */
 	get_attention_types = PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->get_attention_types;
diff --git a/libpurple/util.c b/libpurple/util.c
--- a/libpurple/util.c
+++ b/libpurple/util.c
@@ -3389,7 +3389,7 @@ purple_normalize(const PurpleAccount *ac
 
 	if (account != NULL)
 	{
-		PurplePlugin *prpl = purple_find_prpl(purple_account_get_protocol_id(account));



More information about the Commits mailing list