summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2012-02-01 13:40:56 -0500
committerJonny Lamb <jonny.lamb@collabora.co.uk>2012-02-01 13:41:15 -0500
commitbf805ba0b2ecced81e5c2830a79d021a42da91a7 (patch)
tree10046273dae8333e0855041e05dadfe848122460
parent1296a2f5ce46e77787ca42eadb1c2ca4a957a09b (diff)
parent026e84f10bbfa52f813d30d95b0efbd2ec7a5228 (diff)
Merge remote-tracking branch 'siraj/plugin-api-change'
Conflicts: lib/loudmouth/Makefile.am Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r--NEWS6
-rw-r--r--gabble/plugin.h16
-rw-r--r--plugins/console.c31
-rw-r--r--plugins/gateways.c31
-rw-r--r--plugins/test.c33
-rw-r--r--src/Makefile.am23
-rw-r--r--src/plugin-loader.c2
-rw-r--r--src/plugin.c24
8 files changed, 132 insertions, 34 deletions
diff --git a/NEWS b/NEWS
index 57ad7710c..ea0e3561f 100644
--- a/NEWS
+++ b/NEWS
@@ -30,6 +30,12 @@ API changes to Wocky snapshot:
replies for unhandled IQs, whereas previously this was up to Gabble.
Plugin authors shouldn't notice this change. (Will)
+* fd.o#44331 - Gabble plugin API symbols should be factored out to a separate library :
+ gabble_plugin_create_sidecar function is renamed to gabble_plugin_create_sidecar_async
+ and new virtual function gabble_plugin_create_sidecar_finish is introduced. All gabble
+ plugins should implement these two methods and all internal plugins are updated to use
+ this new API.
+
telepathy-gabble 0.15.3 (2011-12-22)
====================================
diff --git a/gabble/plugin.h b/gabble/plugin.h
index 6da99f136..ffb888c29 100644
--- a/gabble/plugin.h
+++ b/gabble/plugin.h
@@ -60,6 +60,11 @@ typedef GPtrArray * (*GabblePluginCreateChannelManagersImpl) (
GabblePlugin *plugin,
TpBaseConnection *connection);
+typedef GabbleSidecar * (*GabblePluginCreateSidecarFinishImpl) (
+ GabblePlugin *plugin,
+ GAsyncResult *result,
+ GError **error);
+
struct _GabblePluginPrivacyListMap {
const gchar *presence_status_name;
const gchar *privacy_list_name;
@@ -81,9 +86,14 @@ struct _GabblePluginInterface {
const gchar * const *sidecar_interfaces;
/**
- * An implementation of gabble_plugin_create_sidecar().
+ * An implementation of gabble_plugin_create_sidecar_async().
+ */
+ GabblePluginCreateSidecarImpl create_sidecar_async;
+
+ /**
+ * An implementation of gabble_plugin_create_sidecar_finish().
*/
- GabblePluginCreateSidecarImpl create_sidecar;
+ GabblePluginCreateSidecarFinishImpl create_sidecar_finish;
/**
* The plugin's version, conventionally a "."-separated sequence of
@@ -120,7 +130,7 @@ gboolean gabble_plugin_implements_sidecar (
GabblePlugin *plugin,
const gchar *sidecar_interface);
-void gabble_plugin_create_sidecar (
+void gabble_plugin_create_sidecar_async (
GabblePlugin *plugin,
const gchar *sidecar_interface,
GabbleConnection *connection,
diff --git a/plugins/console.c b/plugins/console.c
index 13ca0eccf..8d6795c9d 100644
--- a/plugins/console.c
+++ b/plugins/console.c
@@ -77,7 +77,7 @@ gabble_console_plugin_class_init (GabbleConsolePluginClass *klass)
}
static void
-gabble_console_plugin_create_sidecar (
+gabble_console_plugin_create_sidecar_async (
GabblePlugin *plugin,
const gchar *sidecar_interface,
GabbleConnection *connection,
@@ -87,10 +87,7 @@ gabble_console_plugin_create_sidecar (
{
GSimpleAsyncResult *result = g_simple_async_result_new (G_OBJECT (plugin),
callback, user_data,
- /* sic: all plugins share gabble_plugin_create_sidecar_finish() so we
- * need to use the same source tag.
- */
- gabble_plugin_create_sidecar);
+ gabble_console_plugin_create_sidecar_async);
GabbleSidecar *sidecar = NULL;
if (!tp_strdiff (sidecar_interface, GABBLE_IFACE_GABBLE_PLUGIN_CONSOLE))
@@ -114,6 +111,27 @@ gabble_console_plugin_create_sidecar (
g_object_unref (result);
}
+static GabbleSidecar *
+gabble_console_plugin_create_sidecar_finish (
+ GabblePlugin *plugin,
+ GAsyncResult *result,
+ GError **error)
+{
+ GabbleSidecar *sidecar;
+
+ if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result),
+ error))
+ return NULL;
+
+ g_return_val_if_fail (g_simple_async_result_is_valid (result,
+ G_OBJECT (plugin), gabble_console_plugin_create_sidecar_async), NULL);
+
+ sidecar = GABBLE_SIDECAR (g_simple_async_result_get_op_res_gpointer (
+ G_SIMPLE_ASYNC_RESULT (result)));
+
+ return g_object_ref (sidecar);
+}
+
static void
plugin_iface_init (
gpointer g_iface,
@@ -124,7 +142,8 @@ plugin_iface_init (
iface->name = "XMPP console";
iface->version = PACKAGE_VERSION;
iface->sidecar_interfaces = sidecar_interfaces;
- iface->create_sidecar = gabble_console_plugin_create_sidecar;
+ iface->create_sidecar_async = gabble_console_plugin_create_sidecar_async;
+ iface->create_sidecar_finish = gabble_console_plugin_create_sidecar_finish;
}
GabblePlugin *
diff --git a/plugins/gateways.c b/plugins/gateways.c
index 88a32223f..1e7b141a2 100644
--- a/plugins/gateways.c
+++ b/plugins/gateways.c
@@ -75,7 +75,7 @@ gabble_gateway_plugin_class_init (GabbleGatewayPluginClass *klass)
}
static void
-gabble_gateway_plugin_create_sidecar (
+gabble_gateway_plugin_create_sidecar_async (
GabblePlugin *plugin,
const gchar *sidecar_interface,
GabbleConnection *connection,
@@ -85,10 +85,7 @@ gabble_gateway_plugin_create_sidecar (
{
GSimpleAsyncResult *result = g_simple_async_result_new (G_OBJECT (plugin),
callback, user_data,
- /* sic: all plugins share gabble_plugin_create_sidecar_finish() so we
- * need to use the same source tag.
- */
- gabble_plugin_create_sidecar);
+ gabble_gateway_plugin_create_sidecar_async);
GabbleSidecar *sidecar = NULL;
if (!tp_strdiff (sidecar_interface, GABBLE_IFACE_GABBLE_PLUGIN_GATEWAYS))
@@ -112,6 +109,27 @@ gabble_gateway_plugin_create_sidecar (
g_object_unref (result);
}
+static GabbleSidecar *
+gabble_gateway_plugin_create_sidecar_finish (
+ GabblePlugin *plugin,
+ GAsyncResult *result,
+ GError **error)
+{
+ GabbleSidecar *sidecar;
+
+ if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result),
+ error))
+ return NULL;
+
+ g_return_val_if_fail (g_simple_async_result_is_valid (result,
+ G_OBJECT (plugin), gabble_gateway_plugin_create_sidecar_async), NULL);
+
+ sidecar = GABBLE_SIDECAR (g_simple_async_result_get_op_res_gpointer (
+ G_SIMPLE_ASYNC_RESULT (result)));
+
+ return g_object_ref (sidecar);
+}
+
static void
plugin_iface_init (
gpointer g_iface,
@@ -122,7 +140,8 @@ plugin_iface_init (
iface->name = "Gateway registration plugin";
iface->version = PACKAGE_VERSION;
iface->sidecar_interfaces = sidecar_interfaces;
- iface->create_sidecar = gabble_gateway_plugin_create_sidecar;
+ iface->create_sidecar_async = gabble_gateway_plugin_create_sidecar_async;
+ iface->create_sidecar_finish = gabble_gateway_plugin_create_sidecar_finish;
}
GabblePlugin *
diff --git a/plugins/test.c b/plugins/test.c
index 05d784052..43b18ea3b 100644
--- a/plugins/test.c
+++ b/plugins/test.c
@@ -80,7 +80,7 @@ sidecar_iq_created_cb (
}
static void
-test_plugin_create_sidecar (
+test_plugin_create_sidecar_async (
GabblePlugin *plugin,
const gchar *sidecar_interface,
GabbleConnection *connection,
@@ -90,10 +90,8 @@ test_plugin_create_sidecar (
{
GSimpleAsyncResult *result = g_simple_async_result_new (G_OBJECT (plugin),
callback, user_data,
- /* sic: all plugins share gabble_plugin_create_sidecar_finish() so we
- * need to use the same source tag.
- */
- gabble_plugin_create_sidecar);
+ test_plugin_create_sidecar_async);
+
GabbleSidecar *sidecar = NULL;
if (!tp_strdiff (sidecar_interface, IFACE_TEST))
@@ -124,9 +122,31 @@ test_plugin_create_sidecar (
g_simple_async_result_set_op_res_gpointer (result, sidecar, g_object_unref);
g_simple_async_result_complete_in_idle (result);
+
g_object_unref (result);
}
+static GabbleSidecar *
+test_plugin_create_sidecar_finish (
+ GabblePlugin *plugin,
+ GAsyncResult *result,
+ GError **error)
+{
+ GabbleSidecar *sidecar;
+
+ if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result),
+ error))
+ return NULL;
+
+ g_return_val_if_fail (g_simple_async_result_is_valid (result,
+ G_OBJECT (plugin), test_plugin_create_sidecar_async), NULL);
+
+ sidecar = GABBLE_SIDECAR (g_simple_async_result_get_op_res_gpointer (
+ G_SIMPLE_ASYNC_RESULT (result)));
+
+ return g_object_ref (sidecar);
+}
+
static GPtrArray *
test_plugin_create_channel_managers (GabblePlugin *plugin,
TpBaseConnection *connection)
@@ -164,7 +184,8 @@ plugin_iface_init (
iface->name = "Sidecar test plugin";
iface->version = PACKAGE_VERSION;
iface->sidecar_interfaces = sidecar_interfaces;
- iface->create_sidecar = test_plugin_create_sidecar;
+ iface->create_sidecar_async = test_plugin_create_sidecar_async;
+ iface->create_sidecar_finish = test_plugin_create_sidecar_finish;
iface->create_channel_managers = test_plugin_create_channel_managers;
iface->presence_statuses = test_presences;
diff --git a/src/Makefile.am b/src/Makefile.am
index ffcd3d62d..01afbcc5d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -232,12 +232,22 @@ check_c_sources = \
include $(top_srcdir)/tools/check-coding-style.mk
check-local: check-coding-style
+if WINDOWS
+telepathy_gabble_LDADD = -lgabble-runtime
+else
telepathy_gabble_LDADD = libgabble-convenience.la
-
telepathy_gabble_LDFLAGS = -export-dynamic
+endif
noinst_LTLIBRARIES = libgabble-convenience.la
+if WINDOWS
+lib_LTLIBRARIES = libgabble-runtime.la
+libgabble_runtime_la_LIBADD = libgabble-convenience.la
+libgabble_runtime_la_LDFLAGS = -no-undefined
+libgabble_runtime_la_SOURCES =
+endif
+
AM_CFLAGS = $(ERROR_CFLAGS) -I$(top_srcdir) -I$(top_builddir) \
@TP_YELL_CFLAGS@ \
@DBUS_CFLAGS@ @GLIB_CFLAGS@ @WOCKY_CFLAGS@ \
@@ -247,13 +257,18 @@ AM_CFLAGS = $(ERROR_CFLAGS) -I$(top_srcdir) -I$(top_builddir) \
-DG_LOG_DOMAIN=\"gabble\" \
-DPLUGIN_DIR=\"$(libdir)/telepathy/gabble-0\"
+#on windows we need to avoid adding wocky static library twice
+#if not it results in a linker error.
+ALL_LIBS = @DBUS_LIBS@ @GLIB_LIBS@ @TP_GLIB_LIBS@ \
+ @SOUP_LIBS@ @NICE_LIBS@ @GMODULE_LIBS@
+
# following flag is requied to make getnameinfo work
if WINDOWS
- AM_CFLAGS += -D_WIN32_WINNT=0x0501
+AM_CFLAGS += -D_WIN32_WINNT=0x0501
+else
+ALL_LIBS += @WOCKY_LIBS@
endif
-ALL_LIBS = @DBUS_LIBS@ @GLIB_LIBS@ @WOCKY_LIBS@ @TP_GLIB_LIBS@ \
- @SOUP_LIBS@ @NICE_LIBS@ @GMODULE_LIBS@
# build gibber first
all: gibber
diff --git a/src/plugin-loader.c b/src/plugin-loader.c
index 2568ff5db..7e016b899 100644
--- a/src/plugin-loader.c
+++ b/src/plugin-loader.c
@@ -290,7 +290,7 @@ gabble_plugin_loader_create_sidecar (
GSimpleAsyncResult *res = g_simple_async_result_new (G_OBJECT (self),
callback, user_data, gabble_plugin_loader_create_sidecar);
- gabble_plugin_create_sidecar (p, sidecar_interface, connection, session,
+ gabble_plugin_create_sidecar_async (p, sidecar_interface, connection, session,
create_sidecar_cb, res);
return;
}
diff --git a/src/plugin.c b/src/plugin.c
index 4f35de781..783e721a4 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -96,7 +96,7 @@ gabble_plugin_implements_sidecar (
* @user_data: data to pass to @callback
*/
void
-gabble_plugin_create_sidecar (
+gabble_plugin_create_sidecar_async (
GabblePlugin *plugin,
const gchar *sidecar_interface,
GabbleConnection *connection,
@@ -111,13 +111,18 @@ gabble_plugin_create_sidecar (
user_data, TP_ERRORS, TP_ERROR_NOT_IMPLEMENTED,
"Gabble is buggy: '%s' doesn't implement sidecar %s",
iface->name, sidecar_interface);
- else if (iface->create_sidecar == NULL)
+ else if (iface->create_sidecar_async == NULL)
g_simple_async_report_error_in_idle (G_OBJECT (plugin), callback,
user_data, TP_ERRORS, TP_ERROR_NOT_IMPLEMENTED,
"'%s' is buggy: it claims to implement %s, but does not implement "
- "create_sidecar", iface->name, sidecar_interface);
+ "create_sidecar_async", iface->name, sidecar_interface);
+ else if (iface->create_sidecar_finish == NULL)
+ g_simple_async_report_error_in_idle (G_OBJECT (plugin), callback,
+ user_data, TP_ERRORS, TP_ERROR_NOT_IMPLEMENTED,
+ "'%s' is buggy: does not imlement create_sidecar_finish",
+ iface->name);
else
- iface->create_sidecar (plugin, sidecar_interface, connection, session,
+ iface->create_sidecar_async (plugin, sidecar_interface, connection, session,
callback, user_data);
}
@@ -127,17 +132,20 @@ gabble_plugin_create_sidecar_finish (
GAsyncResult *result,
GError **error)
{
+ GabblePluginInterface *iface = GABBLE_PLUGIN_GET_INTERFACE (plugin);
GabbleSidecar *sidecar;
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result),
error))
return NULL;
- g_return_val_if_fail (g_simple_async_result_is_valid (result,
- G_OBJECT (plugin), gabble_plugin_create_sidecar), NULL);
+ if (iface->create_sidecar_finish == NULL) {
+ WARNING ("'%s' is buggy: does not implement create_sidecar_finish", iface->name);
+ return NULL;
+ }
+
+ sidecar = iface->create_sidecar_finish (plugin, result, error);
- sidecar = GABBLE_SIDECAR (g_simple_async_result_get_op_res_gpointer (
- G_SIMPLE_ASYNC_RESULT (result)));
return g_object_ref (sidecar);
}