diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2011-09-28 18:58:10 +0100 |
---|---|---|
committer | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2011-09-28 18:58:10 +0100 |
commit | a64cd72472d48ad8e88bfebe5e6046f02d4b5c93 (patch) | |
tree | 3a6c29cc5719c0b20f86fc15732d11b3e39556f1 /gabble | |
parent | 5f1ad2c76f43842856fb01a2dc51648a42f24284 (diff) | |
parent | 9c86f446c6a00142c373aae1fa357f5c00f0f2c6 (diff) |
Merge branch 'moar-caps'
Diffstat (limited to 'gabble')
-rw-r--r-- | gabble/capabilities.h | 74 | ||||
-rw-r--r-- | gabble/caps-channel-manager.h | 107 | ||||
-rw-r--r-- | gabble/connection.h | 23 | ||||
-rw-r--r-- | gabble/gabble.h | 2 |
4 files changed, 206 insertions, 0 deletions
diff --git a/gabble/capabilities.h b/gabble/capabilities.h new file mode 100644 index 000000000..2e3175529 --- /dev/null +++ b/gabble/capabilities.h @@ -0,0 +1,74 @@ +/* + * capabilities.h - Connection.Interface.Capabilities constants and utilities + * Copyright (C) 2005 Collabora Ltd. + * Copyright (C) 2005 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_CAPABILITIES__H__ +#define __GABBLE_CAPABILITIES__H__ + +#include <glib-object.h> + +#include <gabble/capabilities-set.h> + +/* Pseudo-capabilities for buggy or strange implementations, represented as + * strings starting with a character not allowed in XML (the ASCII beep :-) */ +#define QUIRK_PREFIX_CHAR '\x07' +#define QUIRK_PREFIX "\x07" +/* Gabble 0.7.x with 16 <= x < 29 omits @creator on <content/> */ +#define QUIRK_OMITS_CONTENT_CREATORS "\x07omits-content-creators" +/* The Google Webmail client doesn't support some features */ +#define QUIRK_GOOGLE_WEBMAIL_CLIENT "\x07google-webmail-client" + +/* Some useful capability sets for Jingle etc. */ +const GabbleCapabilitySet *gabble_capabilities_get_legacy (void); +const GabbleCapabilitySet *gabble_capabilities_get_any_audio (void); +const GabbleCapabilitySet *gabble_capabilities_get_any_video (void); +const GabbleCapabilitySet *gabble_capabilities_get_any_audio_video (void); +const GabbleCapabilitySet *gabble_capabilities_get_any_google_av (void); +const GabbleCapabilitySet *gabble_capabilities_get_any_jingle_av (void); +const GabbleCapabilitySet *gabble_capabilities_get_any_transport (void); +const GabbleCapabilitySet *gabble_capabilities_get_geoloc_notify (void); +const GabbleCapabilitySet *gabble_capabilities_get_olpc_notify (void); + +/* XEP-0115 version 1.3: + * + * "The names of the feature bundles MUST NOT be used for semantic purposes: + * they are merely opaque identifiers" + * + * However, some old Jabber clients (e.g. Gabble 0.2) and various Google + * clients require the bundle names "voice-v1" and "video-v1". We keep these + * names for compatibility. + */ +#define BUNDLE_SHARE_V1 "share-v1" +#define BUNDLE_VOICE_V1 "voice-v1" +#define BUNDLE_VIDEO_V1 "video-v1" +#define BUNDLE_CAMERA_V1 "camera-v1" +#define BUNDLE_PMUC_V1 "pmuc-v1" + +const GabbleCapabilitySet *gabble_capabilities_get_bundle_share_v1 (void); +const GabbleCapabilitySet *gabble_capabilities_get_bundle_voice_v1 (void); +const GabbleCapabilitySet *gabble_capabilities_get_bundle_video_v1 (void); + +/* Return the capabilities we always have */ +const GabbleCapabilitySet *gabble_capabilities_get_fixed_caps (void); + +void gabble_capabilities_init (gpointer conn); +void gabble_capabilities_finalize (gpointer conn); + +#endif /* __GABBLE_CAPABILITIES__H__ */ + diff --git a/gabble/caps-channel-manager.h b/gabble/caps-channel-manager.h new file mode 100644 index 000000000..9442476ac --- /dev/null +++ b/gabble/caps-channel-manager.h @@ -0,0 +1,107 @@ +/* + * 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, GabbleCapsChannelManagerInterface)) + +typedef struct _GabbleCapsChannelManager GabbleCapsChannelManager; +typedef struct _GabbleCapsChannelManagerInterface GabbleCapsChannelManagerInterface; + +/* 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, + GPtrArray *data_forms); + +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, + GPtrArray *data_forms); + +struct _GabbleCapsChannelManagerInterface { + 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 diff --git a/gabble/connection.h b/gabble/connection.h index 575412bb0..0c946cf1f 100644 --- a/gabble/connection.h +++ b/gabble/connection.h @@ -22,10 +22,13 @@ #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 ()) @@ -55,6 +58,26 @@ gchar *gabble_connection_add_sidecar_own_caps ( const GabbleCapabilitySet *cap_set, const GPtrArray *identities) 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 fe1a50277..8393ae8c7 100644 --- a/gabble/gabble.h +++ b/gabble/gabble.h @@ -24,7 +24,9 @@ #include <glib-object.h> +#include <gabble/capabilities.h> #include <gabble/capabilities-set.h> +#include <gabble/caps-channel-manager.h> #include <gabble/caps-hash.h> #include <gabble/connection.h> #include <gabble/error.h> |