summaryrefslogtreecommitdiff
path: root/gabble
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2010-06-08 19:06:38 +0100
committerWill Thompson <will.thompson@collabora.co.uk>2010-06-08 19:06:40 +0100
commit93e7d22042f75546e503188b01da4cee14fe25ea (patch)
tree33f68a36d62f5767acedc9e34ae7395bc1def80c /gabble
parent9a1e2f0f68cc66d55a3f80f61d976c2c48342950 (diff)
parent37decc4a4c3b1956a6ddfa0e85bc0e1162a67935 (diff)
Merge branch 'plugins'
Reviewed-by: André Moreira Magalhães <andre.magalhaes@collabora.co.uk> Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Diffstat (limited to 'gabble')
-rw-r--r--gabble/Makefile.am8
-rw-r--r--gabble/capabilities-set.h84
-rw-r--r--gabble/caps-hash.h34
-rw-r--r--gabble/connection.h60
-rw-r--r--gabble/disco-identity.h50
-rw-r--r--gabble/error.h17
-rw-r--r--gabble/gabble.h10
-rw-r--r--gabble/namespaces.h27
-rw-r--r--gabble/plugin.h18
-rw-r--r--gabble/sidecar.h14
-rw-r--r--gabble/types.h36
11 files changed, 340 insertions, 18 deletions
diff --git a/gabble/Makefile.am b/gabble/Makefile.am
index 8731ea0e2..825c3c061 100644
--- a/gabble/Makefile.am
+++ b/gabble/Makefile.am
@@ -4,9 +4,15 @@ pkgconfig_DATA = telepathy-gabble.pc
gabbleincludedir = $(includedir)/telepathy-gabble-0/gabble
gabbleinclude_HEADERS = \
+ capabilities-set.h \
+ caps-hash.h \
+ connection.h \
+ disco-identity.h \
error.h \
gabble.h \
+ namespaces.h \
plugin.h \
- sidecar.h
+ sidecar.h \
+ types.h
endif
diff --git a/gabble/capabilities-set.h b/gabble/capabilities-set.h
new file mode 100644
index 000000000..e902a1399
--- /dev/null
+++ b/gabble/capabilities-set.h
@@ -0,0 +1,84 @@
+/*
+ * capabilities-set.h - capabilities set API available to telepathy-gabble plugins
+ * Copyright (C) 2005-2010 Collabora Ltd.
+ * Copyright (C) 2005-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_CAPABILITIES_SET_H
+#define GABBLE_PLUGINS_CAPABILITIES_SET_H
+
+#include <glib-object.h>
+
+#include <wocky/wocky-node.h>
+
+#include <gabble/types.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GabbleCapabilitySet:
+ *
+ * A set of capabilities.
+ */
+
+GabbleCapabilitySet *gabble_capability_set_new (void);
+GabbleCapabilitySet *gabble_capability_set_new_from_stanza (
+ WockyNode *query_result);
+GabbleCapabilitySet *gabble_capability_set_copy (
+ const GabbleCapabilitySet *caps);
+void gabble_capability_set_update (GabbleCapabilitySet *target,
+ const GabbleCapabilitySet *source);
+void gabble_capability_set_add (GabbleCapabilitySet *caps,
+ const gchar *cap);
+gboolean gabble_capability_set_remove (GabbleCapabilitySet *caps,
+ const gchar *cap);
+void gabble_capability_set_exclude (GabbleCapabilitySet *caps,
+ const GabbleCapabilitySet *removed);
+void gabble_capability_set_intersect (GabbleCapabilitySet *target,
+ const GabbleCapabilitySet *source);
+gint gabble_capability_set_size (const GabbleCapabilitySet *caps);
+gboolean gabble_capability_set_has (const GabbleCapabilitySet *caps,
+ const gchar *cap);
+gboolean gabble_capability_set_has_one (const GabbleCapabilitySet *caps,
+ const GabbleCapabilitySet *alternatives);
+gboolean gabble_capability_set_at_least (const GabbleCapabilitySet *caps,
+ const GabbleCapabilitySet *query);
+gboolean gabble_capability_set_equals (const GabbleCapabilitySet *a,
+ const GabbleCapabilitySet *b);
+void gabble_capability_set_clear (GabbleCapabilitySet *caps);
+void gabble_capability_set_free (GabbleCapabilitySet *caps);
+void gabble_capability_set_foreach (const GabbleCapabilitySet *caps,
+ GFunc func, gpointer user_data);
+gchar *gabble_capability_set_dump (const GabbleCapabilitySet *caps,
+ const gchar *indent);
+
+typedef gboolean (*GabbleCapabilitySetPredicate) (
+ const GabbleCapabilitySet *set, gconstpointer user_data);
+/* These functions are compatible with GabbleCapabilitySetPredicate;
+ * pass in the desired capabilities as the user_data */
+#define gabble_capability_set_predicate_equals \
+ ((GabbleCapabilitySetPredicate) gabble_capability_set_equals)
+#define gabble_capability_set_predicate_has \
+ ((GabbleCapabilitySetPredicate) gabble_capability_set_has)
+#define gabble_capability_set_predicate_has_one \
+ ((GabbleCapabilitySetPredicate) gabble_capability_set_has_one)
+#define gabble_capability_set_predicate_at_least \
+ ((GabbleCapabilitySetPredicate) gabble_capability_set_at_least)
+
+G_END_DECLS
+
+#endif
diff --git a/gabble/caps-hash.h b/gabble/caps-hash.h
new file mode 100644
index 000000000..72e9a6b16
--- /dev/null
+++ b/gabble/caps-hash.h
@@ -0,0 +1,34 @@
+/*
+ * caps-hash.h - caps computing string hash (XEP-0115 v1.5) API available to telepathy-gabble plugins
+ * Copyright (C) 2008-2010 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_PLUGINS_CAPS_HASH_H
+#define GABBLE_PLUGINS_CAPS_HASH_H
+
+#include <glib.h>
+
+#include <gabble/capabilities-set.h>
+
+G_BEGIN_DECLS
+
+gchar *gabble_caps_hash_compute (const GabbleCapabilitySet *cap_set,
+ const GPtrArray *identities) G_GNUC_WARN_UNUSED_RESULT;
+
+G_END_DECLS
+
+#endif
diff --git a/gabble/connection.h b/gabble/connection.h
new file mode 100644
index 000000000..575412bb0
--- /dev/null
+++ b/gabble/connection.h
@@ -0,0 +1,60 @@
+/*
+ * 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 <gabble/capabilities-set.h>
+#include <gabble/types.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;
+
+G_END_DECLS
+
+#endif
diff --git a/gabble/disco-identity.h b/gabble/disco-identity.h
new file mode 100644
index 000000000..992e24707
--- /dev/null
+++ b/gabble/disco-identity.h
@@ -0,0 +1,50 @@
+/*
+ * disco-identity.h — utility API representing a Disco Identity for 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_DISCO_IDENTITY_H
+#define GABBLE_PLUGINS_DISCO_IDENTITY_H
+
+#include <glib.h>
+
+#include <gabble/types.h>
+
+G_BEGIN_DECLS
+
+GabbleDiscoIdentity *gabble_disco_identity_new (const gchar *category,
+ const gchar *type, const gchar *lang, const gchar *name);
+
+GabbleDiscoIdentity *gabble_disco_identity_copy (
+ const GabbleDiscoIdentity *source);
+
+const gchar *gabble_disco_identity_get_category (GabbleDiscoIdentity *identity);
+const gchar *gabble_disco_identity_get_type (GabbleDiscoIdentity *identity);
+const gchar *gabble_disco_identity_get_lang (GabbleDiscoIdentity *identity);
+const gchar *gabble_disco_identity_get_name (GabbleDiscoIdentity *identity);
+
+void gabble_disco_identity_free (GabbleDiscoIdentity *identity);
+
+/* array of GabbleDiscoIdentity helper methods */
+GPtrArray *gabble_disco_identity_array_new (void);
+GPtrArray *gabble_disco_identity_array_copy (const GPtrArray *source);
+void gabble_disco_identity_array_free (GPtrArray *arr);
+
+G_END_DECLS
+
+#endif
diff --git a/gabble/error.h b/gabble/error.h
index a44b5dabe..e6a965f75 100644
--- a/gabble/error.h
+++ b/gabble/error.h
@@ -1,5 +1,5 @@
-/* error.h — error API available to telepathy-gabble plugins (and internals)
- *
+/*
+ * error.h — error API available to telepathy-gabble plugins (and internals)
* Copyright © 2010 Collabora Ltd.
*
* This library is free software; you can redistribute it and/or
@@ -17,11 +17,18 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef IN_GABBLE_PLUGINS_GABBLE_H
-#error Use #include <gabble/gabble.h> instead of <gabble/error.h>
-#endif
+#ifndef GABBLE_PLUGINS_ERROR_H
+#define GABBLE_PLUGINS_ERROR_H
+
+#include <glib.h>
#include <wocky/wocky-xmpp-error.h>
+G_BEGIN_DECLS
+
void gabble_set_tp_error_from_wocky (const GError *wocky_error,
GError **error);
+
+G_END_DECLS
+
+#endif
diff --git a/gabble/gabble.h b/gabble/gabble.h
index e9f1bf172..41fc93cc0 100644
--- a/gabble/gabble.h
+++ b/gabble/gabble.h
@@ -1,5 +1,5 @@
-/* gabble/gabble.h — API for telepathy-gabble plugins
- *
+/*
+ * gabble.h — API for telepathy-gabble plugins
* Copyright © 2010 Collabora Ltd.
*
* This library is free software; you can redistribute it and/or
@@ -24,9 +24,15 @@
#include <glib-object.h>
+#include <gabble/capabilities-set.h>
+#include <gabble/caps-hash.h>
+#include <gabble/connection.h>
+#include <gabble/disco-identity.h>
#include <gabble/error.h>
+#include <gabble/namespaces.h>
#include <gabble/plugin.h>
#include <gabble/sidecar.h>
+#include <gabble/types.h>
#undef IN_GABBLE_PLUGINS_GABBLE_H
diff --git a/gabble/namespaces.h b/gabble/namespaces.h
new file mode 100644
index 000000000..d8e145f25
--- /dev/null
+++ b/gabble/namespaces.h
@@ -0,0 +1,27 @@
+/*
+ * namespaces.h — namespace constants definitions that can be used by telepathy-gabble plugins
+ * Copyright © 2009 Collabora Ltd.
+ * Copyright © 2009 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_NAMESPACES_H
+#define GABBLE_PLUGINS_NAMESPACES_H
+
+#define NS_CAPS "http://jabber.org/protocol/caps"
+#define NS_GABBLE_CAPS "http://telepathy.freedesktop.org/caps"
+
+#endif
diff --git a/gabble/plugin.h b/gabble/plugin.h
index 3b072471f..5fc2c3bfc 100644
--- a/gabble/plugin.h
+++ b/gabble/plugin.h
@@ -1,5 +1,5 @@
/*
- * plugin.h — API for telepathy-gabble plugins
+ * plugin.h — plugin API for telepathy-gabble plugins
* Copyright © 2009 Collabora Ltd.
* Copyright © 2009 Nokia Corporation
*
@@ -17,8 +17,9 @@
* 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 __PLUGIN_H__
-#define __PLUGIN_H__
+
+#ifndef GABBLE_PLUGINS_PLUGIN_H
+#define GABBLE_PLUGINS_PLUGIN_H
#include <glib-object.h>
#include <gio/gio.h>
@@ -26,7 +27,11 @@
#include <telepathy-glib/base-connection.h>
#include <wocky/wocky-session.h>
+#include <gabble/connection.h>
#include <gabble/sidecar.h>
+#include <gabble/types.h>
+
+G_BEGIN_DECLS
#define GABBLE_TYPE_PLUGIN (gabble_plugin_get_type ())
#define GABBLE_PLUGIN(obj) \
@@ -37,13 +42,12 @@
(G_TYPE_INSTANCE_GET_INTERFACE ((obj), GABBLE_TYPE_PLUGIN, \
GabblePluginInterface))
-typedef struct _GabblePlugin GabblePlugin;
typedef struct _GabblePluginInterface GabblePluginInterface;
typedef void (*GabblePluginCreateSidecarImpl) (
GabblePlugin *plugin,
const gchar *sidecar_interface,
- TpBaseConnection *connection,
+ GabbleConnection *connection,
WockySession *session,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -90,7 +94,7 @@ gboolean gabble_plugin_implements_sidecar (
void gabble_plugin_create_sidecar (
GabblePlugin *plugin,
const gchar *sidecar_interface,
- TpBaseConnection *connection,
+ GabbleConnection *connection,
WockySession *session,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -111,4 +115,6 @@ GabblePlugin *gabble_plugin_create (void);
typedef GabblePlugin *(*GabblePluginCreateImpl) (void);
+G_END_DECLS
+
#endif
diff --git a/gabble/sidecar.h b/gabble/sidecar.h
index 531a7f95e..923c50667 100644
--- a/gabble/sidecar.h
+++ b/gabble/sidecar.h
@@ -1,5 +1,5 @@
/*
- * sidecar.h — interface for connection sidecars
+ * sidecar.h — sidecar API available to telepathy-gabble plugins
* Copyright © 2009 Collabora Ltd.
* Copyright © 2009 Nokia Corporation
*
@@ -17,11 +17,16 @@
* 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 __SIDECAR_H__
-#define __SIDECAR_H__
+
+#ifndef GABBLE_PLUGINS_SIDECAR_H
+#define GABBLE_PLUGINS_SIDECAR_H
#include <glib-object.h>
+#include <gabble/types.h>
+
+G_BEGIN_DECLS
+
#define GABBLE_TYPE_SIDECAR (gabble_sidecar_get_type ())
#define GABBLE_SIDECAR(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GABBLE_TYPE_SIDECAR, GabbleSidecar))
@@ -31,7 +36,6 @@
(G_TYPE_INSTANCE_GET_INTERFACE ((obj), GABBLE_TYPE_SIDECAR, \
GabbleSidecarInterface))
-typedef struct _GabbleSidecar GabbleSidecar;
typedef struct _GabbleSidecarInterface GabbleSidecarInterface;
typedef GHashTable * (*GabbleSidecarGetImmutablePropertiesImpl) (
@@ -56,4 +60,6 @@ GType gabble_sidecar_get_type (void);
const gchar *gabble_sidecar_get_interface (GabbleSidecar *sidecar);
GHashTable *gabble_sidecar_get_immutable_properties (GabbleSidecar *sidecar);
+G_END_DECLS
+
#endif
diff --git a/gabble/types.h b/gabble/types.h
new file mode 100644
index 000000000..814189ce1
--- /dev/null
+++ b/gabble/types.h
@@ -0,0 +1,36 @@
+/*
+ * types.h - type definitions 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_TYPES_H
+#define GABBLE_PLUGINS_TYPES_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GabbleCapabilitySet GabbleCapabilitySet;
+typedef struct _GabbleConnection GabbleConnection;
+typedef struct _GabbleDiscoIdentity GabbleDiscoIdentity;
+typedef struct _GabblePlugin GabblePlugin;
+typedef struct _GabbleSidecar GabbleSidecar;
+
+G_END_DECLS
+
+#endif