/soc/2013/ankitkv/gobjectification: 60c161851325: Integrated pur...

Ankit Vani a at nevitus.org
Sun Aug 11 08:14:27 EDT 2013


Changeset: 60c161851325093e8765049246d131021ed0bff2
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-08-11 17:44 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/60c161851325

Description:

Integrated purple ABI requirement into GPlugin's "abi-version" property

diffstat:

 libpurple/plugins.c                          |  25 ++++++-------------------
 libpurple/plugins.h                          |  13 ++++++++-----
 libpurple/plugins/keyrings/gnomekeyring.c    |   2 +-
 libpurple/plugins/keyrings/internalkeyring.c |   2 +-
 libpurple/plugins/keyrings/kwallet.cpp       |   2 +-
 libpurple/plugins/keyrings/secretservice.c   |   2 +-
 libpurple/plugins/keyrings/wincred.c         |   2 +-
 libpurple/plugins/ssl/ssl-gnutls.c           |   2 +-
 libpurple/plugins/ssl/ssl-nss.c              |   2 +-
 libpurple/plugins/ssl/ssl.c                  |   2 +-
 libpurple/protocols/jabber/libfacebook.c     |   2 +-
 libpurple/protocols/jabber/libgtalk.c        |   2 +-
 libpurple/protocols/jabber/libxmpp.c         |   2 +-
 libpurple/protocols/null/nullprpl.c          |   2 +-
 14 files changed, 26 insertions(+), 36 deletions(-)

diffs (267 lines):

diff --git a/libpurple/plugins.c b/libpurple/plugins.c
--- a/libpurple/plugins.c
+++ b/libpurple/plugins.c
@@ -35,7 +35,6 @@ typedef struct _PurplePluginInfoPrivate 
  * Plugin info private data
  **************************************************************************/
 struct _PurplePluginInfoPrivate {
-	guint32 purple_abi;    /**< ABI version of purple required by the plugin */
 	char *ui_requirement;  /**< ID of UI that is required to load the plugin */
 	gboolean loadable;     /**< Whether the plugin is loadable               */
 	char *error;           /**< Why the plugin is not loadable               */
@@ -54,7 +53,6 @@ struct _PurplePluginInfoPrivate {
 enum
 {
 	PROP_0,
-	PROP_PURPLE_ABI,
 	PROP_UI_REQUIREMENT,
 	PROP_GET_ACTIONS,
 	PROP_PREFERENCES_FRAME,
@@ -312,7 +310,6 @@ purple_plugin_get_dependent_plugins(cons
  * GObject code for PurplePluginInfo
  **************************************************************************/
 /* GObject Property names */
-#define PROP_PURPLE_ABI_S         "purple-abi"
 #define PROP_UI_REQUIREMENT_S     "ui-requirement"
 #define PROP_GET_ACTIONS_S        "get-actions"
 #define PROP_PREFERENCES_FRAME_S  "preferences-frame"
@@ -326,9 +323,6 @@ purple_plugin_info_set_property(GObject 
 	PurplePluginInfoPrivate *priv = PURPLE_PLUGIN_INFO_GET_PRIVATE(info);
 
 	switch (param_id) {
-		case PROP_PURPLE_ABI:
-			priv->purple_abi = g_value_get_uint(value);
-			break;
 		case PROP_UI_REQUIREMENT:
 			priv->ui_requirement = g_strdup(g_value_get_string(value));
 			break;
@@ -352,9 +346,6 @@ purple_plugin_info_get_property(GObject 
 	PurplePluginInfo *info = PURPLE_PLUGIN_INFO(obj);
 
 	switch (param_id) {
-		case PROP_PURPLE_ABI:
-			g_value_set_uint(value, purple_plugin_info_get_abi_version(info));
-			break;
 		case PROP_GET_ACTIONS:
 			g_value_set_pointer(value,
 					purple_plugin_info_get_actions_callback(info));
@@ -443,13 +434,6 @@ static void purple_plugin_info_class_ini
 	obj_class->get_property = purple_plugin_info_get_property;
 	obj_class->set_property = purple_plugin_info_set_property;
 
-	g_object_class_install_property(obj_class, PROP_PURPLE_ABI,
-		g_param_spec_uint(PROP_PURPLE_ABI_S,
-		                  "ABI version",
-		                  "The libpurple ABI version required by the plugin",
-		                  0, G_MAXUINT32, 0,
-		                  G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-
 	g_object_class_install_property(obj_class, PROP_UI_REQUIREMENT,
 		g_param_spec_string(PROP_UI_REQUIREMENT_S,
 		                  "UI Requirement",
@@ -673,11 +657,14 @@ purple_plugin_info_get_license_url(const
 guint32
 purple_plugin_info_get_abi_version(const PurplePluginInfo *info)
 {
-	PurplePluginInfoPrivate *priv = PURPLE_PLUGIN_INFO_GET_PRIVATE(info);
+#ifdef PURPLE_PLUGINS
+	g_return_val_if_fail(info != NULL, 0);
 
-	g_return_val_if_fail(priv != NULL, 0);
+	return gplugin_plugin_info_get_abi_version(GPLUGIN_PLUGIN_INFO(info));
 
-	return priv->purple_abi;
+#else
+	return 0;
+#endif
 }
 
 PurplePluginGetActionsCallback
diff --git a/libpurple/plugins.h b/libpurple/plugins.h
--- a/libpurple/plugins.h
+++ b/libpurple/plugins.h
@@ -69,6 +69,7 @@ typedef GPluginPluginClass PurplePluginC
 #define PURPLE_IS_PLUGIN_CLASS(klass)  G_IS_OBJECT_CLASS(klass)
 #define PURPLE_PLUGIN_GET_CLASS(obj)   G_OBJECT_GET_CLASS(obj)
 
+#define GPLUGIN_NATIVE_ABI_VERSION              0
 #define GPLUGIN_PLUGIN_INFO_FLAGS_LOAD_ON_QUERY 0
 #define GPLUGIN_PLUGIN_INFO_FLAGS_INTERNAL      0
 
@@ -145,17 +146,19 @@ struct _PurplePluginAction {
 };
 
 /** Returns an ABI version to set in plugins using major and minor versions */
-#define PURPLE_PLUGIN_ABI_VERSION(major,minor) ((major << 16) + minor)
+#define PURPLE_PLUGIN_ABI_VERSION(major,minor) (0x01000000 | \
+                                               ((major) << 16) | (minor))
+
 /** Returns the major version from an ABI version */
-#define PURPLE_PLUGIN_ABI_MAJOR_VERSION(abi)   (abi >> 16)
+#define PURPLE_PLUGIN_ABI_MAJOR_VERSION(abi)   ((abi >> 16) & 0xff)
 /** Returns the minor version from an ABI version */
-#define PURPLE_PLUGIN_ABI_MINOR_VERSION(abi)   (abi & 0xFFFF)
+#define PURPLE_PLUGIN_ABI_MINOR_VERSION(abi)   (abi & 0xffff)
 
 /**
   * A convenience‎ macro that returns an ABI version using PURPLE_MAJOR_VERSION
   * and PURPLE_MINOR_VERSION
   */
-#define PURPLE_ABI_VERSION PURPLE_PLUGIN_ABI_VERSION(PURPLE_MAJOR_VERSION,\
+#define PURPLE_ABI_VERSION PURPLE_PLUGIN_ABI_VERSION(PURPLE_MAJOR_VERSION, \
                                                      PURPLE_MINOR_VERSION)
 
 /**
@@ -378,7 +381,7 @@ GType purple_plugin_info_get_type(void);
  *                               SPDX.                                       \n
  * "dependencies"       (string) Comma-seperated list of plugin IDs required
  *                               by the plugin.                              \n
- * "purple-abi"         (guint32) The purple ABI version required by plugin. \n
+ * "abi-version"        (guint32) The ABI version required by the plugin.    \n
  * "get-actions"        (PurplePluginGetActionsCallback) Callback that
  *                               returns a list of actions the plugin can
  *                               perform.                                    \n
diff --git a/libpurple/plugins/keyrings/gnomekeyring.c b/libpurple/plugins/keyrings/gnomekeyring.c
--- a/libpurple/plugins/keyrings/gnomekeyring.c
+++ b/libpurple/plugins/keyrings/gnomekeyring.c
@@ -390,7 +390,7 @@ plugin_query(GError **error)
 		"description",  GNOMEKEYRING_DESCRIPTION,
 		"author",       GNOMEKEYRING_AUTHOR,
 		"website",      PURPLE_WEBSITE,
-		"purple-abi",   PURPLE_ABI_VERSION,
+		"abi-version",  PURPLE_ABI_VERSION,
 		"flags",        GPLUGIN_PLUGIN_INFO_FLAGS_INTERNAL,
 		NULL
 	);
diff --git a/libpurple/plugins/keyrings/internalkeyring.c b/libpurple/plugins/keyrings/internalkeyring.c
--- a/libpurple/plugins/keyrings/internalkeyring.c
+++ b/libpurple/plugins/keyrings/internalkeyring.c
@@ -967,7 +967,7 @@ plugin_query(GError **error)
 		"description",  INTKEYRING_DESCRIPTION,
 		"author",       INTKEYRING_AUTHOR,
 		"website",      PURPLE_WEBSITE,
-		"purple-abi",   PURPLE_ABI_VERSION,
+		"abi-version",  PURPLE_ABI_VERSION,
 		"flags",        GPLUGIN_PLUGIN_INFO_FLAGS_INTERNAL,
 		NULL
 	);
diff --git a/libpurple/plugins/keyrings/kwallet.cpp b/libpurple/plugins/keyrings/kwallet.cpp
--- a/libpurple/plugins/keyrings/kwallet.cpp
+++ b/libpurple/plugins/keyrings/kwallet.cpp
@@ -501,7 +501,7 @@ plugin_query(GError **error)
 		"description",  KWALLET_DESCRIPTION,
 		"author",       KWALLET_AUTHOR,
 		"website",      PURPLE_WEBSITE,
-		"purple-abi",   PURPLE_ABI_VERSION,
+		"abi-version",  PURPLE_ABI_VERSION,
 		"flags",        GPLUGIN_PLUGIN_INFO_FLAGS_INTERNAL,
 		NULL
 	);
diff --git a/libpurple/plugins/keyrings/secretservice.c b/libpurple/plugins/keyrings/secretservice.c
--- a/libpurple/plugins/keyrings/secretservice.c
+++ b/libpurple/plugins/keyrings/secretservice.c
@@ -294,7 +294,7 @@ plugin_query(GError **error)
 		"description",  N_("This plugin will store passwords in Secret Service."),
 		"author",       "Elliott Sales de Andrade (qulogic[at]pidgin.im)",
 		"website",      PURPLE_WEBSITE,
-		"purple-abi",   PURPLE_ABI_VERSION,
+		"abi-version",  PURPLE_ABI_VERSION,
 		"flags",        GPLUGIN_PLUGIN_INFO_FLAGS_INTERNAL,
 		NULL
 	);
diff --git a/libpurple/plugins/keyrings/wincred.c b/libpurple/plugins/keyrings/wincred.c
--- a/libpurple/plugins/keyrings/wincred.c
+++ b/libpurple/plugins/keyrings/wincred.c
@@ -268,7 +268,7 @@ plugin_query(GError **error)
 		"description",  WINCRED_DESCRIPTION,
 		"author",       WINCRED_AUTHOR,
 		"website",      PURPLE_WEBSITE,
-		"purple-abi",   PURPLE_ABI_VERSION,
+		"abi-version",  PURPLE_ABI_VERSION,
 		"flags",        GPLUGIN_PLUGIN_INFO_FLAGS_INTERNAL,
 		NULL
 	);
diff --git a/libpurple/plugins/ssl/ssl-gnutls.c b/libpurple/plugins/ssl/ssl-gnutls.c
--- a/libpurple/plugins/ssl/ssl-gnutls.c
+++ b/libpurple/plugins/ssl/ssl-gnutls.c
@@ -1287,7 +1287,7 @@ plugin_query(GError **error)
 		"description",  N_("Provides SSL support through GNUTLS."),
 		"author",       "Christian Hammond <chipx86 at gnupdate.org>",
 		"website",      PURPLE_WEBSITE,
-		"purple-abi",   PURPLE_ABI_VERSION,
+		"abi-version",  PURPLE_ABI_VERSION,
 		"flags",        GPLUGIN_PLUGIN_INFO_FLAGS_INTERNAL,
 		NULL
 	);
diff --git a/libpurple/plugins/ssl/ssl-nss.c b/libpurple/plugins/ssl/ssl-nss.c
--- a/libpurple/plugins/ssl/ssl-nss.c
+++ b/libpurple/plugins/ssl/ssl-nss.c
@@ -1065,7 +1065,7 @@ plugin_query(GError **error)
 		"description",  N_("Provides SSL support through Mozilla NSS."),
 		"author",       "Christian Hammond <chipx86 at gnupdate.org>",
 		"website",      PURPLE_WEBSITE,
-		"purple-abi",   PURPLE_ABI_VERSION,
+		"abi-version",  PURPLE_ABI_VERSION,
 		"flags",        GPLUGIN_PLUGIN_INFO_FLAGS_INTERNAL,
 		NULL
 	);
diff --git a/libpurple/plugins/ssl/ssl.c b/libpurple/plugins/ssl/ssl.c
--- a/libpurple/plugins/ssl/ssl.c
+++ b/libpurple/plugins/ssl/ssl.c
@@ -82,7 +82,7 @@ plugin_query(GError **error)
 		"description",  N_("Provides a wrapper around SSL support libraries."),
 		"author",       "Christian Hammond <chipx86 at gnupdate.org>",
 		"website",      PURPLE_WEBSITE,
-		"purple-abi",   PURPLE_ABI_VERSION,
+		"abi-version",  PURPLE_ABI_VERSION,
 		"flags",        GPLUGIN_PLUGIN_INFO_FLAGS_INTERNAL,
 		NULL
 	);
diff --git a/libpurple/protocols/jabber/libfacebook.c b/libpurple/protocols/jabber/libfacebook.c
--- a/libpurple/protocols/jabber/libfacebook.c
+++ b/libpurple/protocols/jabber/libfacebook.c
@@ -214,7 +214,7 @@ plugin_query(GError **error)
 		"summary",      N_("Facebook XMPP Protocol Plugin"),
 		"description",  N_("Facebook XMPP Protocol Plugin"),
 		"website",      PURPLE_WEBSITE,
-		"purple-abi",   PURPLE_ABI_VERSION,
+		"abi-version",  PURPLE_ABI_VERSION,
 		"flags",        GPLUGIN_PLUGIN_INFO_FLAGS_INTERNAL |
 		                GPLUGIN_PLUGIN_INFO_FLAGS_LOAD_ON_QUERY,
 		NULL
diff --git a/libpurple/protocols/jabber/libgtalk.c b/libpurple/protocols/jabber/libgtalk.c
--- a/libpurple/protocols/jabber/libgtalk.c
+++ b/libpurple/protocols/jabber/libgtalk.c
@@ -214,7 +214,7 @@ plugin_query(GError **error)
 		"summary",      N_("Google Talk Protocol Plugin"),
 		"description",  N_("Google Talk Protocol Plugin"),
 		"website",      PURPLE_WEBSITE,
-		"purple-abi",   PURPLE_ABI_VERSION,
+		"abi-version",  PURPLE_ABI_VERSION,
 		"flags",        GPLUGIN_PLUGIN_INFO_FLAGS_INTERNAL |
 		                GPLUGIN_PLUGIN_INFO_FLAGS_LOAD_ON_QUERY,
 		NULL
diff --git a/libpurple/protocols/jabber/libxmpp.c b/libpurple/protocols/jabber/libxmpp.c
--- a/libpurple/protocols/jabber/libxmpp.c
+++ b/libpurple/protocols/jabber/libxmpp.c
@@ -208,7 +208,7 @@ plugin_query(GError **error)
 		"summary",      N_("XMPP Protocol Plugin"),
 		"description",  N_("XMPP Protocol Plugin"),
 		"website",      PURPLE_WEBSITE,
-		"purple-abi",   PURPLE_ABI_VERSION,
+		"abi-version",  PURPLE_ABI_VERSION,
 		"flags",        GPLUGIN_PLUGIN_INFO_FLAGS_INTERNAL |
 		                GPLUGIN_PLUGIN_INFO_FLAGS_LOAD_ON_QUERY,
 		NULL
diff --git a/libpurple/protocols/null/nullprpl.c b/libpurple/protocols/null/nullprpl.c
--- a/libpurple/protocols/null/nullprpl.c
+++ b/libpurple/protocols/null/nullprpl.c
@@ -1151,7 +1151,7 @@ plugin_query(GError **error)
     "summary",      N_("Null Protocol Plugin"),
     "description",  N_("Null Protocol Plugin"),
     "website",      PURPLE_WEBSITE,
-    "purple-abi",   PURPLE_ABI_VERSION,
+    "abi-version",  PURPLE_ABI_VERSION,
 
     /* If you're using this as the basis of a protocol plugin that will be
      * distributed separately from libpurple, do not include these flags.*/



More information about the Commits mailing list