summaryrefslogtreecommitdiff
path: root/gabble
diff options
context:
space:
mode:
authorSiraj Razick <siraj.razick@collabora.co.uk>2012-01-13 11:32:48 -0500
committerSiraj Razick <siraj.razick@collabora.co.uk>2012-01-25 15:15:34 -0500
commitd3beae79aadab2e0adfc206082068fc6689ff290 (patch)
treeb6b106f0716801a0aa48900627668b2ab7700e7c /gabble
parent9ee76cdc02c550850c8490ddc97dc0c0fa24c38a (diff)
fd.o#44649 - Gabble plugin API symbols should be factored out to a separate library
This patch refactors gabble connection by introducing a new GInterface which the plugins will link agaist. And GabbleConnection implements the new Interface. https://bugs.freedesktop.org/show_bug.cgi?id=44649
Diffstat (limited to 'gabble')
-rw-r--r--gabble/Makefile.am2
-rw-r--r--gabble/connection.h88
-rw-r--r--gabble/gabble.h2
-rw-r--r--gabble/plugin-connection.h132
-rw-r--r--gabble/plugin.h8
5 files changed, 139 insertions, 93 deletions
diff --git a/gabble/Makefile.am b/gabble/Makefile.am
index f42c837d0..26b874889 100644
--- a/gabble/Makefile.am
+++ b/gabble/Makefile.am
@@ -8,7 +8,7 @@ gabbleinclude_HEADERS = \
capabilities-set.h \
caps-channel-manager.h \
caps-hash.h \
- connection.h \
+ plugin-connection.h \
error.h \
gabble.h \
namespaces.h \
diff --git a/gabble/connection.h b/gabble/connection.h
deleted file mode 100644
index 1d7dccad9..000000000
--- a/gabble/connection.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * connection.h - connection API available to telepathy-gabble plugins
- * Copyright © 2010 Collabora Ltd.
- * Copyright © 2010 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef GABBLE_PLUGINS_CONNECTION_H
-#define GABBLE_PLUGINS_CONNECTION_H
-
-#include <telepathy-glib/base-connection.h>
-#include <telepathy-glib/base-contact-list.h>
-
-#include <gabble/capabilities-set.h>
-#include <gabble/types.h>
-
-#include <wocky/wocky-xep-0115-capabilities.h>
-
-G_BEGIN_DECLS
-
-#define GABBLE_TYPE_CONNECTION (gabble_connection_get_type ())
-#define GABBLE_CONNECTION(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), GABBLE_TYPE_CONNECTION, GabbleConnection))
-#define GABBLE_CONNECTION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), GABBLE_TYPE_CONNECTION, \
- GabbleConnectionClass))
-#define GABBLE_IS_CONNECTION(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), GABBLE_TYPE_CONNECTION))
-#define GABBLE_IS_CONNECTION_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), GABBLE_TYPE_CONNECTION))
-#define GABBLE_CONNECTION_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), GABBLE_TYPE_CONNECTION, \
- GabbleConnectionClass))
-
-typedef struct _GabbleConnectionClass GabbleConnectionClass;
-
-GType gabble_connection_get_type (void);
-
-void gabble_connection_update_sidecar_capabilities (
- GabbleConnection *connection,
- const GabbleCapabilitySet *add_set,
- const GabbleCapabilitySet *remove_set);
-gchar *gabble_connection_add_sidecar_own_caps (
- GabbleConnection *connection,
- const GabbleCapabilitySet *cap_set,
- const GPtrArray *identities) G_GNUC_WARN_UNUSED_RESULT;
-gchar *gabble_connection_add_sidecar_own_caps_full (
- GabbleConnection *connection,
- const GabbleCapabilitySet *cap_set,
- const GPtrArray *identities,
- GPtrArray *data_forms) G_GNUC_WARN_UNUSED_RESULT;
-
-WockySession *gabble_connection_get_session (
- GabbleConnection *connection);
-
-gchar *gabble_connection_get_full_jid (GabbleConnection *conn);
-
-const gchar * gabble_connection_get_jid_for_caps (GabbleConnection *conn,
- WockyXep0115Capabilities *caps);
-
-const gchar * gabble_connection_pick_best_resource_for_caps (
- GabbleConnection *connection,
- const gchar *jid,
- GabbleCapabilitySetPredicate predicate,
- gconstpointer user_data);
-
-TpBaseContactList * gabble_connection_get_contact_list (
- GabbleConnection *connection);
-
-WockyXep0115Capabilities * gabble_connection_get_caps (
- GabbleConnection *connection, TpHandle handle);
-
-G_END_DECLS
-
-#endif
diff --git a/gabble/gabble.h b/gabble/gabble.h
index 8393ae8c7..4465c3428 100644
--- a/gabble/gabble.h
+++ b/gabble/gabble.h
@@ -28,7 +28,7 @@
#include <gabble/capabilities-set.h>
#include <gabble/caps-channel-manager.h>
#include <gabble/caps-hash.h>
-#include <gabble/connection.h>
+#include <gabble/plugin-connection.h>
#include <gabble/error.h>
#include <gabble/namespaces.h>
#include <gabble/plugin.h>
diff --git a/gabble/plugin-connection.h b/gabble/plugin-connection.h
new file mode 100644
index 000000000..e80e13410
--- /dev/null
+++ b/gabble/plugin-connection.h
@@ -0,0 +1,132 @@
+/*
+ * plugin-connection.h — Connection API available to telepathy-gabble plugins
+ * Copyright © 2012 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef GABBLE_PLUGIN_CONNECTION_H
+#define GABBLE_PLUGIN_CONNECTION_H
+
+#include <glib-object.h>
+
+#include <telepathy-glib/base-connection.h>
+#include <telepathy-glib/base-contact-list.h>
+
+#include <gabble/capabilities-set.h>
+#include <gabble/types.h>
+
+#include <wocky/wocky-xep-0115-capabilities.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GabblePluginConnection GabblePluginConnection;
+typedef struct _GabblePluginConnectionInterface GabblePluginConnectionInterface;
+
+#define GABBLE_TYPE_PLUGIN_CONNECTION (gabble_plugin_connection_get_type ())
+#define GABBLE_PLUGIN_CONNECTION(o) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((o), GABBLE_TYPE_PLUGIN_CONNECTION, \
+ GabblePluginConnection))
+#define GABBLE_IS_PLUGIN_CONNECTION(o) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((o), GABBLE_TYPE_PLUGIN_CONNECTION))
+#define GABBLE_PLUGIN_CONNECTION_GET_IFACE(o) \
+ (G_TYPE_INSTANCE_GET_INTERFACE ((o), GABBLE_TYPE_PLUGIN_CONNECTION, \
+ GabblePluginConnectionInterface))
+
+GType gabble_plugin_connection_get_type (void) G_GNUC_CONST;
+
+typedef gchar * (*GabblePluginConnectionAddSidecarCapsFunc) (
+ GabblePluginConnection *connection_service,
+ const GabbleCapabilitySet *cap_set,
+ const GPtrArray *identities);
+
+typedef gchar * (*GabblePluginConnectionAddSidecarCapsFullFunc) (
+ GabblePluginConnection *plugin_connection,
+ const GabbleCapabilitySet *cap_set,
+ const GPtrArray *identities,
+ GPtrArray *data_forms);
+
+typedef WockySession * (*GabblePluginConnectionGetSessionFunc) (
+ GabblePluginConnection *plugin_connection);
+
+typedef gchar *(*GabblePluginConnectionGetFullJidFunc) (
+ GabblePluginConnection *plugin_connection);
+
+typedef const gchar * (*GabblePluginConnectionGetJidForCapsFunc) (
+ GabblePluginConnection *plugin_connection,
+ WockyXep0115Capabilities *caps);
+
+typedef const gchar* (*GabblePluginConnectionPickBestResourceForCaps) (
+ GabblePluginConnection *plugin_connection,
+ const gchar *jid,
+ GabbleCapabilitySetPredicate predicate,
+ gconstpointer user_data);
+
+typedef TpBaseContactList * (*GabblePluginConnectionGetContactList) (
+ GabblePluginConnection *plugin_connection);
+
+typedef WockyXep0115Capabilities * (*GabblePluginConnectionGetCaps) (
+ GabblePluginConnection *plugin_connection,
+ TpHandle handle);
+
+struct _GabblePluginConnectionInterface
+{
+ GTypeInterface parent;
+ GabblePluginConnectionAddSidecarCapsFunc add_sidecar_own_caps;
+ GabblePluginConnectionAddSidecarCapsFullFunc add_sidecar_own_caps_full;
+ GabblePluginConnectionGetSessionFunc get_session;
+ GabblePluginConnectionGetFullJidFunc get_full_jid;
+ GabblePluginConnectionGetJidForCapsFunc get_jid_for_caps;
+ GabblePluginConnectionPickBestResourceForCaps pick_best_resource_for_caps;
+ GabblePluginConnectionGetContactList get_contact_list;
+ GabblePluginConnectionGetCaps get_caps;
+};
+
+gchar *gabble_plugin_connection_add_sidecar_own_caps (
+ GabblePluginConnection *plugin_service,
+ const GabbleCapabilitySet *cap_set,
+ const GPtrArray *identities);
+
+gchar *gabble_plugin_connection_add_sidecar_own_caps_full (
+ GabblePluginConnection *plugin_connection,
+ const GabbleCapabilitySet *cap_set,
+ const GPtrArray *identities,
+ GPtrArray *data_forms) G_GNUC_WARN_UNUSED_RESULT;
+
+WockySession *gabble_plugin_connection_get_session (
+ GabblePluginConnection *plugin_connection);
+
+gchar *gabble_plugin_connection_get_full_jid (GabblePluginConnection *conn);
+
+const gchar *gabble_plugin_connection_get_jid_for_caps (
+ GabblePluginConnection *plugin_connection,
+ WockyXep0115Capabilities *caps);
+
+const gchar *gabble_plugin_connection_pick_best_resource_for_caps (
+ GabblePluginConnection *plugin_connection,
+ const gchar *jid,
+ GabbleCapabilitySetPredicate predicate,
+ gconstpointer user_data);
+
+TpBaseContactList *gabble_plugin_connection_get_contact_list (
+ GabblePluginConnection *plugin_connection);
+
+WockyXep0115Capabilities *gabble_plugin_connection_get_caps (
+ GabblePluginConnection *plugin_connection,
+ TpHandle handle);
+
+G_END_DECLS
+
+#endif
diff --git a/gabble/plugin.h b/gabble/plugin.h
index ffb888c29..35621200c 100644
--- a/gabble/plugin.h
+++ b/gabble/plugin.h
@@ -28,7 +28,7 @@
#include <telepathy-glib/presence-mixin.h>
#include <wocky/wocky-session.h>
-#include <gabble/connection.h>
+#include <gabble/plugin-connection.h>
#include <gabble/sidecar.h>
#include <gabble/types.h>
@@ -48,7 +48,7 @@ typedef struct _GabblePluginInterface GabblePluginInterface;
typedef void (*GabblePluginCreateSidecarImpl) (
GabblePlugin *plugin,
const gchar *sidecar_interface,
- GabbleConnection *connection,
+ GabblePluginConnection *plugin_connection,
WockySession *session,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -58,6 +58,7 @@ typedef void (*GabblePluginCreateSidecarImpl) (
* not have a free function. */
typedef GPtrArray * (*GabblePluginCreateChannelManagersImpl) (
GabblePlugin *plugin,
+ GabblePluginConnection *plugin_connection,
TpBaseConnection *connection);
typedef GabbleSidecar * (*GabblePluginCreateSidecarFinishImpl) (
@@ -133,7 +134,7 @@ gboolean gabble_plugin_implements_sidecar (
void gabble_plugin_create_sidecar_async (
GabblePlugin *plugin,
const gchar *sidecar_interface,
- GabbleConnection *connection,
+ GabblePluginConnection *plugin_connection,
WockySession *session,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -155,6 +156,7 @@ const gchar *gabble_plugin_presence_status_for_privacy_list (
const gchar *list_name);
GPtrArray * gabble_plugin_create_channel_managers (GabblePlugin *plugin,
+ GabblePluginConnection *plugin_connection,
TpBaseConnection *connection);
/**