From a49f383ac9303285abab8de28b49dddda5bc8920 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Tue, 4 Feb 2014 10:31:09 +0100 Subject: [PATCH] remove Decloak extension It's not used by Call1 and is not XMPP spec compliant. --- extensions/Connection_Interface_Gabble_Decloak.xml | 113 ------------- extensions/Makefile.am | 1 - extensions/all.xml | 2 - src/conn-presence.c | 64 ------- src/conn-presence.h | 4 - src/connection.c | 58 ------- src/connection.h | 3 - src/presence-cache.c | 183 --------------------- src/presence-cache.h | 3 - src/protocol.c | 9 - tests/twisted/Makefile.am | 2 - tests/twisted/constants.py | 1 - tests/twisted/jingle/decloak-peer.py | 66 -------- tests/twisted/presence/decloak.py | 71 -------- 14 files changed, 580 deletions(-) delete mode 100644 extensions/Connection_Interface_Gabble_Decloak.xml delete mode 100644 tests/twisted/jingle/decloak-peer.py delete mode 100644 tests/twisted/presence/decloak.py diff --git a/extensions/Connection_Interface_Gabble_Decloak.xml b/extensions/Connection_Interface_Gabble_Decloak.xml deleted file mode 100644 index 98e441a..0000000 --- a/extensions/Connection_Interface_Gabble_Decloak.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - Copyright © 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 Street, Fifth Floor, Boston, MA 02110-1301, - USA.

-
- - - (Gabble-specific) - - - - A simple D-Bus API for XEP-0276 Temporary - Presence Sharing. See the XEP for more details. - - - - -

If true, the connection manager will automatically disclose the - local user's capabilities (and hence the fact that they are online, - but no further presence information) on request from any remote XMPP - user.

- - -

This is necessary to allow incoming calls from arbitrary - users.

-
- -

This property SHOULD also be available as a connection manager - parameter, with the DBus_Property flag. The default SHOULD be false - since this constitutes a deliberate presence leak.

-
-
- - - - Emitted when a remote contact asks for the local user's capabilities - and basic presence to be disclosed. - - - - - The contact asking for presence disclosure - - - - - - A code indicating the reason that decloaking is requested, or the - empty string if no reason code was given. As per the proto-XEP, - well-known values are 'media' (remote contact wants to call local - user), 'text' (remote contact wants to establish a text messaging - session, perhaps end-to-end encrypted), and 'file' (remote contact - wants to send the local user a file). - - - - - - If true, the connection manager automatically disclosed the local user's - capabilities and basic presence in response to the request, and this - signal is merely for information. If false, presence was not - automatically disclosed; a user interface MAY respond by calling - SendDirectedPresence. - - - - - - - Send directed presence to a contact. This MAY be called at any time, - but will typically be used as a response to - DecloakRequested - - - - - The contact to send directed presence to. - - - - - - If true, full presence (status, message, avatar hash etc.) will be - directed to the specified contact. If false, only capabilities and - the fact that the user is online at all will be directed to the - specified contact (the local user will appear to that contact as - being in 'available' status). - - - - -
-
- diff --git a/extensions/Makefile.am b/extensions/Makefile.am index f05bec0..f9469f0 100644 --- a/extensions/Makefile.am +++ b/extensions/Makefile.am @@ -2,7 +2,6 @@ tools_dir = $(top_srcdir)/tools EXTRA_DIST = \ all.xml \ - Connection_Interface_Gabble_Decloak.xml \ Gabble_Plugin_Console.xml \ Gabble_Plugin_Gateways.xml \ Gabble_Plugin_Test.xml \ diff --git a/extensions/all.xml b/extensions/all.xml index ce50dec..300b2d0 100644 --- a/extensions/all.xml +++ b/extensions/all.xml @@ -33,8 +33,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

from="Telepathy specification"/> - - diff --git a/src/conn-presence.c b/src/conn-presence.c index 06cad2c..2fc09d2 100644 --- a/src/conn-presence.c +++ b/src/conn-presence.c @@ -31,8 +31,6 @@ #define DEBUG_FLAG GABBLE_DEBUG_CONNECTION -#include "extensions/extensions.h" /* for Decloak */ - #include "connection.h" #include "debug.h" #include "plugin-loader.h" @@ -2013,65 +2011,3 @@ conn_presence_finalize (GabbleConnection *conn) tp_presence_mixin_finalize ((GObject *) conn); } - -static void -conn_presence_send_directed_presence ( - GabbleSvcConnectionInterfaceGabbleDecloak *conn, - guint contact, - gboolean full, - DBusGMethodInvocation *context) -{ - GabbleConnection *self = GABBLE_CONNECTION (conn); - TpBaseConnection *base = TP_BASE_CONNECTION (conn); - TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); - const gchar *jid = tp_handle_inspect (contact_handles, contact); - gboolean ok; - GError *error = NULL; - - g_return_if_fail (jid != NULL); - - /* We don't strictly respect @full - we'll always send full presence to - * people we think ought to be receiving it anyway, because if we didn't, - * you could confuse them by sending directed presence that was less - * informative than the broadcast presence they already saw. */ - if (full || conn_presence_visible_to (self, contact)) - { - ok = conn_presence_signal_own_presence (self, jid, &error); - } - else - { - ok = gabble_connection_send_capabilities (self, jid, &error); - } - - if (ok) - { - gabble_svc_connection_interface_gabble_decloak_return_from_send_directed_presence (context); - } - else - { - dbus_g_method_return_error (context, error); - g_error_free (error); - } -} - -void -conn_decloak_emit_requested (GabbleConnection *conn, - TpHandle contact, - const gchar *reason, - gboolean decloaked) -{ - gabble_svc_connection_interface_gabble_decloak_emit_decloak_requested (conn, - contact, reason, decloaked); -} - -void -conn_decloak_iface_init (gpointer g_iface, - gpointer iface_data) -{ -#define IMPLEMENT(x) \ - gabble_svc_connection_interface_gabble_decloak_implement_##x (\ - g_iface, conn_presence_##x) - IMPLEMENT (send_directed_presence); -#undef IMPLEMENT -} diff --git a/src/conn-presence.h b/src/conn-presence.h index 6756f69..4b060c6 100644 --- a/src/conn-presence.h +++ b/src/conn-presence.h @@ -56,10 +56,6 @@ void conn_presence_set_initial_presence_async (GabbleConnection *self, gboolean conn_presence_set_initial_presence_finish (GabbleConnection *self, GAsyncResult *result, GError **error); -void conn_decloak_iface_init (gpointer g_iface, gpointer iface_data); -void conn_decloak_emit_requested (GabbleConnection *conn, - TpHandle contact, const gchar *reason, gboolean decloaked); - TpConnectionPresenceType conn_presence_get_type (GabblePresence *presence); const TpPresenceStatusSpec *conn_presence_statuses (void); diff --git a/src/connection.c b/src/connection.c index 0eaed01..72a4472 100644 --- a/src/connection.c +++ b/src/connection.c @@ -109,8 +109,6 @@ G_DEFINE_TYPE_WITH_CODE(GabbleConnection, tp_base_contact_list_mixin_blocking_iface_init); G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_PRESENCE1, tp_presence_mixin_iface_init); - G_IMPLEMENT_INTERFACE (GABBLE_TYPE_SVC_CONNECTION_INTERFACE_GABBLE_DECLOAK, - conn_decloak_iface_init); G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_LOCATION1, location_iface_init); G_IMPLEMENT_INTERFACE @@ -156,7 +154,6 @@ enum PROP_ALIAS, PROP_FALLBACK_SOCKS5_PROXIES, PROP_KEEPALIVE_INTERVAL, - PROP_DECLOAK_AUTOMATICALLY, PROP_FALLBACK_SERVERS, PROP_EXTRA_CERTIFICATE_IDENTITIES, PROP_POWER_SAVING, @@ -204,8 +201,6 @@ struct _GabbleConnectionPrivate GStrv fallback_socks5_proxies; - gboolean decloak_automatically; - GStrv fallback_servers; guint fallback_server_index; @@ -617,10 +612,6 @@ gabble_connection_get_property (GObject *object, g_value_set_uint (value, priv->keepalive_interval); break; - case PROP_DECLOAK_AUTOMATICALLY: - g_value_set_boolean (value, priv->decloak_automatically); - break; - case PROP_FALLBACK_SERVERS: g_value_set_boxed (value, priv->fallback_servers); break; @@ -766,10 +757,6 @@ gabble_connection_set_property (GObject *object, priv->keepalive_interval, NULL); break; - case PROP_DECLOAK_AUTOMATICALLY: - priv->decloak_automatically = g_value_get_boolean (value); - break; - case PROP_FALLBACK_SERVERS: if (priv->fallback_servers != NULL) g_strfreev (priv->fallback_servers); @@ -857,7 +844,6 @@ static const gchar *implemented_interfaces[] = { TP_IFACE_CONNECTION_INTERFACE_CONTACT_GROUPS1, TP_IFACE_CONNECTION_INTERFACE_CONTACT_CAPABILITIES1, TP_IFACE_CONNECTION_INTERFACE_LOCATION1, - GABBLE_IFACE_CONNECTION_INTERFACE_GABBLE_DECLOAK, TP_IFACE_CONNECTION_INTERFACE_SIDECARS1, TP_IFACE_CONNECTION_INTERFACE_CLIENT_TYPES1, TP_IFACE_CONNECTION_INTERFACE_ADDRESSING1, @@ -924,10 +910,6 @@ gabble_connection_class_init (GabbleConnectionClass *gabble_connection_class) { "SupportedLocationFeatures", NULL, NULL }, { NULL } }; - static TpDBusPropertiesMixinPropImpl decloak_props[] = { - { "DecloakAutomatically", TWICE ("decloak-automatically") }, - { NULL } - }; static TpDBusPropertiesMixinPropImpl mail_notif_props[] = { { "MailNotificationFlags", NULL, NULL }, { "UnreadMailCount", NULL, NULL }, @@ -955,11 +937,6 @@ gabble_connection_class_init (GabbleConnectionClass *gabble_connection_class) NULL, NULL, }, - /* 3 */ { GABBLE_IFACE_CONNECTION_INTERFACE_GABBLE_DECLOAK, - tp_dbus_properties_mixin_getter_gobject_properties, - tp_dbus_properties_mixin_setter_gobject_properties, - decloak_props, - }, { TP_IFACE_CONNECTION_INTERFACE_MAIL_NOTIFICATION1, conn_mail_notif_properties_getter, NULL, @@ -1183,14 +1160,6 @@ gabble_connection_class_init (GabbleConnectionClass *gabble_connection_class) G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property ( - object_class, PROP_DECLOAK_AUTOMATICALLY, - g_param_spec_boolean ( - "decloak-automatically", "Decloak automatically?", - "Leak presence and capabilities when requested", - FALSE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property ( object_class, PROP_DOWNLOAD_AT_CONNECTION, g_param_spec_boolean ( "download-roster-at-connection", @@ -2424,33 +2393,6 @@ gabble_connection_send_capabilities (GabbleConnection *self, return ret; } -gboolean -gabble_connection_request_decloak (GabbleConnection *self, - const gchar *to, - const gchar *reason, - GError **error) -{ - GabblePresence *presence = self->self_presence; - WockyStanza *message = gabble_presence_as_message (presence, to); - WockyNode *decloak; - gboolean ret; - - gabble_connection_fill_in_caps (self, message); - - decloak = wocky_node_add_child_ns (wocky_stanza_get_top_node (message), - "temppres", NS_TEMPPRES); - - if (reason != NULL && *reason != '\0') - { - wocky_node_set_attribute (decloak, "reason", reason); - } - - ret = _gabble_connection_send (self, message, error); - g_object_unref (message); - - return ret; -} - static gboolean gabble_connection_refresh_capabilities (GabbleConnection *self, GabbleCapabilitySet **old_out) diff --git a/src/connection.h b/src/connection.h index eb775f2..92dc2a9 100644 --- a/src/connection.h +++ b/src/connection.h @@ -283,9 +283,6 @@ gboolean gabble_connection_send_presence (GabbleConnection *conn, gboolean gabble_connection_send_capabilities (GabbleConnection *self, const gchar *recipient, GError **error); -gboolean gabble_connection_request_decloak (GabbleConnection *self, - const gchar *to, const gchar *reason, GError **error); - void gabble_connection_fill_in_caps (GabbleConnection *self, WockyStanza *presence_message); diff --git a/src/presence-cache.c b/src/presence-cache.c index 92bc358..24ec7b4 100644 --- a/src/presence-cache.c +++ b/src/presence-cache.c @@ -55,10 +55,6 @@ * got initial presence from all the contacts. */ #define UNSURE_PERIOD 5 -/* Time period from a de-cloak request in which we're unsure whether the - * contact will disclose their presence later, or not at all. */ -#define DECLOAK_PERIOD 5 - G_DEFINE_TYPE (GabblePresenceCache, gabble_presence_cache, G_TYPE_OBJECT); /* properties */ @@ -100,9 +96,6 @@ struct _GabblePresenceCachePrivate guint caps_serial; guint unsure_id; - /* handle => DecloakContext */ - GHashTable *decloak_requests; - TpHandleSet *decloak_handles; /* The cached contacts' location. * The key is the contact's TpHandle. @@ -309,40 +302,6 @@ capability_info_recvd (GabblePresenceCache *cache, return info->trust; } -typedef struct { - GabblePresenceCache *cache; - TpHandle handle; - guint timeout_id; - const gchar *reason; -} DecloakContext; - -static DecloakContext * -decloak_context_new (GabblePresenceCache *cache, - TpHandle handle, - const gchar *reason) -{ - DecloakContext *dc = g_slice_new0 (DecloakContext); - - dc->cache = cache; - dc->handle = handle; - dc->reason = reason; - dc->timeout_id = 0; - return dc; -} - -static void -decloak_context_free (gpointer data) -{ - DecloakContext *dc = data; - - tp_handle_set_remove (dc->cache->priv->decloak_handles, dc->handle); - - if (dc->timeout_id != 0) - g_source_remove (dc->timeout_id); - - g_slice_free (DecloakContext, dc); -} - static void gabble_presence_cache_init (GabblePresenceCache *presence_cache); static GObject * gabble_presence_cache_constructor (GType type, guint n_props, GObjectConstructParam *props); @@ -484,9 +443,6 @@ gabble_presence_cache_init (GabblePresenceCache *cache) g_free, (GDestroyNotify) disco_waiter_list_free); priv->caps_serial = 1; - priv->decloak_requests = g_hash_table_new_full (NULL, NULL, NULL, - decloak_context_free); - priv->location = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, (GDestroyNotify) g_hash_table_unref); } @@ -524,7 +480,6 @@ gabble_presence_cache_constructor (GType type, guint n_props, g_assert (priv->conn != NULL); g_assert (priv->presence_handles != NULL); - g_assert (priv->decloak_handles != NULL); gabble_presence_cache_add_bundles ((GabblePresenceCache *) obj); @@ -555,9 +510,6 @@ gabble_presence_cache_dispose (GObject *object) priv->unsure_id = 0; } - tp_clear_pointer (&priv->decloak_requests, g_hash_table_unref); - tp_clear_pointer (&priv->decloak_handles, tp_handle_set_destroy); - g_assert (priv->message_cb == 0); g_assert (priv->presence_cb == 0); @@ -614,13 +566,11 @@ gabble_presence_cache_set_property (GObject *object, case PROP_CONNECTION: g_assert (priv->conn == NULL); /* construct-only */ g_assert (priv->presence_handles == NULL); /* construct-only */ - g_assert (priv->decloak_handles == NULL); /* construct-only */ priv->conn = g_value_get_object (value); contact_repo = tp_base_connection_get_handles ( (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); priv->presence_handles = tp_handle_set_new (contact_repo); - priv->decloak_handles = tp_handle_set_new (contact_repo); break; default: @@ -1756,53 +1706,6 @@ _process_caps (GabblePresenceCache *cache, g_slist_free (uris); } -static void -presence_cache_check_for_decloak_request ( - GabblePresenceCache *cache, - WockyStanza *stanza, - TpHandle handle, - const gchar *from) -{ - GabblePresenceCachePrivate *priv = cache->priv; - WockyNode *presence_node = wocky_stanza_get_top_node (stanza); - WockyNode *child_node; - - /* If we receive (directed or broadcast) presence of any sort from someone, - * it counts as a reply to any pending de-cloak request we might have been - * tracking */ - g_hash_table_remove (priv->decloak_requests, GUINT_TO_POINTER (handle)); - - child_node = wocky_node_get_child_ns (presence_node, "temppres", - NS_TEMPPRES); - - if (child_node != NULL) - { - gboolean decloak; - const gchar *reason; - - /* this is a request to de-cloak, i.e. leak a minimal version of our - * presence to the peer */ - g_object_get (priv->conn, - "decloak-automatically", &decloak, - NULL); - - reason = wocky_node_get_attribute (child_node, "reason"); - - if (reason == NULL) - reason = ""; - - DEBUG ("Considering whether to decloak, reason='%s', conclusion=%d", - reason, decloak); - - conn_decloak_emit_requested (priv->conn, handle, reason, decloak); - - if (decloak) - gabble_connection_send_capabilities (priv->conn, from, NULL); - } - -} - - /* FIXME: in a cruel twist of fate, this is called by GabbleMucChannel! * Presumably this is because the handler priority here is MIN, so WockyMuc * steals the presence stanza before we can scrape our information out of it? @@ -1856,8 +1759,6 @@ gabble_presence_parse_presence_message ( if (prio != NULL) priority = CLAMP (atoi (prio), G_MININT8, G_MAXINT8); - presence_cache_check_for_decloak_request (cache, message, handle, from); - wocky_stanza_get_type_info (message, NULL, &sub_type); switch (sub_type) { @@ -2411,94 +2312,10 @@ gabble_presence_cache_is_unsure (GabblePresenceCache *cache, return TRUE; } - /* if we're waiting for a de-cloak response, we're unsure */ - if (tp_handle_set_is_member (priv->decloak_handles, handle)) - { - DEBUG ("Waiting to see if %u will decloak", handle); - return TRUE; - } - DEBUG ("No, I'm sure about %u by now", handle); return FALSE; } -static gboolean -gabble_presence_cache_decloak_timeout_cb (gpointer data) -{ - DecloakContext *dc = data; - GabblePresenceCache *self = dc->cache; - TpHandle handle = dc->handle; - - DEBUG ("De-cloak request for %u timed out", handle); - - /* This frees @dc, do not dereference it afterwards. This needs to be done - * before emitting the signal, so that when recipients of the channel ask - * whether we're unsure about the handle, there is no pending decloak - * request that would make us unsure. */ - g_hash_table_remove (self->priv->decloak_requests, - GUINT_TO_POINTER (handle)); - /* As a side-effect of freeing @dc, this should have happened. */ - g_assert (!tp_handle_set_is_member (self->priv->decloak_handles, handle)); - - /* FIXME: this is an abuse of this signal, but it serves the same - * purpose: poking any pending media channels to tell them that @handle - * might have left the "unsure" state */ - emit_capabilities_discovered (self, handle); - - return FALSE; -} - -/* @reason must be a statically-allocated string. */ -gboolean -gabble_presence_cache_request_decloaking (GabblePresenceCache *self, - TpHandle handle, - const gchar *reason) -{ - DecloakContext *dc; - GabblePresence *presence; - TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) self->priv->conn, TP_HANDLE_TYPE_CONTACT); - - presence = gabble_presence_cache_get (self, handle); - - if (presence != NULL && - presence->status != GABBLE_PRESENCE_OFFLINE && - presence->status != GABBLE_PRESENCE_UNKNOWN) - { - DEBUG ("We know that this contact is online, no point asking for " - "decloak"); - return FALSE; - } - - /* if we've already asked them to de-cloak for the same reason, do nothing */ - if (tp_handle_set_is_member (self->priv->decloak_handles, handle)) - { - dc = g_hash_table_lookup (self->priv->decloak_requests, - GUINT_TO_POINTER (handle)); - - if (dc != NULL && !tp_strdiff (reason, dc->reason)) - { - DEBUG ("Already asked %u to decloak for reason '%s'", handle, - reason); - return TRUE; - } - } - - DEBUG ("Asking %u to decloak", handle); - - dc = decloak_context_new (self, handle, reason); - dc->timeout_id = g_timeout_add_seconds (DECLOAK_PERIOD, - gabble_presence_cache_decloak_timeout_cb, dc); - g_hash_table_insert (self->priv->decloak_requests, GUINT_TO_POINTER (handle), - dc); - tp_handle_set_add (self->priv->decloak_handles, handle); - - gabble_connection_request_decloak (self->priv->conn, - tp_handle_inspect (contact_repo, handle), reason, NULL); - - return TRUE; -} - void gabble_presence_cache_update_location (GabblePresenceCache *cache, TpHandle handle, diff --git a/src/presence-cache.h b/src/presence-cache.h index ff17704..4b6001f 100644 --- a/src/presence-cache.h +++ b/src/presence-cache.h @@ -130,9 +130,6 @@ gboolean gabble_presence_parse_presence_message ( gboolean gabble_presence_cache_is_unsure (GabblePresenceCache *cache, TpHandle handle); -gboolean gabble_presence_cache_request_decloaking (GabblePresenceCache *self, - TpHandle handle, const gchar *reason); - void gabble_presence_cache_update_location (GabblePresenceCache *cache, TpHandle handle, GHashTable *location); GHashTable* gabble_presence_cache_get_location (GabblePresenceCache *cache, diff --git a/src/protocol.c b/src/protocol.c index 1dedaa3..988b97a 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -168,13 +168,6 @@ static TpCMParamSpec jabber_params[] = { GUINT_TO_POINTER (TRUE), 0 /* unused */, NULL, NULL }, - { GABBLE_PROP_CONNECTION_INTERFACE_GABBLE_DECLOAK_DECLOAK_AUTOMATICALLY, - DBUS_TYPE_BOOLEAN_AS_STRING, G_TYPE_BOOLEAN, - TP_CONN_MGR_PARAM_FLAG_HAS_DEFAULT | - TP_CONN_MGR_PARAM_FLAG_DBUS_PROPERTY, - GINT_TO_POINTER (TRUE), - 0 /* unused */, NULL, NULL }, - { "fallback-servers", "as", 0, 0, NULL, 0 /* unused */, NULL, NULL }, @@ -257,8 +250,6 @@ struct ParamMapping { SAME ("keepalive-interval"), MAP (TP_PROP_CONNECTION_INTERFACE_CONTACT_LIST1_DOWNLOAD_AT_CONNECTION, "download-roster-at-connection"), - MAP (GABBLE_PROP_CONNECTION_INTERFACE_GABBLE_DECLOAK_DECLOAK_AUTOMATICALLY, - "decloak-automatically"), SAME ("fallback-servers"), SAME ("extra-certificate-identities"), SAME (NULL) diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am index b5188f0..8e9845c 100644 --- a/tests/twisted/Makefile.am +++ b/tests/twisted/Makefile.am @@ -58,7 +58,6 @@ TWISTED_TESTS = \ pep-support.py \ plugin-channel-managers.py \ power-save.py \ - presence/decloak.py \ presence/error.py \ presence/initial-contact-presence.py \ presence/initial-presence.py \ @@ -176,7 +175,6 @@ TWISTED_JINGLE_TESTS = \ jingle/call-muc-cancel.py \ jingle/call-muc.py \ jingle/call-muc-re-re-request.py \ - jingle/decloak-peer.py \ jingle/preload-caps-crash.py \ jingle/session-id-collision.py \ jingle/stun-server.py \ diff --git a/tests/twisted/constants.py b/tests/twisted/constants.py index 77905b9..f68e84d 100644 --- a/tests/twisted/constants.py +++ b/tests/twisted/constants.py @@ -192,7 +192,6 @@ CONN_IFACE_RENAMING = CONN + '.Interface.Renaming1' CONN_IFACE_SIDECARS1 = CONN + '.Interface.Sidecars1' CONN_IFACE_REQUESTS = CONN + '.Interface.Requests' CONN_IFACE_LOCATION = CONN + '.Interface.Location1' -CONN_IFACE_GABBLE_DECLOAK = CONN + '.Interface.Gabble.Decloak' CONN_IFACE_MAIL_NOTIFICATION = CONN + '.Interface.MailNotification1' CONN_IFACE_CONTACT_LIST = CONN + '.Interface.ContactList1' CONN_IFACE_CONTACT_GROUPS = CONN + '.Interface.ContactGroups1' diff --git a/tests/twisted/jingle/decloak-peer.py b/tests/twisted/jingle/decloak-peer.py deleted file mode 100644 index 237472b..0000000 --- a/tests/twisted/jingle/decloak-peer.py +++ /dev/null @@ -1,66 +0,0 @@ -""" -Test use-case when client attempts to call an unsubscribed contact. Gabble -should ask them to "de-cloak". -""" - -from gabbletest import exec_test -from servicetest import (make_channel_proxy, call_async, sync_dbus, - assertEquals, assertLength) -from jingletest2 import JingleProtocol031, JingleTest2 - -import dbus - -import constants as cs -import ns - -from config import VOIP_ENABLED - -if not VOIP_ENABLED: - print "NOTE: built with --disable-voip" - raise SystemExit(77) - -def test(q, bus, conn, stream): - jp = JingleProtocol031() - jt = JingleTest2(jp, conn, q, stream, 'test@localhost', 'foo@bar.com/Foo') - jt2 = JingleTest2(jp, conn, q, stream, 'test@localhost', - 'foo2@bar.com/Foo') - # Make gabble think this is a different client - jt2.remote_caps['node'] = 'http://example.com/fake-client1' - - run_test(q, bus, conn, stream, jt, True) - run_test(q, bus, conn, stream, jt2, False) - -def run_test(q, bus, conn, stream, jt, decloak_allowed): - """ - Requests streams on a media channel to jt.remote_jid without having their - presence at all. - """ - - call_async(q, conn.Requests, 'CreateChannel', - { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_CALL, - cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT, - cs.TARGET_ID: jt.peer, - cs.CALL_INITIAL_AUDIO: True, - cs.CALL_INITIAL_VIDEO: False, - }) - - e = q.expect('stream-presence', - to=jt.peer_bare_jid, presence_type=None) - nodes = [ node for node in e.stanza.elements(uri=ns.TEMPPRES, name='temppres') ] - assertLength(1, nodes) - assertEquals('media', nodes[0].getAttribute('reason')) - - if decloak_allowed: - jt.send_presence_and_caps() - - # RequestStreams should now happily complete - q.expect('dbus-return', method='CreateChannel') - else: - q.expect('dbus-error', method='CreateChannel', - name=cs.OFFLINE) - -if __name__ == '__main__': - print "FIXME: needs to be ported to Call1" - raise SystemExit(77) - - exec_test(test, timeout=10) diff --git a/tests/twisted/presence/decloak.py b/tests/twisted/presence/decloak.py deleted file mode 100644 index 541762d..0000000 --- a/tests/twisted/presence/decloak.py +++ /dev/null @@ -1,71 +0,0 @@ -from twisted.words.xish import domish - -from gabbletest import exec_test, make_presence -from servicetest import EventPattern, assertEquals -import ns -import constants as cs - -def test(q, bus, conn, stream, should_decloak=False): - event = q.expect('stream-iq', query_ns=ns.ROSTER) - - event.stanza['type'] = 'result' - stream.send(event.stanza) - - # First test is to use the CM param's value - worker(q, bus, conn, stream, should_decloak) - - # We can change it at runtime, so flip it to the other value and retry - should_decloak = not should_decloak - conn.Set(cs.CONN_IFACE_GABBLE_DECLOAK, 'DecloakAutomatically', - should_decloak, dbus_interface=cs.PROPERTIES_IFACE) - worker(q, bus, conn, stream, should_decloak) - - # Trivial test for SendDirectedPresence() - bob_handle = conn.get_contact_handle_sync('bob@foo.com') - conn.SendDirectedPresence(bob_handle, False, - dbus_interface=cs.CONN_IFACE_GABBLE_DECLOAK) - q.expect('stream-presence', to='bob@foo.com') - -def worker(q, bus, conn, stream, should_decloak): - decloak_automatically = conn.Get(cs.CONN_IFACE_GABBLE_DECLOAK, - 'DecloakAutomatically', dbus_interface=cs.PROPERTIES_IFACE) - assertEquals(should_decloak, decloak_automatically) - - amy_handle = conn.get_contact_handle_sync('amy@foo.com') - - # Amy directs presence to us - - presence = make_presence('amy@foo.com/panopticon') - decloak = presence.addElement((ns.TEMPPRES, 'temppres')) - decloak['reason'] = 'media' - stream.send(presence) - - events = [ - EventPattern('dbus-signal', signal='PresencesChanged', - args=[{amy_handle: (cs.PRESENCE_AVAILABLE, 'available', '')}]), - EventPattern('dbus-signal', signal='DecloakRequested', - args=[amy_handle, 'media', should_decloak]), - ] - forbidden = [] - - if should_decloak: - events.append(EventPattern('stream-presence', - to='amy@foo.com/panopticon')) - else: - forbidden = [EventPattern('stream-presence')] - - q.forbid_events(forbidden) - q.expect_many(*events) - - presence = make_presence('amy@foo.com/panopticon', type='unavailable') - stream.send(presence) - q.expect('dbus-signal', signal='PresencesChanged', - args=[{amy_handle: (cs.PRESENCE_OFFLINE, 'offline', '')}]) - - q.unforbid_events(forbidden) - -if __name__ == '__main__': - exec_test(test, - params={cs.CONN_IFACE_GABBLE_DECLOAK + '.DecloakAutomatically': False}) - exec_test(lambda q, b, c, s: test(q, b, c, s, should_decloak=True), - params={cs.CONN_IFACE_GABBLE_DECLOAK + '.DecloakAutomatically': True}) -- 1.8.5.3