/soc/2013/ankitkv/gobjectification: b5167dc125f5: Plugins can re...
Ankit Vani
a at nevitus.org
Sat Aug 10 08:12:18 EDT 2013
Changeset: b5167dc125f568d7457d069702a4f5a45ee2536c
Author: Ankit Vani <a at nevitus.org>
Date: 2013-08-10 17:42 +0530
Branch: soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/b5167dc125f5
Description:
Plugins can return an error when failing to load
diffstat:
libpurple/plugins.h | 30 ++++++++++++++++++------------
libpurple/protocols/null/nullprpl.c | 6 +++---
2 files changed, 21 insertions(+), 15 deletions(-)
diffs (81 lines):
diff --git a/libpurple/plugins.h b/libpurple/plugins.h
--- a/libpurple/plugins.h
+++ b/libpurple/plugins.h
@@ -163,29 +163,35 @@ struct _PurplePluginAction {
#define PURPLE_PLUGIN_INIT(pluginname,pluginquery,pluginload,pluginunload) \
PurplePluginInfo * pluginname##_plugin_query(void); \
PurplePluginInfo * pluginname##_plugin_query(void) { \
- return pluginquery(); \
+ return pluginquery(NULL); \
} \
gboolean pluginname##_plugin_load(void); \
gboolean pluginname##_plugin_load(void) { \
- return pluginload(NULL); \
+ GError *e = NULL; \
+ gboolean loaded = pluginload(NULL, &e); \
+ if (e) g_error_free(e); \
+ return loaded; \
} \
gboolean pluginname##_plugin_unload(void); \
gboolean pluginname##_plugin_unload(void) { \
- return pluginunload(NULL); \
+ GError *e = NULL; \
+ gboolean unloaded = pluginunload(NULL, &e); \
+ if (e) g_error_free(e); \
+ return unloaded; \
}
#else /* PURPLE_PLUGINS && !PURPLE_STATIC_PRPL */
#define PURPLE_PLUGIN_INIT(pluginname,pluginquery,pluginload,pluginunload) \
- G_MODULE_EXPORT GPluginPluginInfo *gplugin_plugin_query(void); \
- G_MODULE_EXPORT GPluginPluginInfo *gplugin_plugin_query(void) { \
- return GPLUGIN_PLUGIN_INFO(pluginquery()); \
+ G_MODULE_EXPORT GPluginPluginInfo *gplugin_plugin_query(GError **e); \
+ G_MODULE_EXPORT GPluginPluginInfo *gplugin_plugin_query(GError **e) { \
+ return GPLUGIN_PLUGIN_INFO(pluginquery(e)); \
} \
- G_MODULE_EXPORT gboolean gplugin_plugin_load(GPluginNativePlugin *); \
- G_MODULE_EXPORT gboolean gplugin_plugin_load(GPluginNativePlugin *p) { \
- return pluginload(PURPLE_PLUGIN(p)); \
+ G_MODULE_EXPORT gboolean gplugin_plugin_load(GPluginNativePlugin *p, GError **e); \
+ G_MODULE_EXPORT gboolean gplugin_plugin_load(GPluginNativePlugin *p, GError **e) { \
+ return pluginload(PURPLE_PLUGIN(p), e); \
} \
- G_MODULE_EXPORT gboolean gplugin_plugin_unload(GPluginNativePlugin *); \
- G_MODULE_EXPORT gboolean gplugin_plugin_unload(GPluginNativePlugin *p) { \
- return pluginunload(PURPLE_PLUGIN(p)); \
+ G_MODULE_EXPORT gboolean gplugin_plugin_unload(GPluginNativePlugin *p, GError **e); \
+ G_MODULE_EXPORT gboolean gplugin_plugin_unload(GPluginNativePlugin *p, GError **e) { \
+ return pluginunload(PURPLE_PLUGIN(p), e); \
}
#endif
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
@@ -1135,7 +1135,7 @@ static PurplePluginProtocolInfo prpl_inf
};
static PurplePluginInfo *
-plugin_query(void)
+plugin_query(GError **error)
{
return purple_plugin_info_new(
"id", NULLPRPL_ID,
@@ -1156,7 +1156,7 @@ plugin_query(void)
}
static gboolean
-plugin_load(PurplePlugin *plugin)
+plugin_load(PurplePlugin *plugin, GError **error)
{
/* see accountopt.h for information about user splits and protocol options */
PurpleAccountUserSplit *split = purple_account_user_split_new(
@@ -1198,7 +1198,7 @@ plugin_load(PurplePlugin *plugin)
}
static gboolean
-plugin_unload(PurplePlugin *plugin)
+plugin_unload(PurplePlugin *plugin, GError **error)
{
purple_debug_info("nullprpl", "shutting down\n");
More information about the Commits
mailing list