/soc/2013/ankitkv/gobjectification: 19adace8b7a9: Started refact...

Ankit Vani a at nevitus.org
Wed Sep 18 05:57:49 EDT 2013


Changeset: 19adace8b7a9fdbef6d0c041debd0083625b9b94
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-09-18 15:27 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/19adace8b7a9

Description:

Started refactoring perl loader

diffstat:

 libpurple/plugins/perl/Makefile.am |   3 +-
 libpurple/plugins/perl/perl.c      |  88 +++++++++++++++----------------------
 2 files changed, 37 insertions(+), 54 deletions(-)

diffs (134 lines):

diff --git a/libpurple/plugins/perl/Makefile.am b/libpurple/plugins/perl/Makefile.am
--- a/libpurple/plugins/perl/Makefile.am
+++ b/libpurple/plugins/perl/Makefile.am
@@ -5,7 +5,7 @@ perl_dirs = common
 plugin_LTLIBRARIES = perl.la
 
 perl_la_LDFLAGS = -module -avoid-version
-perl_la_LIBADD = $(GLIB_LIBS) $(PERL_LIBS)
+perl_la_LIBADD = $(GLIB_LIBS) $(GPLUGIN_LIBS) $(PERL_LIBS)
 perl_la_SOURCES = \
 	perl.c \
 	perl-common.c \
@@ -167,6 +167,7 @@ AM_CPPFLAGS = \
 	-DLIBDIR=\"$(libdir)/purple-$(PURPLE_MAJOR_VERSION)\" \
 	$(DEBUG_CFLAGS) \
 	$(GLIB_CFLAGS) \
+	$(GPLUGIN_CFLAGS) \
 	$(PLUGIN_CFLAGS) \
 	$(PERL_CFLAGS) \
 	-Wno-float-equal
diff --git a/libpurple/plugins/perl/perl.c b/libpurple/plugins/perl/perl.c
--- a/libpurple/plugins/perl/perl.c
+++ b/libpurple/plugins/perl/perl.c
@@ -649,70 +649,52 @@ destroy_perl_plugin(PurplePlugin *plugin
 	}
 }
 
+static PurplePluginLoaderInfo loader_info =
+{
+	probe_perl_plugin,                                /**< probe          */
+	load_perl_plugin,                                 /**< load           */
+	unload_perl_plugin,                               /**< unload         */
+	destroy_perl_plugin,                              /**< destroy        */
+};
+
+static GPluginPluginInfo *
+plugin_query(GError **error)
+{
+	const gchar * const authors[] = {
+		"Christian Hammond <chipx86 at gnupdate.org>",
+		NULL
+	};
+
+	return gplugin_plugin_info_new(
+		"id",             PERL_PLUGIN_ID,
+		"name",           N_("Perl Plugin Loader"),
+		"version",        DISPLAY_VERSION,
+		"category",       N_("Loader"),
+		"summary",        N_("Provides support for loading perl plugins."),
+		"description",    N_("Provides support for loading perl plugins."),
+		"authors",        authors,
+		"website",        PURPLE_WEBSITE,
+		"abi-version",    PURPLE_ABI_VERSION,
+		"internal",       TRUE,
+		"load-on-query",  TRUE,
+		NULL
+	);
+}
+
 static gboolean
-plugin_load(PurplePlugin *plugin)
+plugin_load(PurplePlugin *plugin, GError **error)
 {
 	return TRUE;
 }
 
 static gboolean
-plugin_unload(PurplePlugin *plugin)
+plugin_unload(PurplePlugin *plugin, GError **error)
 {
 	perl_end();
 
 	return TRUE;
 }
 
-static PurplePluginLoaderInfo loader_info =
-{
-	NULL,                                             /**< exts           */
-	probe_perl_plugin,                                /**< probe          */
-	load_perl_plugin,                                 /**< load           */
-	unload_perl_plugin,                               /**< unload         */
-	destroy_perl_plugin,                              /**< destroy        */
-
-	/* padding */
-	NULL,
-	NULL,
-	NULL,
-	NULL
-};
-
-static PurplePluginInfo info =
-{
-	PURPLE_PLUGIN_MAGIC,
-	PURPLE_MAJOR_VERSION,
-	PURPLE_MINOR_VERSION,
-	PURPLE_PLUGIN_LOADER,                             /**< type           */
-	NULL,                                             /**< ui_requirement */
-	0,                                                /**< flags          */
-	NULL,                                             /**< dependencies   */
-	PURPLE_PRIORITY_DEFAULT,                          /**< priority       */
-
-	PERL_PLUGIN_ID,                                   /**< id             */
-	N_("Perl Plugin Loader"),                         /**< name           */
-	DISPLAY_VERSION,                                  /**< version        */
-	N_("Provides support for loading perl plugins."), /**< summary        */
-	N_("Provides support for loading perl plugins."), /**< description    */
-	"Christian Hammond <chipx86 at gnupdate.org>",       /**< author         */
-	PURPLE_WEBSITE,                                   /**< homepage       */
-
-	plugin_load,                                      /**< load           */
-	plugin_unload,                                    /**< unload         */
-	NULL,                                             /**< destroy        */
-
-	NULL,                                             /**< ui_info        */
-	&loader_info,                                     /**< extra_info     */
-	NULL,
-	NULL,
-
-	/* padding */
-	NULL,
-	NULL,
-	NULL,
-	NULL
-};
-
 static void
 init_plugin(PurplePlugin *plugin)
 {
@@ -738,4 +720,4 @@ my_init(void)
 	g_module_open("perl.so", 0);
 }
 
-PURPLE_INIT_PLUGIN(perl, init_plugin, info)
+PURPLE_PLUGIN_INIT(perl, plugin_query, plugin_load, plugin_unload);



More information about the Commits mailing list