/soc/2013/ankitkv/gobjectification: a0d5a2f41086: Added new plug...

Ankit Vani a at nevitus.org
Thu Sep 19 06:41:58 EDT 2013


Changeset: a0d5a2f41086dcfd60163e70ed3c0723adb4b125
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-09-19 16:03 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/a0d5a2f41086

Description:

Added new plugin init macro and query functions to loaders

diffstat:

 libpurple/plugins/mono/loader/Makefile.am |   3 +-
 libpurple/plugins/mono/loader/mono.c      |  71 ++++++++++++-------------
 libpurple/plugins/tcl/Makefile.am         |   3 +-
 libpurple/plugins/tcl/tcl.c               |  85 ++++++++++++------------------
 pidgin/plugins/perl/Makefile.am           |   1 +
 5 files changed, 74 insertions(+), 89 deletions(-)

diffs (253 lines):

diff --git a/libpurple/plugins/mono/loader/Makefile.am b/libpurple/plugins/mono/loader/Makefile.am
--- a/libpurple/plugins/mono/loader/Makefile.am
+++ b/libpurple/plugins/mono/loader/Makefile.am
@@ -14,11 +14,12 @@ mono_la_SOURCES	= \
 
 mono_la_LDFLAGS  = -module -avoid-version
 
-mono_la_LIBADD = $(MONO_LIBS)
+mono_la_LIBADD = $(GPLUGIN_LIBS) $(MONO_LIBS)
 
 AM_CPPFLAGS = \
 	-I$(top_srcdir) \
 	-I$(top_srcdir)/libpurple \
 	$(DEBUG_CFLAGS) \
+	$(GPLUGIN_CFLAGS) \
 	$(PLUGIN_CFLAGS) \
 	$(MONO_CFLAGS)
diff --git a/libpurple/plugins/mono/loader/mono.c b/libpurple/plugins/mono/loader/mono.c
--- a/libpurple/plugins/mono/loader/mono.c
+++ b/libpurple/plugins/mono/loader/mono.c
@@ -197,50 +197,47 @@ static void plugin_destroy(PurplePlugin 
 
 static PurplePluginLoaderInfo loader_info =
 {
-	NULL,
 	probe_mono_plugin,
 	load_mono_plugin,
 	unload_mono_plugin,
 	destroy_mono_plugin,
-
-	/* padding */
-	NULL,
-	NULL,
-	NULL,
-	NULL
 };
 
-static PurplePluginInfo info =
+static GPluginPluginInfo *
+plugin_query(GError **error)
 {
-	PURPLE_PLUGIN_MAGIC,
-	PURPLE_MAJOR_VERSION,
-	PURPLE_MINOR_VERSION,
-	PURPLE_PLUGIN_LOADER,
-	NULL,
-	0,
-	NULL,
-	PURPLE_PRIORITY_DEFAULT,
-	MONO_PLUGIN_ID,
-	N_("Mono Plugin Loader"),
-	DISPLAY_VERSION,
-	N_("Loads .NET plugins with Mono."),
-	N_("Loads .NET plugins with Mono."),
-	"Eoin Coffey <ecoffey at simla.colostate.edu>",
-	PURPLE_WEBSITE,
-	NULL,
-	NULL,
-	plugin_destroy,
-	NULL,
-	&loader_info,
-	NULL,
-	NULL,
+	const gchar * const authors[] = {
+		"Eoin Coffey <ecoffey at simla.colostate.edu>",
+		NULL
+	};
 
-	/* padding */
-	NULL,
-	NULL,
-	NULL,
-	NULL
-};
+	return gplugin_plugin_info_new(
+		"id",             MONO_PLUGIN_ID,
+		"name",           N_("Mono Plugin Loader"),
+		"version",        DISPLAY_VERSION,
+		"category",       N_("Loader"),
+		"summary",        N_("Loads .NET plugins with Mono."),
+		"description",    N_("Loads .NET plugins with Mono."),
+		"authors",        authors,
+		"website",        PURPLE_WEBSITE,
+		"abi-version",    PURPLE_ABI_VERSION,
+		"internal",       TRUE,
+		"load-on-query",  TRUE,
+		NULL
+	);
+}
+
+static gboolean
+plugin_load(PurplePlugin *plugin, GError **error)
+{
+	return TRUE;
+}
+
+static gboolean
+plugin_unload(PurplePlugin *plugin, GError **error)
+{
+	return TRUE;
+}
 
 static void init_plugin(PurplePlugin *plugin)
 {
@@ -249,4 +246,4 @@ static void init_plugin(PurplePlugin *pl
 	loader_info.exts = g_list_append(loader_info.exts, "dll");
 }
 
-PURPLE_INIT_PLUGIN(mono, init_plugin, info)
+PURPLE_PLUGIN_INIT(mono, plugin_query, plugin_load, plugin_unload);
diff --git a/libpurple/plugins/tcl/Makefile.am b/libpurple/plugins/tcl/Makefile.am
--- a/libpurple/plugins/tcl/Makefile.am
+++ b/libpurple/plugins/tcl/Makefile.am
@@ -7,7 +7,7 @@ plugin_LTLIBRARIES = tcl.la
 tcl_la_SOURCES = tcl.c tcl_glib.c tcl_glib.h tcl_cmds.c tcl_signals.c tcl_purple.h \
                  tcl_ref.c tcl_cmd.c
 
-tcl_la_LIBADD = $(GLIB_LIBS) $(TCL_LIBS) $(TK_LIBS)
+tcl_la_LIBADD = $(GLIB_LIBS) $(GPLUGIN_LIBS) $(TCL_LIBS) $(TK_LIBS)
 
 EXTRA_DIST = signal-test.tcl Makefile.mingw
 
@@ -17,6 +17,7 @@ AM_CPPFLAGS = \
 	-I$(top_builddir)/libpurple \
 	$(DEBUG_CFLAGS) \
 	$(GLIB_CFLAGS) \
+	$(GPLUGIN_CFLAGS) \
 	$(PLUGIN_CFLAGS) \
 	$(TK_CFLAGS) \
 	$(TCL_CFLAGS)
diff --git a/libpurple/plugins/tcl/tcl.c b/libpurple/plugins/tcl/tcl.c
--- a/libpurple/plugins/tcl/tcl.c
+++ b/libpurple/plugins/tcl/tcl.c
@@ -348,7 +348,39 @@ static void tcl_destroy_plugin(PurplePlu
 	return;
 }
 
-static gboolean tcl_load(PurplePlugin *plugin)
+static PurplePluginLoaderInfo tcl_loader_info =
+{
+	tcl_probe_plugin,
+	tcl_load_plugin,
+	tcl_unload_plugin,
+	tcl_destroy_plugin,
+};
+
+static GPluginPluginInfo *
+tcl_query(GError **error)
+{
+	const gchar * const authors[] = {
+		"Ethan Blanton <eblanton at cs.purdue.edu>",
+		NULL
+	};
+
+	return gplugin_plugin_info_new(
+		"id",             "core-tcl",
+		"name",           N_("Tcl Plugin Loader"),
+		"version",        DISPLAY_VERSION,
+		"category",       N_("Loader"),
+		"summary",        N_("Provides support for loading Tcl plugins"),
+		"description",    N_("Provides support for loading Tcl plugins"),
+		"authors",        authors,
+		"website",        PURPLE_WEBSITE,
+		"abi-version",    PURPLE_ABI_VERSION,
+		"internal",       TRUE,
+		"load-on-query",  TRUE,
+		NULL
+	);
+}
+
+static gboolean tcl_load(PurplePlugin *plugin, GError **error)
 {
 	if(!tcl_loaded)
 		return FALSE;
@@ -378,7 +410,7 @@ static gboolean tcl_load(PurplePlugin *p
 	return TRUE;
 }
 
-static gboolean tcl_unload(PurplePlugin *plugin)
+static gboolean tcl_unload(PurplePlugin *plugin, GError **error)
 {
 	g_hash_table_destroy(tcl_plugins);
 	tcl_plugins = NULL;
@@ -397,53 +429,6 @@ static gboolean tcl_unload(PurplePlugin 
 	return TRUE;
 }
 
-static PurplePluginLoaderInfo tcl_loader_info =
-{
-	NULL,
-	tcl_probe_plugin,
-	tcl_load_plugin,
-	tcl_unload_plugin,
-	tcl_destroy_plugin,
-
-	/* pidgin */
-	NULL,
-	NULL,
-	NULL,
-	NULL
-};
-
-static PurplePluginInfo tcl_info =
-{
-	PURPLE_PLUGIN_MAGIC,
-	PURPLE_MAJOR_VERSION,
-	PURPLE_MINOR_VERSION,
-	PURPLE_PLUGIN_LOADER,
-	NULL,
-	0,
-	NULL,
-	PURPLE_PRIORITY_DEFAULT,
-	"core-tcl",
-	N_("Tcl Plugin Loader"),
-	DISPLAY_VERSION,
-	N_("Provides support for loading Tcl plugins"),
-	N_("Provides support for loading Tcl plugins"),
-	"Ethan Blanton <eblanton at cs.purdue.edu>",
-	PURPLE_WEBSITE,
-	tcl_load,
-	tcl_unload,
-	NULL,
-	NULL,
-	&tcl_loader_info,
-	NULL,
-	NULL,
-
-	/* padding */
-	NULL,
-	NULL,
-	NULL,
-	NULL
-};
-
 #ifdef _WIN32
 typedef Tcl_Interp* (__cdecl* LPFNTCLCREATEINTERP)(void);
 typedef void        (__cdecl* LPFNTKINIT)(Tcl_Interp*);
@@ -515,4 +500,4 @@ static void tcl_init_plugin(PurplePlugin
 	tcl_loader_info.exts = g_list_append(tcl_loader_info.exts, "tcl");
 }
 
-PURPLE_INIT_PLUGIN(tcl, tcl_init_plugin, tcl_info)
+PURPLE_PLUGIN_INIT(tcl, tcl_query, tcl_load, tcl_unload);
diff --git a/pidgin/plugins/perl/Makefile.am b/pidgin/plugins/perl/Makefile.am
--- a/pidgin/plugins/perl/Makefile.am
+++ b/pidgin/plugins/perl/Makefile.am
@@ -103,5 +103,6 @@ AM_CPPFLAGS = \
 	-I$(top_srcdir)/pidgin \
 	$(DEBUG_CFLAGS) \
 	$(GTK_CFLAGS) \
+	$(GPLUGIN_CFLAGS) \
 	$(PLUGIN_CFLAGS) \
 	$(PERL_CFLAGS)



More information about the Commits mailing list