From 9d9abd168746e37fa77abd1ffe779523b3dde723 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 25 Sep 2013 15:45:02 +0100 Subject: [PATCH] Use telepathy-glib to implement Conn.I.Addressing Our draft is functionally the same as the one that was merged into telepathy-glib before 0.18, and we already depend on a recent telepathy-glib. --- extensions/Connection_Interface_Addressing.xml | 245 ------------------------- extensions/Makefile.am | 1 - extensions/all.xml | 2 - src/conn-addressing.c | 18 +- src/connection.c | 4 +- 5 files changed, 11 insertions(+), 259 deletions(-) delete mode 100644 extensions/Connection_Interface_Addressing.xml diff --git a/extensions/Connection_Interface_Addressing.xml b/extensions/Connection_Interface_Addressing.xml deleted file mode 100644 index 2d8145f..0000000 --- a/extensions/Connection_Interface_Addressing.xml +++ /dev/null @@ -1,245 +0,0 @@ - - - Copyright (C) 2010 Collabora Limited - -

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.

-
- - - - (as draft) - -

This interface deals with the multiple address types that can - refer to the same contact, such as vCard fields and URIs.

- -

It can be used to retrieve contacts with a specific addresses - through GetContactsByVCardField and - GetContactsByURI, as well as - defining the various addressing methods for a given contact - through this interface's contact attributes.

-
- - - - -

The vCard field of the addresses we are requesting. The - field name SHOULD be in lower case. Supported - fields can be found in - AddressableVCardFields.

- -

The url vCard field MUST NOT appear here; see - GetContactsByURI instead.

- - -

In practice, protocols have a limited set of URI - schemes that make sense to resolve as a contact.

-
- -
-
- - - The addresses to get contact handles for. The address types - should match the given vCard field. - - - - -

A list of strings indicating which D-Bus interfaces the calling - process is interested in. All supported attributes from these - interfaces, whose values can be obtained without additional network - activity, will be in the reply.

- -

Attributes from this interface and from - org.freedesktop.Telepathy.Connection - are always returned, and need not be requested - explicitly.

- -

The behavior of this parameter is similar to the same - parameter in - Contacts.GetContactAttributes.

-
-
- - - -

A mapping from requested vCard addresses to the corresponding - contact handles.

- -

Requested addresses that are not valid or understood for this protocol - MUST be omitted from the mapping.

-
-
- - - -

A dictionary mapping the contact handles to contact attributes. - If any of the requested addresses are in fact invalid, they are - simply omitted from this mapping. If contact attributes are not - immediately known, the behaviour is defined by the interface; - the attribute should either be omitted from the result or - replaced with a default value.

- -

Requested addresses that are not valid or understood for this protocol - MUST be omitted from the mapping.

- -

Each contact's attributes will always include at least the - identifier that would be obtained by inspecting the handle - (org.freedesktop.Telepathy.Connection/contact-id). -

-
-
- - -

Request contacts and retrieve their attributes using a given field - in their vCards.

- -

The connection manager should record that these handles are in - use by the client who invokes this method, and must not - deallocate the handles until the client disconnects from the - bus or calls the - Connection.ReleaseHandles - method.

-
- - - - -
- - - - - The URI addresses to get contact handles for. Supported - schemes can be found in - AddressableURISchemes. - - - - -

A list of strings indicating which D-Bus interfaces the calling - process is interested in. All supported attributes from these - interfaces, whose values can be obtained without additional network - activity, will be in the reply.

- -

Attributes from this interface and from - org.freedesktop.Telepathy.Connection - are always returned, and need not be requested - explicitly.

- -

The behavior of this parameter is similar to the same - parameter in - Contacts.GetContactAttributes.

-
-
- - - -

A mapping of requested URIs to the corresponding contact handles.

- -

Requested URIs that are not valid or understood for this protocol - MUST be omitted from the mapping.

-
-
- - - -

A dictionary mapping the contact handles to contact attributes. - If any of the requested addresses are in fact invalid, they are - simply omitted from this mapping. If contact attributes are not - immediately known, the behaviour is defined by the interface; - the attribute should either be omitted from the result or - replaced with a default value.

- -

Requested URIs that are not valid or understood for this protocol - MUST be omitted from the mapping.

- -

Each contact's attributes will always include at least the - identifier that would be obtained by inspecting the handle - (org.freedesktop.Telepathy.Connection/contact-id). -

-
-
- - -

Request contacts and retrieve their attributes using URI addresses.

- -

The connection manager should record that these handles are in - use by the client who invokes this method, and must not - deallocate the handles until the client disconnects from the - bus or calls the - Connection.ReleaseHandles - method.

-
- - - - -
- - - -

A mapping of vCard fields and addresses that repreent - the given contact.

-
- - -
- - - - The various vCard addresses that identify this contact. - - - - - - The various URI addresses that identify this contact. - - - - - - A map from URIs/vCard addresses to the corresponding handle. - - - - - - The URI or vCard address that has been requested by - GetContactsByVCardField or - GetContactsByURI. - - - - - A nonzero handle. - - - - -
-
- diff --git a/extensions/Makefile.am b/extensions/Makefile.am index b435ae3..07899a1 100644 --- a/extensions/Makefile.am +++ b/extensions/Makefile.am @@ -4,7 +4,6 @@ EXTRA_DIST = \ all.xml \ Channel_Type_FileTransfer_Future.xml \ Connection_Future.xml \ - Connection_Interface_Addressing.xml \ Connection_Interface_Gabble_Decloak.xml \ Gabble_Plugin_Console.xml \ Gabble_Plugin_Gateways.xml \ diff --git a/extensions/all.xml b/extensions/all.xml index 78acede..8b2205f 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-addressing.c b/src/conn-addressing.c index 7fff354..6043115 100644 --- a/src/conn-addressing.c +++ b/src/conn-addressing.c @@ -34,7 +34,7 @@ static const char *assumed_interfaces[] = { TP_IFACE_CONNECTION, - GABBLE_IFACE_CONNECTION_INTERFACE_ADDRESSING, + TP_IFACE_CONNECTION_INTERFACE_ADDRESSING, NULL }; @@ -48,11 +48,11 @@ _fill_contact_attributes (TpHandleRepoIface *contact_repo, GHashTable *addresses = gabble_vcard_addresses_for_handle (contact_repo, contact); tp_contacts_mixin_set_contact_attribute (attributes_hash, - contact, GABBLE_IFACE_CONNECTION_INTERFACE_ADDRESSING"/uris", + contact, TP_TOKEN_CONNECTION_INTERFACE_ADDRESSING_URIS, tp_g_value_slice_new_take_boxed (G_TYPE_STRV, uris)); tp_contacts_mixin_set_contact_attribute (attributes_hash, - contact, GABBLE_IFACE_CONNECTION_INTERFACE_ADDRESSING"/addresses", + contact, TP_TOKEN_CONNECTION_INTERFACE_ADDRESSING_ADDRESSES, tp_g_value_slice_new_take_boxed (TP_HASH_TYPE_STRING_STRING_MAP, addresses)); } @@ -73,7 +73,7 @@ conn_addressing_fill_contact_attributes (GObject *obj, } static void -conn_addressing_get_contacts_by_uri (GabbleSvcConnectionInterfaceAddressing *iface, +conn_addressing_get_contacts_by_uri (TpSvcConnectionInterfaceAddressing *iface, const gchar **uris, const gchar **interfaces, DBusGMethodInvocation *context) @@ -101,7 +101,7 @@ conn_addressing_get_contacts_by_uri (GabbleSvcConnectionInterfaceAddressing *ifa attributes = tp_contacts_mixin_get_contact_attributes (G_OBJECT (iface), handles, interfaces, assumed_interfaces, sender); - gabble_svc_connection_interface_addressing_return_from_get_contacts_by_uri ( + tp_svc_connection_interface_addressing_return_from_get_contacts_by_uri ( context, requested, attributes); g_array_unref (handles); @@ -111,7 +111,7 @@ conn_addressing_get_contacts_by_uri (GabbleSvcConnectionInterfaceAddressing *ifa } static void -conn_addressing_get_contacts_by_vcard_field (GabbleSvcConnectionInterfaceAddressing *iface, +conn_addressing_get_contacts_by_vcard_field (TpSvcConnectionInterfaceAddressing *iface, const gchar *field, const gchar **addresses, const gchar **interfaces, @@ -141,7 +141,7 @@ conn_addressing_get_contacts_by_vcard_field (GabbleSvcConnectionInterfaceAddress attributes = tp_contacts_mixin_get_contact_attributes (G_OBJECT (iface), handles, interfaces, assumed_interfaces, sender); - gabble_svc_connection_interface_addressing_return_from_get_contacts_by_vcard_field ( + tp_svc_connection_interface_addressing_return_from_get_contacts_by_vcard_field ( context, requested, attributes); g_array_unref (handles); @@ -153,7 +153,7 @@ conn_addressing_get_contacts_by_vcard_field (GabbleSvcConnectionInterfaceAddress void conn_addressing_init (GabbleConnection *self) { tp_contacts_mixin_add_contact_attributes_iface (G_OBJECT (self), - GABBLE_IFACE_CONNECTION_INTERFACE_ADDRESSING, + TP_IFACE_CONNECTION_INTERFACE_ADDRESSING, conn_addressing_fill_contact_attributes); } @@ -162,7 +162,7 @@ conn_addressing_iface_init (gpointer g_iface, gpointer iface_data) { #define IMPLEMENT(x) \ - gabble_svc_connection_interface_addressing_implement_##x (\ + tp_svc_connection_interface_addressing_implement_##x (\ g_iface, conn_addressing_##x) IMPLEMENT (get_contacts_by_uri); diff --git a/src/connection.c b/src/connection.c index 937fb4b..2917bc2 100644 --- a/src/connection.c +++ b/src/connection.c @@ -133,7 +133,7 @@ G_DEFINE_TYPE_WITH_CODE(GabbleConnection, conn_client_types_iface_init); G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_POWER_SAVING, conn_power_saving_iface_init); - G_IMPLEMENT_INTERFACE (GABBLE_TYPE_SVC_CONNECTION_INTERFACE_ADDRESSING, + G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_ADDRESSING, conn_addressing_iface_init); G_IMPLEMENT_INTERFACE (GABBLE_TYPE_PLUGIN_CONNECTION, gabble_plugin_connection_iface_init); @@ -885,7 +885,7 @@ static const gchar *implemented_interfaces[] = { GABBLE_IFACE_CONNECTION_INTERFACE_GABBLE_DECLOAK, GABBLE_IFACE_CONNECTION_FUTURE, TP_IFACE_CONNECTION_INTERFACE_CLIENT_TYPES, - GABBLE_IFACE_CONNECTION_INTERFACE_ADDRESSING, + TP_IFACE_CONNECTION_INTERFACE_ADDRESSING, NULL }; static const gchar **interfaces_always_present = implemented_interfaces + 3; -- 1.8.4.rc3