summaryrefslogtreecommitdiff
path: root/salut
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2011-03-18 09:32:44 +0000
committerJonny Lamb <jonny.lamb@collabora.co.uk>2011-03-18 09:32:44 +0000
commit42f10a68a6075ad711c46ca375b85429cc5a0a4c (patch)
treee4fae9186a79c0ca3f4513ff17641d3c0c17486f /salut
parent73a0c0372789fe13154fddb89eef2a9a010bdd4c (diff)
downloadtelepathy-salut-42f10a68a6075ad711c46ca375b85429cc5a0a4c.tar.gz
salut: make caps-channel-manager and capabilities-set public salut API
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
Diffstat (limited to 'salut')
-rw-r--r--salut/Makefile.am4
-rw-r--r--salut/capabilities-set.h86
-rw-r--r--salut/caps-channel-manager.h106
3 files changed, 195 insertions, 1 deletions
diff --git a/salut/Makefile.am b/salut/Makefile.am
index ca46c477..5a4eaeef 100644
--- a/salut/Makefile.am
+++ b/salut/Makefile.am
@@ -5,6 +5,8 @@ pkgconfig_DATA = telepathy-salut.pc
salutincludedir = $(includedir)/telepathy-salut-0/salut
salutinclude_HEADERS = \
plugin.h \
- protocol.h
+ protocol.h \
+ capabilities-set.h \
+ caps-channel-manager.h
endif
diff --git a/salut/capabilities-set.h b/salut/capabilities-set.h
new file mode 100644
index 00000000..3f215259
--- /dev/null
+++ b/salut/capabilities-set.h
@@ -0,0 +1,86 @@
+/*
+ * 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>
+
+G_BEGIN_DECLS
+
+/**
+ * GabbleCapabilitySet:
+ *
+ * A set of capabilities.
+ */
+typedef struct _GabbleCapabilitySet GabbleCapabilitySet;
+
+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);
+gchar *gabble_capability_set_dump_diff (const GabbleCapabilitySet *old_caps,
+ const GabbleCapabilitySet *new_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/salut/caps-channel-manager.h b/salut/caps-channel-manager.h
new file mode 100644
index 00000000..e5623bbf
--- /dev/null
+++ b/salut/caps-channel-manager.h
@@ -0,0 +1,106 @@
+/*
+ * caps-channel-manager.h - interface holding capabilities functions for
+ * channel managers
+ *
+ * Copyright (C) 2008 Collabora Ltd.
+ * Copyright (C) 2008 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_CAPS_CHANNEL_MANAGER_H
+#define GABBLE_CAPS_CHANNEL_MANAGER_H
+
+#include <glib-object.h>
+#include <telepathy-glib/exportable-channel.h>
+#include <telepathy-glib/handle.h>
+
+#include "capabilities.h"
+
+G_BEGIN_DECLS
+
+#define GABBLE_TYPE_CAPS_CHANNEL_MANAGER \
+ (gabble_caps_channel_manager_get_type ())
+
+#define GABBLE_CAPS_CHANNEL_MANAGER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ GABBLE_TYPE_CAPS_CHANNEL_MANAGER, GabbleCapsChannelManager))
+
+#define GABBLE_IS_CAPS_CHANNEL_MANAGER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ GABBLE_TYPE_CAPS_CHANNEL_MANAGER))
+
+#define GABBLE_CAPS_CHANNEL_MANAGER_GET_INTERFACE(obj) \
+ (G_TYPE_INSTANCE_GET_INTERFACE ((obj), \
+ GABBLE_TYPE_CAPS_CHANNEL_MANAGER, GabbleCapsChannelManagerIface))
+
+typedef struct _GabbleCapsChannelManager GabbleCapsChannelManager;
+typedef struct _GabbleCapsChannelManagerIface GabbleCapsChannelManagerIface;
+
+
+/* virtual methods */
+
+typedef void (*GabbleCapsChannelManagerGetContactCapsFunc) (
+ GabbleCapsChannelManager *manager,
+ TpHandle handle,
+ const GabbleCapabilitySet *caps,
+ GPtrArray *arr);
+
+typedef void (*GabbleCapsChannelManagerResetCapsFunc) (
+ GabbleCapsChannelManager *manager);
+
+typedef void (*GabbleCapsChannelManagerAddCapFunc) (
+ GabbleCapsChannelManager *manager,
+ GHashTable *cap,
+ GabbleCapabilitySet *cap_set);
+
+typedef void (*GabbleCapsChannelManagerRepresentClientFunc) (
+ GabbleCapsChannelManager *manager,
+ const gchar *client_name,
+ const GPtrArray *filters,
+ const gchar * const *cap_tokens,
+ GabbleCapabilitySet *cap_set);
+
+void gabble_caps_channel_manager_reset_capabilities (
+ GabbleCapsChannelManager *caps_manager);
+
+void gabble_caps_channel_manager_get_contact_capabilities (
+ GabbleCapsChannelManager *caps_manager,
+ TpHandle handle,
+ const GabbleCapabilitySet *caps,
+ GPtrArray *arr);
+
+void gabble_caps_channel_manager_represent_client (
+ GabbleCapsChannelManager *caps_manager,
+ const gchar *client_name,
+ const GPtrArray *filters,
+ const gchar * const *cap_tokens,
+ GabbleCapabilitySet *cap_set);
+
+struct _GabbleCapsChannelManagerIface {
+ GTypeInterface parent;
+
+ GabbleCapsChannelManagerResetCapsFunc reset_caps;
+ GabbleCapsChannelManagerGetContactCapsFunc get_contact_caps;
+ GabbleCapsChannelManagerRepresentClientFunc represent_client;
+
+ gpointer priv;
+};
+
+GType gabble_caps_channel_manager_get_type (void);
+
+G_END_DECLS
+
+#endif