/soc/2013/ankitkv/gobjectification: 0e67a57e7077: Refactored uti...

Ankit Vani a at nevitus.org
Mon Jul 29 02:53:33 EDT 2013


Changeset: 0e67a57e7077738ae72663eb55e100538548791a
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-07-29 12:23 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/0e67a57e7077

Description:

Refactored util to use PurplePluginProtocolInfo instead of prpl

diffstat:

 libpurple/util.c |  19 ++++++-------------
 libpurple/util.h |   4 ++--
 2 files changed, 8 insertions(+), 15 deletions(-)

diffs (65 lines):

diff --git a/libpurple/util.c b/libpurple/util.c
--- a/libpurple/util.c
+++ b/libpurple/util.c
@@ -3389,15 +3389,11 @@ purple_normalize(const PurpleAccount *ac
 
 	if (account != NULL)
 	{
-		PurplePlugin *prpl = purple_find_protocol_info(purple_account_get_protocol_id(account));
-
-		if (prpl != NULL)
-		{
-			PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
-
-			if (prpl_info->normalize)
-				ret = prpl_info->normalize(account, str);
-		}
+		PurplePluginProtocolInfo *prpl_info =
+				purple_find_protocol_info(purple_account_get_protocol_id(account));
+
+		if (prpl_info != NULL && prpl_info->normalize)
+			ret = prpl_info->normalize(account, str);
 	}
 
 	if (ret == NULL)
@@ -3437,9 +3433,8 @@ purple_normalize_nocase(const PurpleAcco
 }
 
 gboolean
-purple_validate(const PurplePlugin *prpl, const char *str)
+purple_validate(const PurplePluginProtocolInfo *prpl_info, const char *str)
 {
-	PurplePluginProtocolInfo *prpl_info;
 	const char *normalized;
 
 	g_return_val_if_fail(prpl != NULL, FALSE);
@@ -3448,8 +3443,6 @@ purple_validate(const PurplePlugin *prpl
 	if (str[0] == '\0')
 		return FALSE;
 
-	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
-
 	if (!prpl_info->normalize)
 		return TRUE;
 
diff --git a/libpurple/util.h b/libpurple/util.h
--- a/libpurple/util.h
+++ b/libpurple/util.h
@@ -50,7 +50,7 @@ typedef struct _PurpleKeyValuePair Purpl
 #include "signals.h"
 #include "xmlnode.h"
 #include "notify.h"
-#include "plugins.h"
+#include "prpl.h"
 
 
 typedef char *(*PurpleInfoFieldFormatCallback)(const char *field, size_t len);
@@ -961,7 +961,7 @@ const char *purple_normalize_nocase(cons
  *
  * @return TRUE, if string is valid, otherwise FALSE.
  */
-gboolean purple_validate(const PurplePlugin *prpl, const char *str);
+gboolean purple_validate(const PurplePluginProtocolInfo *prpl_info, const char *str);
 
 /**
  * Compares two strings to see if the first contains the second as



More information about the Commits mailing list