summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2014-01-08 14:31:53 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-01-13 12:29:16 +0000
commit79faa91bf3af5fe1e6fb7f12db318231ecb63136 (patch)
treea2301def3e49f6ae29a75252838c392d5d4d4be7
parent222908789271e2131fe50b1b5b28ada8c45fda4c (diff)
Adapt for merge of Contacts into Connection, and deletion of Requests
This also resyncs constants.py, servicetest.py with Gabble 0.99.6. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=50093 Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> [added telepathy-glib 0.99.6 dependency] Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
-rw-r--r--configure.ac2
-rw-r--r--rakia/base-connection.c14
-rw-r--r--rakia/base-connection.h2
-rw-r--r--rakia/connection-aliasing.c34
-rw-r--r--rakia/connection-aliasing.h9
-rw-r--r--src/sip-connection.c22
-rw-r--r--tests/twisted/cm/protocol.py2
-rw-r--r--tests/twisted/constants.py18
-rw-r--r--tests/twisted/servicetest.py38
9 files changed, 81 insertions, 60 deletions
diff --git a/configure.ac b/configure.ac
index 7a05148..96176a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -104,7 +104,7 @@ AC_DEFINE(TP_SEAL_ENABLE, [], [Prevent to use sealed variables])
AC_DEFINE(TP_DISABLE_SINGLE_INCLUDE, [], [Disable single header include])
AC_DEFINE([TP_VERSION_MIN_REQUIRED], [TP_VERSION_1_0], [Ignore post 1.0 deprecations])
AC_DEFINE([TP_VERSION_MAX_ALLOWED], [TP_VERSION_1_0], [Prevent post 1.0 APIs])
-PKG_CHECK_MODULES([TELEPATHY_GLIB], [telepathy-glib-1 >= 0.99.5, telepathy-glib-1-dbus >= 0.99.5])
+PKG_CHECK_MODULES([TELEPATHY_GLIB], [telepathy-glib-1 >= 0.99.6, telepathy-glib-1-dbus >= 0.99.6])
dnl Check for optional IP heartbeat support
AC_ARG_WITH(iphb,
diff --git a/rakia/base-connection.c b/rakia/base-connection.c
index 2e7ad8b..58ae394 100644
--- a/rakia/base-connection.c
+++ b/rakia/base-connection.c
@@ -58,27 +58,16 @@ static void event_target_iface_init (gpointer iface, gpointer data) {}
G_DEFINE_TYPE_WITH_CODE (RakiaBaseConnection,
rakia_base_connection, TP_TYPE_BASE_CONNECTION,
- G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_CONTACTS,
- tp_contacts_mixin_iface_init);
G_IMPLEMENT_INTERFACE (RAKIA_TYPE_EVENT_TARGET, event_target_iface_init);
);
static void
rakia_base_connection_init (RakiaBaseConnection *self)
{
- GObject *object = G_OBJECT (self);
- TpBaseConnection *base = TP_BASE_CONNECTION (self);
-
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, RAKIA_TYPE_BASE_CONNECTION,
RakiaBaseConnectionPrivate);
self->priv->uris = g_hash_table_new_full (NULL, NULL, NULL, free);
-
- tp_contacts_mixin_init (object,
- G_STRUCT_OFFSET (RakiaBaseConnection, contacts_mixin));
-
- /* Connection attributes */
- tp_base_connection_register_with_contacts_mixin (base);
}
static void
@@ -191,9 +180,6 @@ rakia_base_connection_class_init (RakiaBaseConnectionClass *klass)
"Sofia-SIP UA",
"The UA object for Sofia-SIP",
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-
- tp_contacts_mixin_class_init (object_class,
- G_STRUCT_OFFSET(RakiaBaseConnectionClass, contacts_mixin_class));
}
nua_handle_t *
diff --git a/rakia/base-connection.h b/rakia/base-connection.h
index 1bd505d..972e091 100644
--- a/rakia/base-connection.h
+++ b/rakia/base-connection.h
@@ -36,7 +36,6 @@ typedef struct _RakiaBaseConnectionPrivate RakiaBaseConnectionPrivate;
struct _RakiaBaseConnectionClass {
TpBaseConnectionClass parent_class;
- TpContactsMixinClass contacts_mixin_class;
nua_handle_t *(*create_handle) (RakiaBaseConnection *, TpHandle contact);
void (*add_auth_handler) (RakiaBaseConnection *, RakiaEventTarget *);
@@ -44,7 +43,6 @@ struct _RakiaBaseConnectionClass {
struct _RakiaBaseConnection {
TpBaseConnection parent;
- TpContactsMixin contacts_mixin;
RakiaBaseConnectionPrivate *priv;
};
diff --git a/rakia/connection-aliasing.c b/rakia/connection-aliasing.c
index a802c1f..4e41c8c 100644
--- a/rakia/connection-aliasing.c
+++ b/rakia/connection-aliasing.c
@@ -280,43 +280,33 @@ rakia_connection_set_aliases (TpSvcConnectionInterfaceAliasing1 *iface,
tp_svc_connection_interface_aliasing1_return_from_set_aliases (context);
}
-static void
-rakia_conn_aliasing_fill_contact_attributes (GObject *obj,
- const GArray *contacts, GHashTable *attributes_hash)
+gboolean
+rakia_conn_aliasing_fill_contact_attributes (TpBaseConnection *base,
+ const gchar *dbus_interface,
+ TpHandle handle,
+ TpContactAttributeMap *attributes)
{
- TpBaseConnection *base = TP_BASE_CONNECTION (obj);
- TpHandleRepoIface *contact_handles;
- guint i;
-
- contact_handles = tp_base_connection_get_handles (base,
- TP_HANDLE_TYPE_CONTACT);
-
- for (i = 0; i < contacts->len; i++)
+ if (!tp_strdiff (dbus_interface, TP_IFACE_CONNECTION_INTERFACE_ALIASING1))
{
- TpHandle handle;
+ TpHandleRepoIface *contact_handles;
GValue *val;
- handle = g_array_index (contacts, TpHandle, i);
+ contact_handles = tp_base_connection_get_handles (base,
+ TP_HANDLE_TYPE_CONTACT);
val = tp_g_value_slice_new (G_TYPE_STRING);
g_value_take_string (val,
conn_get_alias (base, contact_handles, handle));
- tp_contacts_mixin_set_contact_attribute (attributes_hash, handle,
+ tp_contact_attribute_map_take_sliced_gvalue (attributes, handle,
TP_TOKEN_CONNECTION_INTERFACE_ALIASING1_ALIAS, val);
+ return TRUE;
}
-}
-void
-rakia_connection_aliasing_init (gpointer instance)
-{
- tp_contacts_mixin_add_contact_attributes_iface (G_OBJECT (instance),
- TP_IFACE_CONNECTION_INTERFACE_ALIASING1,
- rakia_conn_aliasing_fill_contact_attributes);
+ return FALSE;
}
-
void
rakia_connection_aliasing_svc_iface_init (gpointer g_iface, gpointer iface_data)
{
diff --git a/rakia/connection-aliasing.h b/rakia/connection-aliasing.h
index b2482e4..d933e11 100644
--- a/rakia/connection-aliasing.h
+++ b/rakia/connection-aliasing.h
@@ -23,6 +23,8 @@
#include <glib-object.h>
+#include <telepathy-glib/telepathy-glib.h>
+
G_BEGIN_DECLS
typedef struct _RakiaConnectionAliasing RakiaConnectionAliasing;
@@ -48,11 +50,14 @@ struct _RakiaConnectionAliasingInterface {
GType rakia_connection_aliasing_get_type (void) G_GNUC_CONST;
-void rakia_connection_aliasing_init (gpointer instance);
-
void rakia_connection_aliasing_svc_iface_init (gpointer g_iface,
gpointer iface_data);
+gboolean rakia_conn_aliasing_fill_contact_attributes (TpBaseConnection *base,
+ const gchar *dbus_interface,
+ TpHandle handle,
+ TpContactAttributeMap *attributes);
+
G_END_DECLS
#endif /*__RAKIA_CONN_ALIASING_H__*/
diff --git a/src/sip-connection.c b/src/sip-connection.c
index 4e3b973..2db7b59 100644
--- a/src/sip-connection.c
+++ b/src/sip-connection.c
@@ -170,8 +170,6 @@ rakia_connection_init (RakiaConnection *self)
RakiaConnectionPrivate *priv = RAKIA_CONNECTION_GET_PRIVATE (self);
priv->sofia_home = su_home_new(sizeof (su_home_t));
-
- rakia_connection_aliasing_init (self);
}
static void
@@ -421,8 +419,6 @@ static gboolean rakia_connection_start_connecting (TpBaseConnection *base,
GError **error);
static const gchar *interfaces_always_present[] = {
- TP_IFACE_CONNECTION_INTERFACE_REQUESTS,
- TP_IFACE_CONNECTION_INTERFACE_CONTACTS,
TP_IFACE_CONNECTION_INTERFACE_ALIASING1,
NULL };
@@ -454,6 +450,20 @@ static void rakia_connection_add_auth_handler (RakiaBaseConnection *,
RakiaEventTarget *);
static void
+rakia_connection_fill_contact_attributes (TpBaseConnection *base,
+ const gchar *dbus_interface,
+ TpHandle handle,
+ TpContactAttributeMap *attributes)
+{
+ if (rakia_conn_aliasing_fill_contact_attributes (base,
+ dbus_interface, handle, attributes))
+ return;
+
+ TP_BASE_CONNECTION_CLASS (rakia_connection_parent_class)->
+ fill_contact_attributes (base, dbus_interface, handle, attributes);
+}
+
+static void
rakia_connection_class_init (RakiaConnectionClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -481,6 +491,8 @@ rakia_connection_class_init (RakiaConnectionClass *klass)
base_class->start_connecting = rakia_connection_start_connecting;
base_class->shut_down = rakia_connection_shut_down;
base_class->get_interfaces_always_present = get_interfaces_always_present;
+ base_class->fill_contact_attributes =
+ rakia_connection_fill_contact_attributes;
g_type_class_add_private (klass, sizeof (RakiaConnectionPrivate));
@@ -1028,8 +1040,6 @@ rakia_connection_finalize (GObject *obj)
g_free (priv->registrar_realm);
- tp_contacts_mixin_finalize (obj);
-
G_OBJECT_CLASS (rakia_connection_parent_class)->finalize (obj);
}
diff --git a/tests/twisted/cm/protocol.py b/tests/twisted/cm/protocol.py
index f2234e0..d92b654 100644
--- a/tests/twisted/cm/protocol.py
+++ b/tests/twisted/cm/protocol.py
@@ -35,8 +35,6 @@ def test(q, bus, conn, sip):
assertEquals('im-sip', proto_props['Icon'])
assertContains(cs.CONN_IFACE_ALIASING, proto_props['ConnectionInterfaces'])
- assertContains(cs.CONN_IFACE_CONTACTS, proto_props['ConnectionInterfaces'])
- assertContains(cs.CONN_IFACE_REQUESTS, proto_props['ConnectionInterfaces'])
assertEquals('sip:example@mit.edu',
unwrap(proto_iface.NormalizeContact('example@MIT.Edu')))
diff --git a/tests/twisted/constants.py b/tests/twisted/constants.py
index ff0f0a1..d710529 100644
--- a/tests/twisted/constants.py
+++ b/tests/twisted/constants.py
@@ -51,7 +51,6 @@ CHANNEL_IFACE_SUBJECT = CHANNEL + '.Interface.Subject1'
CHANNEL_IFACE_FILE_TRANSFER_METADATA = CHANNEL + '.Interface.FileTransfer.Metadata1'
CHANNEL_TYPE_CALL = CHANNEL + ".Type.Call1"
-CHANNEL_TYPE_CONTACT_LIST = CHANNEL + ".Type.ContactList1"
CHANNEL_TYPE_CONTACT_SEARCH = CHANNEL + ".Type.ContactSearch1"
CHANNEL_TYPE_TEXT = CHANNEL + ".Type.Text"
CHANNEL_TYPE_STREAM_TUBE = CHANNEL + ".Type.StreamTube1"
@@ -186,10 +185,11 @@ CONTACT_LIST_STATE_SUCCESS = 3
CONN = PREFIX + ".Connection"
CONN_IFACE_AVATARS = CONN + '.Interface.Avatars1'
CONN_IFACE_ALIASING = CONN + '.Interface.Aliasing1'
-CONN_IFACE_CONTACTS = CONN + '.Interface.Contacts'
CONN_IFACE_CONTACT_CAPS = CONN + '.Interface.ContactCapabilities1'
CONN_IFACE_CONTACT_INFO = CONN + ".Interface.ContactInfo1"
CONN_IFACE_PRESENCE = CONN + '.Interface.Presence1'
+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'
@@ -202,12 +202,17 @@ CONN_IFACE_CONTACT_BLOCKING = CONN + '.Interface.ContactBlocking1'
CONN_IFACE_ADDRESSING = CONN + '.Interface.Addressing1'
CONN_IFACE_SERVICE_POINT = CONN + '.Interface.ServicePoint1'
-ATTR_CONTACT_ID = CONN + '/contact-id'
+ATTR_ALIAS = CONN_IFACE_ALIASING + '/alias'
+ATTR_AVATAR_TOKEN = CONN_IFACE_AVATARS + '/token'
+ATTR_CLIENT_TYPES = CONN_IFACE_CLIENT_TYPES + '/client-types'
ATTR_CONTACT_CAPABILITIES = CONN_IFACE_CONTACT_CAPS + '/capabilities'
+ATTR_CONTACT_ID = CONN + '/contact-id'
+ATTR_CONTACT_INFO = CONN_IFACE_CONTACT_INFO + '/info'
+ATTR_GROUPS = CONN_IFACE_CONTACT_GROUPS + '/groups'
+ATTR_LOCATION = CONN_IFACE_LOCATION + '/location'
ATTR_PRESENCE = CONN_IFACE_PRESENCE + '/presence'
-ATTR_SUBSCRIBE = CONN_IFACE_CONTACT_LIST + '/subscribe'
ATTR_PUBLISH = CONN_IFACE_CONTACT_LIST + '/publish'
-ATTR_GROUPS = CONN_IFACE_CONTACT_GROUPS + '/groups'
+ATTR_SUBSCRIBE = CONN_IFACE_CONTACT_LIST + '/subscribe'
STREAM_HANDLER = PREFIX + '.Media.StreamHandler'
@@ -333,7 +338,7 @@ FT_DATE = CHANNEL_TYPE_FILE_TRANSFER + '.Date'
FT_AVAILABLE_SOCKET_TYPES = CHANNEL_TYPE_FILE_TRANSFER + '.AvailableSocketTypes'
FT_TRANSFERRED_BYTES = CHANNEL_TYPE_FILE_TRANSFER + '.TransferredBytes'
FT_INITIAL_OFFSET = CHANNEL_TYPE_FILE_TRANSFER + '.InitialOffset'
-FT_FILE_COLLECTION = CHANNEL_TYPE_FILE_TRANSFER + '.FUTURE.FileCollection'
+FT_FILE_COLLECTION = CHANNEL_TYPE_FILE_TRANSFER + '.FileCollection'
FT_URI = CHANNEL_TYPE_FILE_TRANSFER + '.URI'
FT_SERVICE_NAME = CHANNEL_IFACE_FILE_TRANSFER_METADATA + '.ServiceName'
FT_METADATA = CHANNEL_IFACE_FILE_TRANSFER_METADATA + '.Metadata'
@@ -565,6 +570,7 @@ CR = PREFIX + '.ChannelRequest'
CDO = PREFIX + '.ChannelDispatchOperation'
CD = PREFIX + '.ChannelDispatcher'
+CD_IFACE_MESSAGES1 = PREFIX + '.ChannelDispatcher.Interface.Messages1'
CD_IFACE_OP_LIST = PREFIX + '.ChannelDispatcher.Interface.OperationList1'
CD_PATH = PATH_PREFIX + '/ChannelDispatcher'
diff --git a/tests/twisted/servicetest.py b/tests/twisted/servicetest.py
index 1363802..86212f3 100644
--- a/tests/twisted/servicetest.py
+++ b/tests/twisted/servicetest.py
@@ -197,7 +197,14 @@ class BaseEventQueue:
t = time.time()
while True:
- event = self.wait([pattern.subqueue])
+ try:
+ event = self.wait([pattern.subqueue])
+ except TimeoutError:
+ self.log('timeout')
+ self.log('still expecting:')
+ self.log(' - %r' % pattern)
+ raise
+
self._check_forbidden(event)
if pattern.match(event):
@@ -619,26 +626,44 @@ def wrap_connection(conn):
return ConnWrapper(conn, tp_name_prefix + '.Connection',
dict(
[('Peer', 'org.freedesktop.DBus.Peer'),
+ ('Contacts', cs.CONN), # backwards compat with Telepathy 0
('Aliasing', cs.CONN_IFACE_ALIASING),
('Avatars', cs.CONN_IFACE_AVATARS),
- ('Contacts', cs.CONN_IFACE_CONTACTS),
('ContactCapabilities', cs.CONN_IFACE_CONTACT_CAPS),
('ContactInfo', cs.CONN_IFACE_CONTACT_INFO),
('Location', cs.CONN_IFACE_LOCATION),
('Presence', cs.CONN_IFACE_PRESENCE),
('Requests', cs.CONN_IFACE_REQUESTS),
- ('Future', tp_name_prefix + '.Connection.FUTURE'),
('MailNotification', cs.CONN_IFACE_MAIL_NOTIFICATION),
('ContactList', cs.CONN_IFACE_CONTACT_LIST),
('ContactGroups', cs.CONN_IFACE_CONTACT_GROUPS),
+ ('ContactBlocking', cs.CONN_IFACE_CONTACT_BLOCKING),
('PowerSaving', cs.CONN_IFACE_POWER_SAVING),
('Addressing', cs.CONN_IFACE_ADDRESSING),
+ ('ClientTypes', cs.CONN_IFACE_CLIENT_TYPES),
+ ('Renaming', cs.CONN_IFACE_RENAMING),
+ ('Sidecars1', cs.CONN_IFACE_SIDECARS1),
]))
+class ChannelWrapper(ProxyWrapper):
+ def send_msg_sync(self, txt):
+ message = [
+ { 'message-type': cs.MT_NORMAL, },
+ { 'content-type': 'text/plain',
+ 'content': txt
+ }]
+ self.Text.SendMessage(message, 0)
+
def wrap_channel(chan, type_, extra=None):
interfaces = {
type_: tp_name_prefix + '.Channel.Type.' + type_,
+ 'Channel': cs.CHANNEL,
'Group': cs.CHANNEL_IFACE_GROUP,
+ 'Hold': cs.CHANNEL_IFACE_HOLD,
+ 'RoomConfig1': cs.CHANNEL_IFACE_ROOM_CONFIG,
+ 'ChatState': cs.CHANNEL_IFACE_CHAT_STATE,
+ 'Destroyable': cs.CHANNEL_IFACE_DESTROYABLE,
+ 'Password': cs.CHANNEL_IFACE_PASSWORD,
}
if extra:
@@ -646,11 +671,14 @@ def wrap_channel(chan, type_, extra=None):
(name, tp_name_prefix + '.Channel.Interface.' + name)
for name in extra]))
- return ProxyWrapper(chan, tp_name_prefix + '.Channel', interfaces)
+ return ChannelWrapper(chan, tp_name_prefix + '.Channel', interfaces)
def wrap_content(chan, extra=None):
- interfaces = { }
+ interfaces = {
+ 'DTMF': cs.CALL_CONTENT_IFACE_DTMF,
+ 'Media': cs.CALL_CONTENT_IFACE_MEDIA,
+ }
if extra:
interfaces.update(dict([