From 82162a775b73ec8fc6bac7ff2c3efa7592554916 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Fri, 20 Sep 2013 17:19:43 -0400 Subject: Port to telepathy-glib-1 --- .gitignore | 4 +- configure.ac | 11 +- data/Makefile.am | 4 +- data/salut.service.in | 2 +- extensions/Connection_Future.xml | 12 +- extensions/OLPC_Activity_Properties.xml | 16 +- extensions/OLPC_Buddy_Info.xml | 28 +- extensions/Salut_Plugin_Test.xml | 2 +- plugins/test.c | 2 +- src/connection-contact-info.c | 49 --- src/connection.c | 341 +++------------------ src/contact-manager.c | 5 +- src/file-transfer-channel.c | 4 +- src/im-channel.c | 23 +- src/muc-channel.c | 120 ++++---- src/muc-manager.c | 4 +- src/muc-tube-dbus.c | 2 + src/muc-tube-stream.c | 2 + src/protocol.c | 3 +- src/protocol.h | 4 +- src/roomlist-channel.c | 8 +- src/text-helper.h | 2 +- src/tube-dbus.c | 7 +- src/tube-iface.c | 4 +- src/tube-stream.c | 14 +- src/tubes-manager.c | 34 +- src/util.h | 6 + src/write-mgr-file.c | 12 +- tests/twisted/avahi/aliases.py | 8 +- tests/twisted/avahi/caps-file-transfer.py | 8 +- tests/twisted/avahi/caps-self.py | 2 +- tests/twisted/avahi/close-local-pending-room.py | 10 +- .../avahi/file-transfer/file_transfer_helper.py | 10 +- .../twisted/avahi/file-transfer/ft-client-caps.py | 14 +- tests/twisted/avahi/ichat-composing.py | 8 +- tests/twisted/avahi/ichat-incoming-msg.py | 10 +- tests/twisted/avahi/muc-invite.py | 11 +- tests/twisted/avahi/olpc-activity-announcements.py | 2 +- tests/twisted/avahi/request-im.py | 8 +- tests/twisted/avahi/request-muc.py | 6 +- tests/twisted/avahi/roomlist.py | 11 +- tests/twisted/avahi/set-presence.py | 4 +- tests/twisted/avahi/text-channel.py | 15 +- tests/twisted/avahi/tubes/request-muc-tubes.py | 6 +- tests/twisted/avahi/tubes/tubetestutil.py | 10 +- tests/twisted/avahi/tubes/two-muc-dbus-tubes.py | 4 +- tests/twisted/cm/protocol.py | 6 +- tests/twisted/constants.py | 95 +++--- tests/twisted/saluttest.py | 24 +- tests/twisted/servicetest.py | 8 +- tests/twisted/sidecars.py | 2 +- tests/twisted/tools/Makefile.am | 4 +- tests/twisted/tools/salut.service.in | 2 +- 53 files changed, 330 insertions(+), 683 deletions(-) diff --git a/.gitignore b/.gitignore index d87d4ead..ec554dd4 100644 --- a/.gitignore +++ b/.gitignore @@ -81,7 +81,7 @@ m4/lt~obsolete.m4 /coverage/ -data/org.freedesktop.Telepathy.ConnectionManager.salut.service +data/im.telepathy1.ConnectionManager.salut.service data/*.service data/salut.manager @@ -118,7 +118,7 @@ tests/twisted/tools/core tests/twisted/tools/exec-with-log.sh tests/twisted/tools/salut-testing.log* tests/twisted/tools/tmp-session-bus.conf -tests/twisted/tools/org.freedesktop.Telepathy.ConnectionManager.salut.service +tests/twisted/tools/im.telepathy1.ConnectionManager.salut.service tests/twisted/tools/refdbg.log /tests/twisted/with-session-bus*.address /tests/twisted/with-session-bus*.pid diff --git a/configure.ac b/configure.ac index 47699d50..0b7a37f5 100644 --- a/configure.ac +++ b/configure.ac @@ -195,11 +195,16 @@ PKG_CHECK_MODULES(LIBXML2, [libxml-2.0]) AC_SUBST(LIBXML2_CFLAGS) AC_SUBST(LIBXML2_LIBS) +TELEPATHY_GLIB_REQUIRED=0.99.1.1 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_0_22], [Ignore post 0.22 deprecations]) -AC_DEFINE([TP_VERSION_MAX_ALLOWED], [TP_VERSION_0_22], [Prevent post 0.22 APIs]) -PKG_CHECK_MODULES([TELEPATHY_GLIB], [telepathy-glib >= 0.21.2]) +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 >= $TELEPATHY_GLIB_REQUIRED + telepathy-glib-1-dbus >= $TELEPATHY_GLIB_REQUIRED + ]) AC_SUBST(TELEPATHY_GLIB_CFLAGS) AC_SUBST(TELEPATHY_GLIB_LIBS) diff --git a/data/Makefile.am b/data/Makefile.am index e0002ab6..049070c6 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -4,12 +4,12 @@ managerdir = $(datadir)/telepathy/managers manager_DATA = salut.manager servicedir = $(datadir)/dbus-1/services -service_DATA = org.freedesktop.Telepathy.ConnectionManager.salut.service +service_DATA = im.telepathy1.ConnectionManager.salut.service # We don't use the full filename for the .in because > 99 character filenames # in tarballs are non-portable (and automake 1.8 doesn't let us build # non-archaic tarballs) -org.freedesktop.Telepathy.ConnectionManager.salut.service: salut.service.in \ +im.telepathy1.ConnectionManager.salut.service: salut.service.in \ Makefile $(AM_V_GEN)sed -e "s|[@]libexecdir[@]|$(libexecdir)|" $< > $@ diff --git a/data/salut.service.in b/data/salut.service.in index 322aea76..60303685 100644 --- a/data/salut.service.in +++ b/data/salut.service.in @@ -1,3 +1,3 @@ [D-BUS Service] -Name=org.freedesktop.Telepathy.ConnectionManager.salut +Name=im.telepathy1.ConnectionManager.salut Exec=@libexecdir@/telepathy-salut diff --git a/extensions/Connection_Future.xml b/extensions/Connection_Future.xml index 11047983..a578a888 100644 --- a/extensions/Connection_Future.xml +++ b/extensions/Connection_Future.xml @@ -20,9 +20,9 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

- - + @@ -75,12 +75,12 @@ USA.

in a dictionary, build a proxy object from the value). More “plural” plugins are likely to want to implement new types of Channel + namespace="im.telepathy1">Channel instead.

- + The requested sidecar is not implemented by this connection manager, or a necessary server-side component does not exist. (FIXME: split @@ -91,7 +91,7 @@ USA.

- + A server-side component needed by the requested sidecar reported it is currently too busy, or did not respond for some @@ -99,7 +99,7 @@ USA.

- + The connection was disconnected while the sidecar was being set up. diff --git a/extensions/OLPC_Activity_Properties.xml b/extensions/OLPC_Activity_Properties.xml index d1ea2afa..4125cd50 100644 --- a/extensions/OLPC_Activity_Properties.xml +++ b/extensions/OLPC_Activity_Properties.xml @@ -17,7 +17,7 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

- + @@ -35,9 +35,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

You have to be the owner of this activity. - - - + + +
@@ -56,8 +56,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Get the properties of a particular activity. - - + +
@@ -80,8 +80,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

- - + + diff --git a/extensions/OLPC_Buddy_Info.xml b/extensions/OLPC_Buddy_Info.xml index 7caf35c0..83bf916c 100644 --- a/extensions/OLPC_Buddy_Info.xml +++ b/extensions/OLPC_Buddy_Info.xml @@ -17,7 +17,7 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

- + @@ -35,7 +35,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

(possibly immediately).

- +
@@ -54,8 +54,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Get the properties of a particular contact. - - + + @@ -103,8 +103,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Set the activities of the local user for this connection. - - + + @@ -128,8 +128,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

- - + + @@ -152,8 +152,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Get the activities of a particular contact. - - + + @@ -196,8 +196,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Set the current activity of the local user for this connection. - - + + @@ -223,8 +223,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Get the current activity of a particular contact. - - + + diff --git a/extensions/Salut_Plugin_Test.xml b/extensions/Salut_Plugin_Test.xml index 265c2a84..d62c26b9 100644 --- a/extensions/Salut_Plugin_Test.xml +++ b/extensions/Salut_Plugin_Test.xml @@ -17,7 +17,7 @@ Lesser General Public License for more details.

License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

- +

A sidecar interface implemented by a plugin used by the test suite.

diff --git a/plugins/test.c b/plugins/test.c index 70e231b8..6ab15135 100644 --- a/plugins/test.c +++ b/plugins/test.c @@ -14,7 +14,7 @@ static void plugin_iface_init ( gpointer g_iface, gpointer data); -#define IFACE_TEST "org.freedesktop.Telepathy.Salut.Plugin.Test" +#define IFACE_TEST "im.telepathy1.Salut.Plugin.Test" static const gchar * const sidecar_interfaces[] = { IFACE_TEST, diff --git a/src/connection-contact-info.c b/src/connection-contact-info.c index cf1f0cb6..c49963fe 100644 --- a/src/connection-contact-info.c +++ b/src/connection-contact-info.c @@ -252,54 +252,6 @@ salut_conn_contact_info_changed ( g_boxed_free (TP_ARRAY_TYPE_CONTACT_INFO_FIELD_LIST, contact_info); } -static void -salut_conn_contact_info_get_contact_info ( - TpSvcConnectionInterfaceContactInfo *iface, - const GArray *contacts, - DBusGMethodInvocation *context) -{ - SalutConnection *self = SALUT_CONNECTION (iface); - TpBaseConnection *base = (TpBaseConnection *) self; - TpHandleRepoIface *contacts_repo = - tp_base_connection_get_handles (base, TP_HANDLE_TYPE_CONTACT); - SalutContactManager *contact_manager; - guint i; - GHashTable *ret; - GError *error = NULL; - - TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (TP_BASE_CONNECTION (iface), - context); - - if (!tp_handles_are_valid (contacts_repo, contacts, FALSE, &error)) - { - dbus_g_method_return_error (context, error); - g_error_free (error); - return; - } - - g_object_get (self, "contact-manager", &contact_manager, NULL); - ret = dbus_g_type_specialized_construct (TP_HASH_TYPE_CONTACT_INFO_MAP); - - for (i = 0; i < contacts->len; i++) - { - TpHandle handle = g_array_index (contacts, TpHandle, i); - SalutContact *contact = salut_contact_manager_get_contact ( - contact_manager, handle); - - if (contact != NULL) - { - g_hash_table_insert (ret, GUINT_TO_POINTER (handle), - build_contact_info_for_contact (contact)); - g_object_unref (contact); - } - } - - tp_svc_connection_interface_contact_info_return_from_get_contact_info ( - context, ret); - g_boxed_free (TP_HASH_TYPE_CONTACT_INFO_MAP, ret); - g_object_unref (contact_manager); -} - static void salut_conn_contact_info_request_contact_info ( TpSvcConnectionInterfaceContactInfo *iface, @@ -367,7 +319,6 @@ salut_conn_contact_info_iface_init ( #define IMPLEMENT(x) tp_svc_connection_interface_contact_info_implement_##x \ (klass, salut_conn_contact_info_##x) - IMPLEMENT (get_contact_info); IMPLEMENT (request_contact_info); IMPLEMENT (refresh_contact_info); #undef IMPLEMENT diff --git a/src/connection.c b/src/connection.c index a0e19e4d..9916bd5f 100644 --- a/src/connection.c +++ b/src/connection.c @@ -116,8 +116,8 @@ G_DEFINE_TYPE_WITH_CODE(SalutConnection, tp_contacts_mixin_iface_init); G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CONNECTION_INTERFACE_CONTACT_LIST, tp_base_contact_list_mixin_list_iface_init); - G_IMPLEMENT_INTERFACE(TP_TYPE_SVC_CONNECTION_INTERFACE_SIMPLE_PRESENCE, - tp_presence_mixin_simple_presence_iface_init); + G_IMPLEMENT_INTERFACE(TP_TYPE_SVC_CONNECTION_INTERFACE_PRESENCE, + tp_presence_mixin_iface_init); G_IMPLEMENT_INTERFACE(TP_TYPE_SVC_CONNECTION_INTERFACE_AVATARS, salut_connection_avatar_service_iface_init); G_IMPLEMENT_INTERFACE @@ -255,9 +255,6 @@ static void salut_connection_create_handle_repos (TpBaseConnection *self, TpHandleRepoIface *repos[TP_NUM_HANDLE_TYPES]); -static GPtrArray * -salut_connection_create_channel_factories (TpBaseConnection *self); - static GPtrArray * salut_connection_create_channel_managers (TpBaseConnection *self); @@ -354,6 +351,13 @@ static void sidecars_conn_status_changed_cb (SalutConnection *conn, guint status, guint reason, gpointer unused); +static void _contact_manager_contact_change_cb (SalutContactManager *mgr, + SalutContact *contact, int changes, gpointer data); + +#ifdef ENABLE_OLPC +static void setup_olpc_activity_manager (SalutConnection *self); +#endif + static void salut_connection_constructed (GObject *obj) { @@ -365,12 +369,17 @@ salut_connection_constructed (GObject *obj) g_signal_connect (self->presence_cache, "capabilities-update", G_CALLBACK (connection_capabilities_update_cb), self); +#ifdef ENABLE_OLPC + setup_olpc_activity_manager (self); +#endif + tp_contacts_mixin_init (obj, G_STRUCT_OFFSET (SalutConnection, contacts_mixin)); tp_base_connection_register_with_contacts_mixin (base); - tp_presence_mixin_simple_presence_register_with_contacts_mixin (obj); - tp_base_contact_list_mixin_register_with_contacts_mixin (base); + tp_presence_mixin_register_with_contacts_mixin (obj); + tp_base_contact_list_mixin_register_with_contacts_mixin ( + TP_BASE_CONTACT_LIST (self->priv->contact_manager), base); tp_contacts_mixin_add_contact_attributes_iface (obj, TP_IFACE_CONNECTION_INTERFACE_AVATARS, @@ -583,23 +592,15 @@ make_presence_opt_args (SalutPresenceId presence, const gchar *message) static GHashTable * get_contact_statuses (GObject *obj, - const GArray *handles, - GError **error) + const GArray *handles) { SalutConnection *self = SALUT_CONNECTION (obj); SalutConnectionPrivate *priv = self->priv; TpBaseConnection *base = (TpBaseConnection *) self; TpHandle self_handle = tp_base_connection_get_self_handle (base); - TpHandleRepoIface *handle_repo = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); GHashTable *ret; guint i; - if (!tp_handles_are_valid (handle_repo, handles, FALSE, error)) - { - return NULL; - } - ret = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, (GDestroyNotify) tp_presence_status_free); @@ -716,7 +717,7 @@ static const gchar *interfaces [] = { TP_IFACE_CONNECTION_INTERFACE_ALIASING, TP_IFACE_CONNECTION_INTERFACE_AVATARS, TP_IFACE_CONNECTION_INTERFACE_CONTACTS, - TP_IFACE_CONNECTION_INTERFACE_SIMPLE_PRESENCE, + TP_IFACE_CONNECTION_INTERFACE_PRESENCE, TP_IFACE_CONNECTION_INTERFACE_REQUESTS, TP_IFACE_CONNECTION_INTERFACE_CONTACT_CAPABILITIES, TP_IFACE_CONNECTION_INTERFACE_CONTACT_INFO, @@ -778,8 +779,6 @@ salut_connection_class_init (SalutConnectionClass *salut_connection_class) tp_connection_class->create_handle_repos = salut_connection_create_handle_repos; - tp_connection_class->create_channel_factories = - salut_connection_create_channel_factories; tp_connection_class->create_channel_managers = salut_connection_create_channel_managers; tp_connection_class->get_unique_connection_name = @@ -799,7 +798,7 @@ salut_connection_class_init (SalutConnectionClass *salut_connection_class) is_presence_status_available, get_contact_statuses, set_own_status, presence_statuses); - tp_presence_mixin_simple_presence_init_dbus_properties (object_class); + tp_presence_mixin_init_dbus_properties (object_class); tp_contacts_mixin_class_init (object_class, G_STRUCT_OFFSET (SalutConnectionClass, contacts_mixin)); @@ -1289,23 +1288,6 @@ _salut_connection_disconnect (SalutConnection *self) /* Aliasing interface */ -/** - * salut_connection_get_alias_flags - * - * Implements D-Bus method GetAliasFlags - * on interface org.freedesktop.Telepathy.Connection.Interface.Aliasing - * - */ -static void -salut_connection_get_alias_flags (TpSvcConnectionInterfaceAliasing *self, - DBusGMethodInvocation *context) -{ - /* Aliases are set by the contacts - * Actually we concat the first and lastname property */ - - tp_svc_connection_interface_aliasing_return_from_get_alias_flags (context, - 0); -} static const gchar * salut_connection_get_alias (SalutConnection *self, TpHandle handle) @@ -1344,7 +1326,7 @@ salut_connection_get_alias (SalutConnection *self, TpHandle handle) * salut_connection_request_aliases * * Implements D-Bus method RequestAliases - * on interface org.freedesktop.Telepathy.Connection.Interface.Aliasing + * on interface im.telepathy1.Connection.Interface.Aliasing * */ static void @@ -1385,40 +1367,6 @@ salut_connection_request_aliases (TpSvcConnectionInterfaceAliasing *iface, return; } -static void -salut_connection_get_aliases (TpSvcConnectionInterfaceAliasing *iface, - const GArray *contacts, DBusGMethodInvocation *context) -{ - SalutConnection *self = SALUT_CONNECTION (iface); - TpBaseConnection *base = TP_BASE_CONNECTION (self); - TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); - guint i; - GError *error = NULL; - GHashTable *result = g_hash_table_new_full (g_direct_hash, g_direct_equal, - NULL, NULL); - - if (!tp_handles_are_valid (contact_repo, contacts, FALSE, &error)) - { - dbus_g_method_return_error (context, error); - g_error_free (error); - return; - } - - for (i = 0; i < contacts->len; i++) - { - TpHandle handle = g_array_index (contacts, TpHandle, i); - - g_hash_table_insert (result, GUINT_TO_POINTER (handle), - (gchar *) salut_connection_get_alias (self, handle)); - } - - tp_svc_connection_interface_aliasing_return_from_get_aliases (context, - result); - - g_hash_table_unref (result); -} - static void salut_connection_aliasing_fill_contact_attributes (GObject *obj, const GArray *contacts, GHashTable *attributes_hash) @@ -1559,24 +1507,18 @@ static void _contact_manager_contact_alias_changed (SalutConnection *self, SalutContact *contact, TpHandle handle) { - GPtrArray *aliases; - GValue entry = {0, }; - - g_value_init (&entry, TP_STRUCT_TYPE_ALIAS_PAIR); - g_value_take_boxed (&entry, - dbus_g_type_specialized_construct (TP_STRUCT_TYPE_ALIAS_PAIR)); - - dbus_g_type_struct_set (&entry, - 0, handle, 1, salut_contact_get_alias (contact), G_MAXUINT); - aliases = g_ptr_array_sized_new (1); - g_ptr_array_add (aliases, g_value_get_boxed (&entry)); + GHashTable *aliases; DEBUG("Emitting AliasesChanged"); + aliases = g_hash_table_new (NULL, NULL); + g_hash_table_insert (aliases, + GUINT_TO_POINTER (handle), + (gchar *) salut_contact_get_alias (contact)); + tp_svc_connection_interface_aliasing_emit_aliases_changed (self, aliases); - g_value_unset (&entry); - g_ptr_array_unref (aliases); + g_hash_table_unref (aliases); } static void @@ -1588,9 +1530,7 @@ salut_connection_aliasing_service_iface_init (gpointer g_iface, #define IMPLEMENT(x) tp_svc_connection_interface_aliasing_implement_##x \ (klass, salut_connection_##x) - IMPLEMENT (get_alias_flags); IMPLEMENT (request_aliases); - IMPLEMENT (get_aliases); IMPLEMENT (set_aliases); #undef IMPLEMENT } @@ -1652,62 +1592,6 @@ salut_connection_set_avatar (TpSvcConnectionInterfaceAvatars *iface, } -static void -salut_connection_get_avatar_tokens (TpSvcConnectionInterfaceAvatars *iface, - const GArray *contacts, DBusGMethodInvocation *context) -{ - guint i; - gchar **ret; - GError *err = NULL; - SalutConnection *self = SALUT_CONNECTION (iface); - SalutConnectionPrivate *priv = self->priv; - TpBaseConnection *base = TP_BASE_CONNECTION (self); - TpHandle self_handle = tp_base_connection_get_self_handle (base); - TpHandleRepoIface *handle_repo; - - TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, context); - - handle_repo = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); - - if (!tp_handles_are_valid (handle_repo, contacts, FALSE, &err)) - { - dbus_g_method_return_error (context, err); - g_error_free (err); - return; - } - - ret = g_new0(gchar *, contacts->len + 1); - - for (i = 0; i < contacts->len ; i++) - { - TpHandle handle = g_array_index (contacts, TpHandle, i); - if (self_handle == handle) - { - ret[i] = priv->self->avatar_token; - } - else - { - SalutContact *contact; - - contact = salut_contact_manager_get_contact (priv->contact_manager, - handle); - if (contact != NULL) - { - ret[i] = contact->avatar_token; - g_object_unref (contact); - } - } - if (ret[i] == NULL) - ret[i] = ""; - } - - tp_svc_connection_interface_avatars_return_from_get_avatar_tokens (context, - (const gchar **)ret); - - g_free (ret); -} - static void salut_connection_get_known_avatar_tokens ( TpSvcConnectionInterfaceAvatars *iface, const GArray *contacts, @@ -1901,78 +1785,6 @@ salut_connection_request_avatars ( tp_svc_connection_interface_avatars_return_from_request_avatars (context); } -static void -_request_avatar_cb (SalutContact *contact, guint8 *avatar, gsize size, - gpointer user_data) -{ - DBusGMethodInvocation *context = (DBusGMethodInvocation *) user_data; - - GError *err = NULL; - GArray *arr; - - if (size == 0) - { - err = g_error_new (TP_ERROR, TP_ERROR_NOT_AVAILABLE, - "Unable to get avatar"); - dbus_g_method_return_error (context, err); - g_error_free (err); - return; - } - - arr = g_array_sized_new (FALSE, FALSE, sizeof (guint8), size); - arr = g_array_append_vals (arr, avatar, size); - tp_svc_connection_interface_avatars_return_from_request_avatar (context, - arr, ""); - g_array_unref (arr); -} - -static void -salut_connection_request_avatar (TpSvcConnectionInterfaceAvatars *iface, - guint handle, DBusGMethodInvocation *context) -{ - SalutConnection *self = SALUT_CONNECTION (iface); - SalutConnectionPrivate *priv = self->priv; - TpBaseConnection *base = TP_BASE_CONNECTION (self); - TpHandle self_handle = tp_base_connection_get_self_handle (base); - SalutContact *contact; - GError *err = NULL; - TpHandleRepoIface *handle_repo; - - TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, context); - - handle_repo = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); - - if (!tp_handle_is_valid (handle_repo, handle, &err)) - { - dbus_g_method_return_error (context, err); - g_error_free (err); - return; - } - - if (handle == self_handle) - { - _request_avatar_cb (NULL, priv->self->avatar, priv->self->avatar_size, - context); - return; - } - - contact = salut_contact_manager_get_contact (priv->contact_manager, handle); - if (contact == NULL || contact->avatar_token == NULL) - { - err = g_error_new (TP_ERROR, TP_ERROR_NOT_AVAILABLE, "No known avatar"); - dbus_g_method_return_error (context, err); - g_error_free (err); - if (contact != NULL) - { - g_object_unref (contact); - } - return; - } - salut_contact_get_avatar (contact, _request_avatar_cb, context); - g_object_unref (contact); -} - static void conn_avatars_properties_getter (GObject *object, GQuark interface, @@ -1993,15 +1805,6 @@ conn_avatars_properties_getter (GObject *object, } } -static void -salut_connection_get_avatar_requirements ( - TpSvcConnectionInterfaceAvatars *iface, DBusGMethodInvocation *context) -{ - tp_svc_connection_interface_avatars_return_from_get_avatar_requirements ( - context, mimetypes, AVATAR_MIN_PX, AVATAR_MIN_PX, AVATAR_MAX_PX, - AVATAR_MAX_PX, AVATAR_MAX_BYTES); -} - static void salut_connection_avatar_service_iface_init (gpointer g_iface, gpointer iface_data) @@ -2011,10 +1814,7 @@ salut_connection_avatar_service_iface_init (gpointer g_iface, #define IMPLEMENT(x) tp_svc_connection_interface_avatars_implement_##x \ (klass, salut_connection_##x) - IMPLEMENT (get_avatar_requirements); - IMPLEMENT (get_avatar_tokens); IMPLEMENT (get_known_avatar_tokens); - IMPLEMENT (request_avatar); IMPLEMENT (request_avatars); IMPLEMENT (set_avatar); IMPLEMENT (clear_avatar); @@ -2038,56 +1838,6 @@ salut_free_enhanced_contact_capabilities (GPtrArray *caps) g_ptr_array_unref (caps); } -/** - * salut_connection_get_contact_capabilities - * - * Implements D-Bus method GetContactCapabilities - * on interface - * org.freedesktop.Telepathy.Connection.Interface.ContactCapabilities - */ -static void -salut_connection_get_contact_capabilities ( - TpSvcConnectionInterfaceContactCapabilities *iface, - const GArray *handles, - DBusGMethodInvocation *context) -{ - SalutConnection *self = SALUT_CONNECTION (iface); - TpBaseConnection *base = (TpBaseConnection *) self; - TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (base, - TP_HANDLE_TYPE_CONTACT); - guint i; - GHashTable *ret; - GError *error = NULL; - - TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, context); - - if (!tp_handles_are_valid (contact_handles, handles, FALSE, &error)) - { - dbus_g_method_return_error (context, error); - g_error_free (error); - return; - } - - ret = g_hash_table_new_full (NULL, NULL, NULL, - (GDestroyNotify) salut_free_enhanced_contact_capabilities); - - for (i = 0; i < handles->len; i++) - { - GPtrArray *arr = g_ptr_array_new (); - TpHandle handle = g_array_index (handles, TpHandle, i); - - salut_connection_get_handle_contact_capabilities (self, handle, arr); - - g_hash_table_insert (ret, GINT_TO_POINTER (handle), arr); - } - - tp_svc_connection_interface_contact_capabilities_return_from_get_contact_capabilities - (context, ret); - - g_hash_table_unref (ret); -} - - static void _emit_contact_capabilities_changed (SalutConnection *conn, TpHandle handle) @@ -2169,7 +1919,7 @@ data_forms_equal (GPtrArray *one, * * Implements D-Bus method UpdateCapabilities * on interface - * org.freedesktop.Telepathy.Connection.Interface.ContactCapabilities + * im.telepathy1.Connection.Interface.ContactCapabilities */ static void salut_connection_update_capabilities ( @@ -2301,7 +2051,6 @@ salut_conn_contact_caps_iface_init (gpointer g_iface, gpointer iface_data) #define IMPLEMENT(x) \ tp_svc_connection_interface_contact_capabilities_implement_##x (\ klass, salut_connection_##x) - IMPLEMENT(get_contact_capabilities); IMPLEMENT(update_capabilities); #undef IMPLEMENT } @@ -3531,22 +3280,11 @@ uninvite_stanza_callback (WockyPorter *porter, return TRUE; } -#endif - -static GPtrArray * -salut_connection_create_channel_factories (TpBaseConnection *base) +static void +setup_olpc_activity_manager (SalutConnection *self) { - SalutConnection *self = SALUT_CONNECTION (base); SalutConnectionPrivate *priv = self->priv; - GPtrArray *factories = g_ptr_array_sized_new (4); - - /* Create the contact manager */ - priv->contact_manager = salut_discovery_client_create_contact_manager ( - priv->discovery_client, self); - g_signal_connect (priv->contact_manager, "contact-change", - G_CALLBACK (_contact_manager_contact_change_cb), self); -#ifdef ENABLE_OLPC priv->uninvite_handler_id = wocky_porter_register_handler_from_anyone ( self->porter, WOCKY_STANZA_TYPE_MESSAGE, WOCKY_STANZA_SUB_TYPE_NONE, @@ -3562,12 +3300,8 @@ salut_connection_create_channel_factories (TpBaseConnection *base) priv->discovery_client, self); g_signal_connect (priv->olpc_activity_manager, "activity-modified", G_CALLBACK (_olpc_activity_manager_activity_modified_cb), self); -#endif - - return factories; } -#ifdef ENABLE_OLPC static void muc_channel_closed_cb (SalutMucChannel *chan, SalutOlpcActivity *activity) @@ -3652,12 +3386,16 @@ salut_connection_create_channel_managers (TpBaseConnection *base) GPtrArray *tmp; SalutPluginLoader *loader; - /* FIXME: The second and third arguments depend on create_channel_factories - * being called before this; should telepathy-glib guarantee that or - * should we be defensive? - */ - priv->im_manager = salut_im_manager_new (self, priv->contact_manager); + /* Create the contact manager. This is not a channel manager anymore, + * but still needs to be created from here because others channel managers use + * it and TpBaseConnection calls ::create_channel_managers() before + * ::constructed() */ + self->priv->contact_manager = salut_discovery_client_create_contact_manager ( + self->priv->discovery_client, self); + g_signal_connect (self->priv->contact_manager, "contact-change", + G_CALLBACK (_contact_manager_contact_change_cb), self); + priv->im_manager = salut_im_manager_new (self, priv->contact_manager); priv->ft_manager = salut_ft_manager_new (self, priv->contact_manager); #ifndef USE_BACKEND_BONJOUR @@ -3673,7 +3411,6 @@ salut_connection_create_channel_managers (TpBaseConnection *base) #endif g_ptr_array_add (managers, priv->im_manager); - g_ptr_array_add (managers, priv->contact_manager); g_ptr_array_add (managers, priv->ft_manager); #ifndef USE_BACKEND_BONJOUR g_ptr_array_add (managers, priv->muc_manager); diff --git a/src/contact-manager.c b/src/contact-manager.c index f15eda01..8efd6f83 100644 --- a/src/contact-manager.c +++ b/src/contact-manager.c @@ -40,9 +40,8 @@ static void salut_contact_manager_close_all (SalutContactManager *mgr); static void _contact_finalized_cb (gpointer data, GObject *old_object); -G_DEFINE_TYPE_WITH_CODE(SalutContactManager, salut_contact_manager, - TP_TYPE_BASE_CONTACT_LIST, - G_IMPLEMENT_INTERFACE (GABBLE_TYPE_CAPS_CHANNEL_MANAGER, NULL)) +G_DEFINE_TYPE(SalutContactManager, salut_contact_manager, + TP_TYPE_BASE_CONTACT_LIST) /* signal enum */ enum diff --git a/src/file-transfer-channel.c b/src/file-transfer-channel.c index 78271d63..efc28802 100644 --- a/src/file-transfer-channel.c +++ b/src/file-transfer-channel.c @@ -1188,7 +1188,7 @@ salut_file_transfer_channel_offer_file (SalutFileTransferChannel *self, * salut_file_transfer_channel_accept_file * * Implements D-Bus method AcceptFile - * on interface org.freedesktop.Telepathy.Channel.Type.FileTransfer + * on interface im.telepathy1.Channel.Type.FileTransfer */ static void salut_file_transfer_channel_accept_file (TpSvcChannelTypeFileTransfer *iface, @@ -1264,7 +1264,7 @@ salut_file_transfer_channel_accept_file (TpSvcChannelTypeFileTransfer *iface, * salut_file_transfer_channel_provide_file * * Implements D-Bus method ProvideFile - * on interface org.freedesktop.Telepathy.Channel.Type.FileTransfer + * on interface im.telepathy1.Channel.Type.FileTransfer */ static void salut_file_transfer_channel_provide_file ( diff --git a/src/im-channel.c b/src/im-channel.c index d7a409be..46ecc32f 100644 --- a/src/im-channel.c +++ b/src/im-channel.c @@ -47,9 +47,7 @@ G_DEFINE_TYPE_WITH_CODE (SalutImChannel, salut_im_channel, TP_TYPE_BASE_CHANNEL, G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_TYPE_TEXT, - tp_message_mixin_text_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_MESSAGES, - tp_message_mixin_messages_iface_init); + tp_message_mixin_iface_init) ); /* properties */ @@ -210,10 +208,10 @@ salut_im_channel_fill_immutable_properties (TpBaseChannel *chan, tp_dbus_properties_mixin_fill_properties_hash ( G_OBJECT (chan), properties, - TP_IFACE_CHANNEL_INTERFACE_MESSAGES, "MessagePartSupportFlags", - TP_IFACE_CHANNEL_INTERFACE_MESSAGES, "DeliveryReportingSupport", - TP_IFACE_CHANNEL_INTERFACE_MESSAGES, "SupportedContentTypes", - TP_IFACE_CHANNEL_INTERFACE_MESSAGES, "MessageTypes", + TP_IFACE_CHANNEL_TYPE_TEXT, "MessagePartSupportFlags", + TP_IFACE_CHANNEL_TYPE_TEXT, "DeliveryReportingSupport", + TP_IFACE_CHANNEL_TYPE_TEXT, "SupportedContentTypes", + TP_IFACE_CHANNEL_TYPE_TEXT, "MessageTypes", NULL); } @@ -224,16 +222,6 @@ salut_im_channel_get_object_path_suffix (TpBaseChannel *chan) tp_base_channel_get_target_handle (chan)); } -static GPtrArray * -salut_im_channel_get_interfaces (TpBaseChannel *chan) -{ - GPtrArray *interfaces = TP_BASE_CHANNEL_CLASS (salut_im_channel_parent_class) - ->get_interfaces (chan); - - g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_MESSAGES); - return interfaces; -} - static void salut_im_channel_class_init (SalutImChannelClass *salut_im_channel_class) { @@ -251,7 +239,6 @@ salut_im_channel_class_init (SalutImChannelClass *salut_im_channel_class) object_class->set_property = salut_im_channel_set_property; base_class->channel_type = TP_IFACE_CHANNEL_TYPE_TEXT; - base_class->get_interfaces = salut_im_channel_get_interfaces; base_class->target_handle_type = TP_HANDLE_TYPE_CONTACT; base_class->close = salut_im_channel_close; base_class->fill_immutable_properties = diff --git a/src/muc-channel.c b/src/muc-channel.c index 091e60a2..73d7bf96 100644 --- a/src/muc-channel.c +++ b/src/muc-channel.c @@ -54,14 +54,13 @@ #include "text-helper.h" #include "tube-stream.h" #include "tube-dbus.h" +#include "util.h" G_DEFINE_TYPE_WITH_CODE(SalutMucChannel, salut_muc_channel, TP_TYPE_BASE_CHANNEL, G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_GROUP, tp_group_mixin_iface_init); G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_TYPE_TEXT, - tp_message_mixin_text_iface_init); - G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_MESSAGES, - tp_message_mixin_messages_iface_init); + tp_message_mixin_iface_init); ) /* signal enum */ @@ -123,7 +122,7 @@ static void salut_muc_channel_close (TpBaseChannel *base); static void update_tube_info (SalutMucChannel *self); static SalutTubeIface * create_new_tube (SalutMucChannel *self, - TpTubeType type, + SalutTubeType type, TpHandle initiator, const gchar *service, GHashTable *parameters, @@ -183,6 +182,34 @@ salut_muc_channel_set_property (GObject *object, } } +/* This is helper function with the signature of tp_group_mixin_change_members() + * from tp-glib 0.x */ +static void +change_members (GObject *obj, + const gchar *message, + const TpIntset *add, + const TpIntset *del, + const TpIntset *add_local_pending, + const TpIntset *add_remote_pending, + TpHandle actor, + TpChannelGroupChangeReason reason) +{ + GHashTable *details; + + details = tp_asv_new ( + "actor", G_TYPE_UINT, actor, + "change-reason", G_TYPE_UINT, reason, + NULL); + + if (message != NULL) + tp_asv_set_string (details, "message", message); + + tp_group_mixin_change_members (obj, + add, del, add_local_pending, add_remote_pending, details); + + g_hash_table_unref (details); +} + static void salut_muc_channel_add_self_to_members (SalutMucChannel *self) { @@ -206,7 +233,7 @@ salut_muc_channel_add_self_to_members (SalutMucChannel *self) add = tp_intset_new (); tp_intset_add (add, tp_base_connection_get_self_handle (base_conn)); - tp_group_mixin_change_members (G_OBJECT (self), + change_members (G_OBJECT (self), "", add, empty, empty, empty, tp_base_connection_get_self_handle (base_conn), TP_CHANNEL_GROUP_CHANGE_REASON_NONE); @@ -304,7 +331,6 @@ salut_muc_channel_constructed (GObject *obj) contact_repo, tp_base_connection_get_self_handle (base_conn)); tp_group_mixin_change_flags (obj, - TP_CHANNEL_GROUP_FLAG_PROPERTIES | TP_CHANNEL_GROUP_FLAG_CAN_ADD | TP_CHANNEL_GROUP_FLAG_MESSAGE_ADD, 0); @@ -430,7 +456,7 @@ send_invite_cb (GObject *source_object, removed = tp_intset_new (); tp_intset_add (removed, handle); - tp_group_mixin_change_members (G_OBJECT (data->self), "", empty, removed, empty, + change_members (G_OBJECT (data->self), "", empty, removed, empty, empty, tp_base_connection_get_self_handle (base_connection), TP_CHANNEL_GROUP_CHANGE_REASON_ERROR); @@ -522,7 +548,7 @@ salut_muc_channel_add_member (GObject *iface, { /* We are considered as remote-pending while the muc connection * is not connected */ - tp_group_mixin_change_members (G_OBJECT (self), + change_members (G_OBJECT (self), message, empty_, empty_, empty_, add, tp_base_connection_get_self_handle (base_connection), TP_CHANNEL_GROUP_CHANGE_REASON_NONE); @@ -551,7 +577,7 @@ salut_muc_channel_add_member (GObject *iface, empty = tp_intset_new (); remote_pending = tp_intset_new (); tp_intset_add (remote_pending, handle); - tp_group_mixin_change_members (G_OBJECT(self), "", empty, empty, empty, + change_members (G_OBJECT(self), "", empty, empty, empty, remote_pending, tp_base_connection_get_self_handle (base_connection), TP_CHANNEL_GROUP_CHANGE_REASON_INVITED); tp_intset_destroy (empty); @@ -618,10 +644,10 @@ salut_muc_channel_fill_immutable_properties (TpBaseChannel *chan, tp_dbus_properties_mixin_fill_properties_hash ( G_OBJECT (chan), properties, - TP_IFACE_CHANNEL_INTERFACE_MESSAGES, "MessagePartSupportFlags", - TP_IFACE_CHANNEL_INTERFACE_MESSAGES, "DeliveryReportingSupport", - TP_IFACE_CHANNEL_INTERFACE_MESSAGES, "SupportedContentTypes", - TP_IFACE_CHANNEL_INTERFACE_MESSAGES, "MessageTypes", + TP_IFACE_CHANNEL_TYPE_TEXT, "MessagePartSupportFlags", + TP_IFACE_CHANNEL_TYPE_TEXT, "DeliveryReportingSupport", + TP_IFACE_CHANNEL_TYPE_TEXT, "SupportedContentTypes", + TP_IFACE_CHANNEL_TYPE_TEXT, "MessageTypes", NULL); } @@ -632,7 +658,7 @@ salut_muc_channel_get_interfaces (TpBaseChannel *chan) ->get_interfaces (chan); g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_GROUP); - g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_MESSAGES); + return interfaces; } @@ -828,11 +854,9 @@ salut_muc_channel_invited (SalutMucChannel *self, TpHandle inviter, g_assert (stanza != NULL); tp_intset_add (local_pending, self_handle); - tp_group_mixin_change_members (G_OBJECT(self), stanza, - empty, empty, - local_pending, empty, - inviter, - TP_CHANNEL_GROUP_CHANGE_REASON_INVITED); + change_members (G_OBJECT(self), stanza, + empty, empty, local_pending, empty, + inviter, TP_CHANNEL_GROUP_CHANGE_REASON_INVITED); tp_intset_destroy (local_pending); tp_intset_destroy (empty); } @@ -889,13 +913,8 @@ salut_muc_channel_add_members (SalutMucChannel *self, tp_intset_add (changes, contact->handle); } - tp_group_mixin_change_members (G_OBJECT(self), - "", - changes, - empty, - empty, empty, - 0, - TP_CHANNEL_GROUP_CHANGE_REASON_NONE); + change_members (G_OBJECT(self), "", changes, empty, empty, empty, + 0, TP_CHANNEL_GROUP_CHANGE_REASON_NONE); tp_intset_destroy (changes); tp_intset_destroy (empty); g_object_unref (contact_mgr); @@ -934,13 +953,8 @@ salut_muc_channel_remove_members (SalutMucChannel *self, tp_intset_add (changes, handle); } - tp_group_mixin_change_members (G_OBJECT(self), - "", - empty, - changes, - empty, empty, - 0, - TP_CHANNEL_GROUP_CHANGE_REASON_NONE); + change_members (G_OBJECT(self), "", empty, changes, empty, empty, + 0, TP_CHANNEL_GROUP_CHANGE_REASON_NONE); tp_intset_destroy (changes); tp_intset_destroy (empty); } @@ -949,7 +963,7 @@ salut_muc_channel_remove_members (SalutMucChannel *self, static gboolean extract_tube_information (SalutMucChannel *self, WockyNode *tube_node, - TpTubeType *type, + SalutTubeType *type, TpHandle *initiator_handle, const gchar **service, GHashTable **parameters, @@ -969,11 +983,11 @@ extract_tube_information (SalutMucChannel *self, if (!tp_strdiff (_type, "stream")) { - *type = TP_TUBE_TYPE_STREAM; + *type = SALUT_TUBE_TYPE_STREAM; } else if (!tp_strdiff (_type, "dbus")) { - *type = TP_TUBE_TYPE_DBUS; + *type = SALUT_TUBE_TYPE_DBUS; } else { @@ -1088,13 +1102,13 @@ muc_channel_handle_tubes (SalutMucChannel *self, { guint tube_id = GPOINTER_TO_UINT (key); SalutTubeIface *tube = value; - TpTubeType type; + SalutTubeType type; g_object_get (tube, "type", &type, NULL); - if (type != TP_TUBE_TYPE_DBUS) + if (type != SALUT_TUBE_TYPE_DBUS) return; if (salut_tube_dbus_handle_in_names (SALUT_TUBE_DBUS (tube), @@ -1110,7 +1124,7 @@ muc_channel_handle_tubes (SalutMucChannel *self, const gchar *stream_id; SalutTubeIface *tube; guint tube_id; - TpTubeType type; + SalutTubeType type; GibberBytestreamIface *bytestream; stream_id = wocky_node_get_attribute (tube_node, "stream-id"); @@ -1134,7 +1148,7 @@ muc_channel_handle_tubes (SalutMucChannel *self, { switch (type) { - case TP_TUBE_TYPE_DBUS: + case SALUT_TUBE_TYPE_DBUS: { if (initiator_handle == 0) { @@ -1143,7 +1157,7 @@ muc_channel_handle_tubes (SalutMucChannel *self, } } break; - case TP_TUBE_TYPE_STREAM: + case SALUT_TUBE_TYPE_STREAM: initiator_handle = contact; break; default: @@ -1172,7 +1186,7 @@ muc_channel_handle_tubes (SalutMucChannel *self, "type", &type, NULL); - if (type == TP_TUBE_TYPE_DBUS + if (type == SALUT_TUBE_TYPE_DBUS && !salut_tube_dbus_handle_in_names (SALUT_TUBE_DBUS (tube), contact)) { @@ -1479,7 +1493,7 @@ publish_tube_in_node (SalutMucChannel *self, base_conn, TP_HANDLE_TYPE_CONTACT); WockyNode *parameters_node; GHashTable *parameters; - TpTubeType type; + SalutTubeType type; gchar *service, *id_str; guint64 tube_id; TpHandle initiator_handle; @@ -1501,7 +1515,7 @@ publish_tube_in_node (SalutMucChannel *self, switch (type) { - case TP_TUBE_TYPE_DBUS: + case SALUT_TUBE_TYPE_DBUS: { gchar *name, *stream_id; @@ -1523,7 +1537,7 @@ publish_tube_in_node (SalutMucChannel *self, } break; - case TP_TUBE_TYPE_STREAM: + case SALUT_TUBE_TYPE_STREAM: wocky_node_set_attribute (node, "type", "stream"); break; default: @@ -1577,7 +1591,7 @@ update_tube_info (SalutMucChannel *self) while (g_hash_table_iter_next (&iter, NULL, &value)) { TpTubeChannelState state; - TpTubeType type; + SalutTubeType type; TpHandle initiator; WockyNode *tube_node; @@ -1590,7 +1604,7 @@ update_tube_info (SalutMucChannel *self) if (state != TP_TUBE_CHANNEL_STATE_OPEN) continue; - if (type == TP_TUBE_TYPE_STREAM + if (type == SALUT_TUBE_TYPE_STREAM && initiator != TP_GROUP_MIXIN (self)->self_handle) /* We only announce stream tubes we initiated */ return; @@ -1674,7 +1688,7 @@ generate_tube_id (SalutMucChannel *self) static SalutTubeIface * create_new_tube (SalutMucChannel *self, - TpTubeType type, + SalutTubeType type, TpHandle initiator, const gchar *service, GHashTable *parameters, @@ -1693,12 +1707,12 @@ create_new_tube (SalutMucChannel *self, switch (type) { - case TP_TUBE_TYPE_DBUS: + case SALUT_TUBE_TYPE_DBUS: tube = SALUT_TUBE_IFACE (salut_tube_dbus_new (conn, handle, TP_HANDLE_TYPE_ROOM, self_handle, priv->muc_connection, initiator, service, parameters, tube_id, requested)); break; - case TP_TUBE_TYPE_STREAM: + case SALUT_TUBE_TYPE_STREAM: tube = SALUT_TUBE_IFACE (salut_tube_stream_new (conn, handle, TP_HANDLE_TYPE_ROOM, self_handle, initiator, FALSE, service, @@ -1729,7 +1743,7 @@ salut_muc_channel_tube_request (SalutMucChannel *self, const gchar *service; GHashTable *parameters = NULL; guint64 tube_id; - TpTubeType type; + SalutTubeType type; tube_id = generate_tube_id (self); @@ -1738,14 +1752,14 @@ salut_muc_channel_tube_request (SalutMucChannel *self, if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE)) { - type = TP_TUBE_TYPE_STREAM; + type = SALUT_TUBE_TYPE_STREAM; service = tp_asv_get_string (request_properties, TP_PROP_CHANNEL_TYPE_STREAM_TUBE_SERVICE); } else if (! tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE)) { - type = TP_TUBE_TYPE_DBUS; + type = SALUT_TUBE_TYPE_DBUS; service = tp_asv_get_string (request_properties, TP_PROP_CHANNEL_TYPE_DBUS_TUBE_SERVICE_NAME); } diff --git a/src/muc-manager.c b/src/muc-manager.c index 41cd3438..cdeccdd3 100644 --- a/src/muc-manager.c +++ b/src/muc-manager.c @@ -360,12 +360,12 @@ salut_muc_manager_type_foreach_channel_class (GType type, g_hash_table_insert (table, TP_IFACE_CHANNEL ".TargetHandleType", handle_type_value); - /* org.freedesktop.Telepathy.Channel.Type.Text */ + /* im.telepathy1.Channel.Type.Text */ g_value_set_static_string (channel_type_value, TP_IFACE_CHANNEL_TYPE_TEXT); func (type, table, muc_channel_allowed_properties, user_data); - /* org.freedesktop.Telepathy.Channel.Type.StreamTube */ + /* im.telepathy1.Channel.Type.StreamTube */ g_value_set_static_string (channel_type_value, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE); func (type, table, salut_tube_stream_channel_get_allowed_properties (), diff --git a/src/muc-tube-dbus.c b/src/muc-tube-dbus.c index 5d639f40..3054885e 100644 --- a/src/muc-tube-dbus.c +++ b/src/muc-tube-dbus.c @@ -21,6 +21,8 @@ #include "muc-tube-dbus.h" +#include + G_DEFINE_TYPE (SalutMucTubeDBus, salut_muc_tube_dbus, SALUT_TYPE_TUBE_DBUS) diff --git a/src/muc-tube-stream.c b/src/muc-tube-stream.c index 8155b9c2..f66a96fe 100644 --- a/src/muc-tube-stream.c +++ b/src/muc-tube-stream.c @@ -21,6 +21,8 @@ #include "muc-tube-stream.h" +#include + G_DEFINE_TYPE (SalutMucTubeStream, salut_muc_tube_stream, SALUT_TYPE_TUBE_STREAM) diff --git a/src/protocol.c b/src/protocol.c index 2b805c85..1223734e 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -22,7 +22,7 @@ #include #include -#include +#include #include "connection.h" #include "contact-manager.h" @@ -156,7 +156,6 @@ get_connection_details (TpBaseProtocol *self, if (channel_managers != NULL) { GType types[] = { - SALUT_TYPE_CONTACT_MANAGER, SALUT_TYPE_FT_MANAGER, SALUT_TYPE_IM_MANAGER, SALUT_TYPE_MUC_MANAGER, diff --git a/src/protocol.h b/src/protocol.h index 8e3b4d5b..9b99d538 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -63,9 +63,9 @@ GType salut_protocol_get_type (void); SALUT_TYPE_PROTOCOL, \ SalutProtocolClass)) -#define SALUT_PROTOCOL_LOCAL_XMPP_NAME "local-xmpp" +#define SALUT_PROTOCOL_LOCAL_XMPP_NAME "local_xmpp" #define SALUT_PROTOCOL_LOCAL_XMPP_ENGLISH_NAME "Link-local XMPP" -#define SALUT_PROTOCOL_LOCAL_XMPP_ICON_NAME "im-" SALUT_PROTOCOL_LOCAL_XMPP_NAME +#define SALUT_PROTOCOL_LOCAL_XMPP_ICON_NAME "im-local-xmpp" /** * salut_protocol_new: diff --git a/src/roomlist-channel.c b/src/roomlist-channel.c index bdaa5c99..c09a643c 100644 --- a/src/roomlist-channel.c +++ b/src/roomlist-channel.c @@ -247,7 +247,7 @@ salut_roomlist_channel_add_room (SalutRoomlistChannel *self, dbus_g_type_specialized_construct (TP_STRUCT_TYPE_ROOM_INFO)); dbus_g_type_struct_set (&room, 0, handle, - 1, "org.freedesktop.Telepathy.Channel.Type.Text", + 1, "im.telepathy1.Channel.Type.Text", 2, keys, G_MAXUINT); g_ptr_array_add (priv->rooms, g_value_get_boxed (&room)); @@ -299,7 +299,7 @@ salut_roomlist_channel_remove_room (SalutRoomlistChannel *self, * salut_roomlist_channel_get_listing_rooms * * Implements D-Bus method GetListingRooms - * on interface org.freedesktop.Telepathy.Channel.Type.RoomList + * on interface im.telepathy1.Channel.Type.RoomList * * @error: Used to return a pointer to a GError detailing any error * that occurred, D-Bus will throw the error only if this @@ -324,7 +324,7 @@ salut_roomlist_channel_get_listing_rooms (TpSvcChannelTypeRoomList *iface, * salut_roomlist_channel_list_rooms * * Implements D-Bus method ListRooms - * on interface org.freedesktop.Telepathy.Channel.Type.RoomList + * on interface im.telepathy1.Channel.Type.RoomList * * @error: Used to return a pointer to a GError detailing any error * that occurred, D-Bus will throw the error only if this @@ -350,7 +350,7 @@ salut_roomlist_channel_list_rooms (TpSvcChannelTypeRoomList *iface, * salut_roomlist_channel_stop_listing * * Implements D-Bus method StopListing - * on interface org.freedesktop.Telepathy.Channel.Type.RoomList + * on interface im.telepathy1.Channel.Type.RoomList */ static void salut_roomlist_channel_stop_listing (TpSvcChannelTypeRoomList *iface, diff --git a/src/text-helper.h b/src/text-helper.h index d1ab7c6c..c9c2fcde 100644 --- a/src/text-helper.h +++ b/src/text-helper.h @@ -21,7 +21,7 @@ #ifndef __TEXT_HELPER_H__ #define __TEXT_HELPER_H__ -#include +#include #include diff --git a/src/tube-dbus.c b/src/tube-dbus.c index 08cb0016..c48421d6 100644 --- a/src/tube-dbus.c +++ b/src/tube-dbus.c @@ -43,6 +43,7 @@ #include "muc-tube-dbus.h" #include "tube-iface.h" #include "sha1/sha1-util.h" +#include "util.h" /* When we receive D-Bus messages to be delivered to the application and the * application is not yet connected to the D-Bus tube, theses D-Bus messages @@ -636,7 +637,7 @@ salut_tube_dbus_get_property (GObject *object, g_value_set_string (value, priv->stream_id); break; case PROP_TYPE: - g_value_set_uint (value, TP_TUBE_TYPE_DBUS); + g_value_set_uint (value, SALUT_TUBE_TYPE_DBUS); break; case PROP_SERVICE: g_value_set_string (value, priv->service); @@ -1535,7 +1536,7 @@ salut_tube_dbus_check_access_control (SalutTubeDBus *self, * salut_tube_dbus_offer_async * * Implement D-Bus method Offer on interface - * org.freedesktop.Telepathy.Channel.Type.DBusTube + * im.telepathy1.Channel.Type.DBusTube */ static void salut_tube_dbus_offer_async (TpSvcChannelTypeDBusTube *self, @@ -1575,7 +1576,7 @@ salut_tube_dbus_offer_async (TpSvcChannelTypeDBusTube *self, * salut_tube_dbus_accept_async * * Implements D-Bus method Accept on interface - * org.freedesktop.Telepathy.Channel.Type.DBusTube + * im.telepathy1.Channel.Type.DBusTube */ static void salut_tube_dbus_accept_async (TpSvcChannelTypeDBusTube *self, diff --git a/src/tube-iface.c b/src/tube-iface.c index 5381c989..60b9012a 100644 --- a/src/tube-iface.c +++ b/src/tube-iface.c @@ -144,7 +144,7 @@ salut_tube_iface_base_init (gpointer klass) param_spec = g_param_spec_uint ( "type", "Tube type", - "The TpTubeType this D-Bus tube object.", + "The SalutTubeType this D-Bus tube object.", 0, G_MAXUINT32, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); g_object_interface_install_property (klass, param_spec); @@ -179,7 +179,7 @@ salut_tube_iface_base_init (gpointer klass) "state", "Tube state", "The TpTubeChannelState of this DBUS tube object", - 0, G_MAXUINT32, TP_TUBE_STATE_REMOTE_PENDING, + 0, G_MAXUINT32, TP_TUBE_CHANNEL_STATE_REMOTE_PENDING, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); g_object_interface_install_property (klass, param_spec); diff --git a/src/tube-stream.c b/src/tube-stream.c index fea5be7c..c55c4db1 100644 --- a/src/tube-stream.c +++ b/src/tube-stream.c @@ -65,6 +65,7 @@ #include "tube-iface.h" #include "si-bytestream-manager.h" #include "contact-manager.h" +#include "util.h" static void tube_iface_init (gpointer g_iface, gpointer iface_data); static void streamtube_iface_init (gpointer g_iface, gpointer iface_data); @@ -717,7 +718,8 @@ local_new_connection_cb (GibberListener *listener, static void fire_new_remote_connection (SalutTubeStream *self, GibberTransport *transport, - TpHandle contact) + TpHandle contact, + const gchar *contact_id) { SalutTubeStreamPrivate *priv = SALUT_TUBE_STREAM_GET_PRIVATE (self); GValue access_control_param = {0,}; @@ -734,7 +736,7 @@ fire_new_remote_connection (SalutTubeStream *self, g_assert (connection_id != 0); tp_svc_channel_type_stream_tube_emit_new_remote_connection (self, - contact, &access_control_param, connection_id); + contact, contact_id, &access_control_param, connection_id); g_value_unset (&access_control_param); } @@ -1088,7 +1090,7 @@ salut_tube_stream_get_property (GObject *object, g_value_set_uint64 (value, priv->id); break; case PROP_TYPE: - g_value_set_uint (value, TP_TUBE_TYPE_STREAM); + g_value_set_uint (value, SALUT_TUBE_TYPE_STREAM); break; case PROP_SERVICE: g_value_set_string (value, priv->service); @@ -1857,7 +1859,7 @@ salut_tube_stream_add_bytestream (SalutTubeIface *tube, g_signal_emit (G_OBJECT (self), signals[NEW_CONNECTION], 0, contact); - fire_new_remote_connection (self, transport, contact); + fire_new_remote_connection (self, transport, contact, peer_id); g_free (peer_id); } @@ -2051,7 +2053,7 @@ salut_tube_stream_check_params (TpSocketAddressType address_type, * salut_tube_stream_offer_async * * Implements D-Bus method Offer - * on org.freedesktop.Telepathy.Channel.Type.StreamTube + * on im.telepathy1.Channel.Type.StreamTube */ static void salut_tube_stream_offer_async (TpSvcChannelTypeStreamTube *iface, @@ -2108,7 +2110,7 @@ salut_tube_stream_offer_async (TpSvcChannelTypeStreamTube *iface, * salut_tube_stream_accept_async * * Implements D-Bus method Accept - * on org.freedesktop.Telepathy.Channel.Type.StreamTube + * on im.telepathy1.Channel.Type.StreamTube */ static void salut_tube_stream_accept_async (TpSvcChannelTypeStreamTube *iface, diff --git a/src/tubes-manager.c b/src/tubes-manager.c index 998296cc..45b65669 100644 --- a/src/tubes-manager.c +++ b/src/tubes-manager.c @@ -57,7 +57,7 @@ static void gabble_caps_channel_manager_iface_init ( GabbleCapsChannelManagerIface *); static SalutTubeIface * create_new_tube (SalutTubesManager *self, - TpTubeType type, + SalutTubeType type, TpHandle handle, const gchar *service, GHashTable *parameters, @@ -120,7 +120,7 @@ static gboolean extract_tube_information (TpHandleRepoIface *contact_repo, WockyStanza *stanza, gboolean *close_out, - TpTubeType *type, + SalutTubeType *type, TpHandle *initiator_handle, const gchar **service, GHashTable **parameters, @@ -220,9 +220,9 @@ extract_tube_information (TpHandleRepoIface *contact_repo, tube_type = wocky_node_get_attribute (tube_node, "type"); if (!tp_strdiff (tube_type, "stream")) - *type = TP_TUBE_TYPE_STREAM; + *type = SALUT_TUBE_TYPE_STREAM; else if (!tp_strdiff (tube_type, "dbus")) - *type = TP_TUBE_TYPE_DBUS; + *type = SALUT_TUBE_TYPE_DBUS; else { g_set_error (error, TP_ERROR, TP_ERROR_INVALID_ARGUMENT, @@ -293,7 +293,7 @@ iq_tube_request_cb (WockyPorter *porter, /* tube informations */ const gchar *service; - TpTubeType tube_type; + SalutTubeType tube_type; TpHandle initiator_handle; GHashTable *parameters; guint64 tube_id; @@ -706,7 +706,7 @@ generate_tube_id (SalutTubesManager *self) static SalutTubeIface * create_new_tube (SalutTubesManager *self, - TpTubeType type, + SalutTubeType type, TpHandle handle, const gchar *service, GHashTable *parameters, @@ -720,14 +720,14 @@ create_new_tube (SalutTubesManager *self, TpHandle self_handle = tp_base_connection_get_self_handle (base_conn); SalutTubeIface *tube; - if (type == TP_TUBE_TYPE_STREAM) + if (type == SALUT_TUBE_TYPE_STREAM) { tube = SALUT_TUBE_IFACE (salut_tube_stream_new (priv->conn, handle, TP_HANDLE_TYPE_CONTACT, self_handle, self_handle, FALSE, service, parameters, tube_id, portnum, iq_req, TRUE)); } - else if (type == TP_TUBE_TYPE_DBUS) + else if (type == SALUT_TUBE_TYPE_DBUS) { tube = SALUT_TUBE_IFACE (salut_tube_dbus_new (priv->conn, handle, TP_HANDLE_TYPE_CONTACT, self_handle, NULL, @@ -757,7 +757,7 @@ new_channel_from_request (SalutTubesManager *self, { SalutTubeIface *tube; - TpTubeType type; + SalutTubeType type; const gchar *ctype, *service; TpHandle handle; guint64 tube_id; @@ -778,14 +778,14 @@ new_channel_from_request (SalutTubesManager *self, service = tp_asv_get_string (request, TP_PROP_CHANNEL_TYPE_STREAM_TUBE_SERVICE); - type = TP_TUBE_TYPE_STREAM; + type = SALUT_TUBE_TYPE_STREAM; } else if (!tp_strdiff (ctype, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE)) { service = tp_asv_get_string (request, TP_PROP_CHANNEL_TYPE_DBUS_TUBE_SERVICE_NAME); - type = TP_TUBE_TYPE_DBUS; + type = SALUT_TUBE_TYPE_DBUS; } else { @@ -991,7 +991,7 @@ salut_tubes_manager_iface_init (gpointer g_iface, static void add_service_to_array (const gchar *service, GPtrArray *arr, - TpTubeType type) + SalutTubeType type) { GValue monster = {0, }; GHashTable *fixed_properties; @@ -1003,7 +1003,7 @@ add_service_to_array (const gchar *service, NULL }; - g_assert (type == TP_TUBE_TYPE_STREAM || type == TP_TUBE_TYPE_DBUS); + g_assert (type == SALUT_TUBE_TYPE_STREAM || type == SALUT_TUBE_TYPE_DBUS); g_value_init (&monster, TP_STRUCT_TYPE_REQUESTABLE_CHANNEL_CLASS); g_value_take_boxed (&monster, @@ -1014,7 +1014,7 @@ add_service_to_array (const gchar *service, (GDestroyNotify) tp_g_value_slice_free); channel_type_value = tp_g_value_slice_new (G_TYPE_STRING); - if (type == TP_TUBE_TYPE_STREAM) + if (type == SALUT_TUBE_TYPE_STREAM) g_value_set_static_string (channel_type_value, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE); else @@ -1030,7 +1030,7 @@ add_service_to_array (const gchar *service, target_handle_type_value = tp_g_value_slice_new (G_TYPE_STRING); g_value_set_string (target_handle_type_value, service); - if (type == TP_TUBE_TYPE_STREAM) + if (type == SALUT_TUBE_TYPE_STREAM) g_hash_table_insert (fixed_properties, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE ".Service", target_handle_type_value); @@ -1142,10 +1142,10 @@ get_contact_caps_foreach (gpointer data, if (g_str_has_prefix (ns, STREAM_CAP_PREFIX)) add_service_to_array (ns + strlen (STREAM_CAP_PREFIX), closure->arr, - TP_TUBE_TYPE_STREAM); + SALUT_TUBE_TYPE_STREAM); else if (g_str_has_prefix (ns, DBUS_CAP_PREFIX)) add_service_to_array (ns + strlen (DBUS_CAP_PREFIX), closure->arr, - TP_TUBE_TYPE_DBUS); + SALUT_TUBE_TYPE_DBUS); } static void diff --git a/src/util.h b/src/util.h index 03a6e8dd..1f4876f5 100644 --- a/src/util.h +++ b/src/util.h @@ -32,4 +32,10 @@ void salut_wocky_node_add_children_from_properties (WockyNode *node, GHashTable *properties, const gchar *prop); gchar *salut_generate_id (void); +typedef enum +{ + SALUT_TUBE_TYPE_STREAM, + SALUT_TUBE_TYPE_DBUS, +} SalutTubeType; + #endif /* __SALUT_UTIL_H__ */ diff --git a/src/write-mgr-file.c b/src/write-mgr-file.c index 6a02fff8..fd52820c 100644 --- a/src/write-mgr-file.c +++ b/src/write-mgr-file.c @@ -25,7 +25,7 @@ #include #include -#include +#include #include "protocol.h" @@ -206,14 +206,6 @@ generate_group_name (GHashTable *props) handle_type_name = "-multi"; break; - case TP_HANDLE_TYPE_GROUP: - handle_type_name = "-group"; - break; - - case TP_HANDLE_TYPE_LIST: - handle_type_name = "-list"; - break; - default: handle_type_name = ""; } @@ -280,7 +272,7 @@ write_presence (GKeyFile *f, statuses = tp_asv_get_boxed (props, TP_PROP_PROTOCOL_INTERFACE_PRESENCE_STATUSES, - TP_HASH_TYPE_SIMPLE_STATUS_SPEC_MAP); + TP_HASH_TYPE_STATUS_SPEC_MAP); g_return_if_fail (statuses != NULL); g_hash_table_iter_init (&iter, statuses); diff --git a/tests/twisted/avahi/aliases.py b/tests/twisted/avahi/aliases.py index 41c82857..af18ab3a 100644 --- a/tests/twisted/avahi/aliases.py +++ b/tests/twisted/avahi/aliases.py @@ -13,8 +13,8 @@ import time def wait_for_aliases_changed(q, handle): e = q.expect('dbus-signal', signal='AliasesChanged', - predicate=lambda e: e.args[0][0][0] == handle) - _, alias = e.args[0][0] + predicate=lambda e: handle in e.args[0]) + alias = e.args[0][handle] return alias def wait_for_contact_info_changed(q, handle): @@ -57,7 +57,7 @@ def check_contact_info(info, txt): def check_all_contact_info_methods(conn, handle, keys): attrs = conn.Contacts.GetContactAttributes([handle], - [cs.CONN_IFACE_CONTACT_INFO], True)[handle] + [cs.CONN_IFACE_CONTACT_INFO])[handle] info = attrs[cs.CONN_IFACE_CONTACT_INFO + "/info"] check_contact_info(info, keys) @@ -127,7 +127,7 @@ def test(q, bus, conn): check_contact_info(info, dict) attrs = conn.Contacts.GetContactAttributes([handle], - [cs.CONN_IFACE_ALIASING], True)[handle] + [cs.CONN_IFACE_ALIASING])[handle] assertEquals(alias, attrs[cs.CONN_IFACE_ALIASING + "/alias"]) check_all_contact_info_methods(conn, handle, dict) diff --git a/tests/twisted/avahi/caps-file-transfer.py b/tests/twisted/avahi/caps-file-transfer.py index c239fdfd..13425c26 100644 --- a/tests/twisted/avahi/caps-file-transfer.py +++ b/tests/twisted/avahi/caps-file-transfer.py @@ -140,7 +140,7 @@ def test_ft_caps_from_contact(q, bus, conn, client): # check the Contacts interface give the same caps caps_via_contacts_iface = conn_contacts_iface.GetContactAttributes( - [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [contact_handle][cs.CONN_IFACE_CONTACT_CAPS + '/capabilities'] assert caps_via_contacts_iface == caps, caps_via_contacts_iface @@ -194,7 +194,7 @@ def test_ft_caps_from_contact(q, bus, conn, client): # check the Contacts interface give the same caps caps_via_contacts_iface = conn_contacts_iface.GetContactAttributes( - [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [contact_handle][cs.CONN_IFACE_CONTACT_CAPS + '/capabilities'] assert caps_via_contacts_iface == caps, caps_via_contacts_iface @@ -215,7 +215,7 @@ def test_ft_caps_from_contact(q, bus, conn, client): # check the Contacts interface give the same caps caps_via_contacts_iface = conn_contacts_iface.GetContactAttributes( - [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [contact_handle][cs.CONN_IFACE_CONTACT_CAPS + '/capabilities'] assert caps_via_contacts_iface == caps, caps_via_contacts_iface @@ -231,7 +231,7 @@ def test(q, bus, conn): self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") conn_contacts_iface = dbus.Interface(conn, cs.CONN_IFACE_CONTACTS) caps = conn_contacts_iface.GetContactAttributes( - [self_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [self_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [self_handle][cs.CONN_IFACE_CONTACT_CAPS + '/capabilities'] assertContains(ft_metadata_caps, caps) diff --git a/tests/twisted/avahi/caps-self.py b/tests/twisted/avahi/caps-self.py index 4438d937..c176691b 100644 --- a/tests/twisted/avahi/caps-self.py +++ b/tests/twisted/avahi/caps-self.py @@ -1,6 +1,6 @@ """ Basic test of SetSelfCapabilities on interface -org.freedesktop.Telepathy.Connection.Interface.ContactCapabilities +im.telepathy1.Connection.Interface.ContactCapabilities """ from saluttest import exec_test diff --git a/tests/twisted/avahi/close-local-pending-room.py b/tests/twisted/avahi/close-local-pending-room.py index 1e04fa37..5066fcfd 100644 --- a/tests/twisted/avahi/close-local-pending-room.py +++ b/tests/twisted/avahi/close-local-pending-room.py @@ -61,18 +61,18 @@ def test(q, bus, conn): xmpp_connection.send(message) # group channel is created - e = q.expect('dbus-signal', signal='NewChannel', + e = q.expect('dbus-signal', signal='NewChannels', predicate=lambda e: - e.args[1] == cs.CHANNEL_TYPE_TEXT and - e.args[2] == cs.HT_ROOM) - path = e.args[0] + e.args[0][0][1][cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_TEXT and + e.args[0][0][1][cs.TARGET_HANDLE_TYPE] == cs.HT_ROOM) + path = e.args[0][0][0] channel = make_channel_proxy(conn, path, 'Channel') props_iface = dbus.Interface(bus.get_object(conn.object.bus_name, path), dbus.PROPERTIES_IFACE) q.expect('dbus-signal', signal='MembersChanged', path=path) - lp_members = props_iface.Get('org.freedesktop.Telepathy.Channel.Interface.Group', + lp_members = props_iface.Get('im.telepathy1.Channel.Interface.Group1', 'LocalPendingMembers') assert len(lp_members) == 1 diff --git a/tests/twisted/avahi/file-transfer/file_transfer_helper.py b/tests/twisted/avahi/file-transfer/file_transfer_helper.py index cb10c6b8..edfb1989 100644 --- a/tests/twisted/avahi/file-transfer/file_transfer_helper.py +++ b/tests/twisted/avahi/file-transfer/file_transfer_helper.py @@ -133,7 +133,7 @@ class FileTransferTest(object): def create_ft_channel(self): self.channel = make_channel_proxy(self.conn, self.ft_path, 'Channel') - self.ft_channel = make_channel_proxy(self.conn, self.ft_path, 'Channel.Type.FileTransfer') + self.ft_channel = make_channel_proxy(self.conn, self.ft_path, 'Channel.Type.FileTransfer1') self.ft_props = dbus.Interface(self.bus.get_object( self.conn.object.bus_name, self.ft_path), PROPERTIES_IFACE) @@ -246,7 +246,7 @@ class ReceiveFileTest(FileTransferTest): path, props = channels[0] # check channel properties - # org.freedesktop.Telepathy.Channel D-Bus properties + # im.telepathy1.Channel D-Bus properties assert props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_FILE_TRANSFER assert props[cs.INTERFACES] == [] assert props[cs.TARGET_HANDLE] == self.handle @@ -256,7 +256,7 @@ class ReceiveFileTest(FileTransferTest): assert props[cs.INITIATOR_HANDLE] == self.handle assert props[cs.INITIATOR_ID] == self.contact_name - # org.freedesktop.Telepathy.Channel.Type.FileTransfer D-Bus properties + # im.telepathy1.Channel.Type.FileTransfer D-Bus properties assert props[cs.FT_STATE] == cs.FT_STATE_PENDING assert props[cs.FT_CONTENT_TYPE] == self.file.content_type assert props[cs.FT_FILENAME] == self.file.name @@ -410,7 +410,7 @@ class SendFileTest(FileTransferTest): self.ft_path, props = self.conn.Requests.CreateChannel(request) - # org.freedesktop.Telepathy.Channel D-Bus properties + # im.telepathy1.Channel D-Bus properties assert props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_FILE_TRANSFER assert props[cs.INTERFACES] == [] assert props[cs.TARGET_HANDLE] == self.handle @@ -420,7 +420,7 @@ class SendFileTest(FileTransferTest): assert props[cs.INITIATOR_HANDLE] == self.self_handle assert props[cs.INITIATOR_ID] == self.self_handle_name - # org.freedesktop.Telepathy.Channel.Type.FileTransfer D-Bus properties + # im.telepathy1.Channel.Type.FileTransfer D-Bus properties assert props[cs.FT_STATE] == cs.FT_STATE_PENDING assert props[cs.FT_CONTENT_TYPE] == self.file.content_type assert props[cs.FT_FILENAME] == self.file.name diff --git a/tests/twisted/avahi/file-transfer/ft-client-caps.py b/tests/twisted/avahi/file-transfer/ft-client-caps.py index 3cb6aca3..8d6bb8df 100644 --- a/tests/twisted/avahi/file-transfer/ft-client-caps.py +++ b/tests/twisted/avahi/file-transfer/ft-client-caps.py @@ -131,7 +131,7 @@ def receive_caps(q, bus, conn, service, contact, contact_handle, features, # check the Contacts interface give the same caps caps_via_contacts_iface = conn.Contacts.GetContactAttributes( - [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [contact_handle][cs.ATTR_CONTACT_CAPABILITIES] assertSameElements(expected_caps, caps_via_contacts_iface) @@ -151,7 +151,7 @@ def test_ft_caps_from_contact(q, bus, conn, service, contact): # Check that we don't crash if we haven't seen any caps/presence for this # contact yet. caps = conn.Contacts.GetContactAttributes( - [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [contact_handle] basic_caps = [(text_fixed_properties, text_allowed_properties)] @@ -243,7 +243,7 @@ def advertise_caps(q, bus, conn, service, filters, expected_features, unexpected # check the Contacts interface give the same caps caps_via_contacts_iface = conn.Contacts.GetContactAttributes( - [self_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [self_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [self_handle][cs.ATTR_CONTACT_CAPABILITIES] assertSameElements(expected_caps, caps_via_contacts_iface) @@ -276,7 +276,7 @@ def test_ft_caps_to_contact(q, bus, conn, service): # Check our own caps # caps_via_contacts_iface = conn.Contacts.GetContactAttributes( - [self_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [self_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [self_handle][cs.ATTR_CONTACT_CAPABILITIES] assertEquals(basic_caps, caps_via_contacts_iface) @@ -288,7 +288,7 @@ def test_ft_caps_to_contact(q, bus, conn, service): # Check our own caps caps_via_contacts_iface = conn.Contacts.GetContactAttributes( - [self_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [self_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [self_handle][cs.ATTR_CONTACT_CAPABILITIES] assertEquals(basic_caps, caps_via_contacts_iface) @@ -302,7 +302,7 @@ def test_ft_caps_to_contact(q, bus, conn, service): # Check our own caps caps_via_contacts_iface = conn.Contacts.GetContactAttributes( - [self_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [self_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [self_handle][cs.ATTR_CONTACT_CAPABILITIES] assertEquals(basic_caps, caps_via_contacts_iface) @@ -316,7 +316,7 @@ def test_ft_caps_to_contact(q, bus, conn, service): # Check our own caps caps_via_contacts_iface = conn.Contacts.GetContactAttributes( - [self_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ + [self_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [self_handle][cs.ATTR_CONTACT_CAPABILITIES] assertEquals(basic_caps, caps_via_contacts_iface) diff --git a/tests/twisted/avahi/ichat-composing.py b/tests/twisted/avahi/ichat-composing.py index ae48d8a8..c2057fac 100644 --- a/tests/twisted/avahi/ichat-composing.py +++ b/tests/twisted/avahi/ichat-composing.py @@ -66,9 +66,11 @@ def test(q, bus, conn): event.addElement('composing') xmpp_connection.send(message) - e = q.expect('dbus-signal', signal='Received') - assert e.args[2] == handle - assert e.args[5] == OUTGOING_MESSAGE + e = q.expect('dbus-signal', signal='MessageReceived') + assert len(e.args[0]) == 2 + assert e.args[0][0]['message-sender-id'] == contact_name + assert e.args[0][0]['message-sender'] == handle + assert e.args[0][1]['content'] == OUTGOING_MESSAGE if __name__ == '__main__': exec_test(test) diff --git a/tests/twisted/avahi/ichat-incoming-msg.py b/tests/twisted/avahi/ichat-incoming-msg.py index 71812230..bbf3bf06 100644 --- a/tests/twisted/avahi/ichat-incoming-msg.py +++ b/tests/twisted/avahi/ichat-incoming-msg.py @@ -53,10 +53,12 @@ def test(q, bus, conn): boddy = msg.addElement('body', content='hi') outbound.send(msg) - e = q.expect('dbus-signal', signal='Received') - assert e.args[2] == handle - assert e.args[3] == cs.MT_NORMAL - assert e.args[5] == "hi" + e = q.expect('dbus-signal', signal='MessageReceived') + assert len(e.args[0]) == 2 + assert e.args[0][0]['message-sender-id'] == contact_name + assert e.args[0][0]['message-sender'] == handle + assert e.args[0][0]['message-type'] == cs.MT_NORMAL + assert e.args[0][1]['content'] == "hi" if __name__ == '__main__': skip_if_another_llxmpp() diff --git a/tests/twisted/avahi/muc-invite.py b/tests/twisted/avahi/muc-invite.py index abfc8f28..6f0a6116 100644 --- a/tests/twisted/avahi/muc-invite.py +++ b/tests/twisted/avahi/muc-invite.py @@ -80,10 +80,9 @@ def test(q, bus, conn): channel_group = make_channel_proxy(conn, path, "Channel.Interface.Group") # check channel properties - # org.freedesktop.Telepathy.Channel D-Bus properties + # im.telepathy1.Channel D-Bus properties assert props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_TEXT assertContains(cs.CHANNEL_IFACE_GROUP, props[cs.INTERFACES]) - assertContains(cs.CHANNEL_IFACE_MESSAGES, props[cs.INTERFACES]) assert props[cs.TARGET_ID] == 'my-room' assert props[cs.TARGET_HANDLE_TYPE] == HT_ROOM assert props[cs.REQUESTED] == False @@ -92,14 +91,14 @@ def test(q, bus, conn): # we are added to local pending e = q.expect('dbus-signal', signal='MembersChanged') - msg, added, removed, lp, rp, actor, reason = e.args - assert msg == 'Inviting to this room' + added, removed, lp, rp, details = e.args + assert details['message'] == 'Inviting to this room' assert added == [] assert removed == [] assert lp == [self_handle] assert rp == [] - assert actor == handle - assert reason == 4 # invited + assert details['actor'] == handle + assert details['change-reason'] == 4 # invited # TODO: join the muc, check if we are added to remote-pending and then # to members. This would need some tweak in Salut and/or the test framework diff --git a/tests/twisted/avahi/olpc-activity-announcements.py b/tests/twisted/avahi/olpc-activity-announcements.py index 6b4d01a2..93dbd1a6 100644 --- a/tests/twisted/avahi/olpc-activity-announcements.py +++ b/tests/twisted/avahi/olpc-activity-announcements.py @@ -13,7 +13,7 @@ import time import dbus import socket -CHANNEL_TYPE_TEXT = "org.freedesktop.Telepathy.Channel.Type.Text" +CHANNEL_TYPE_TEXT = "im.telepathy1.Channel.Type.Text" HT_CONTACT = 1 HT_ROOM = 2 HT_CONTACT_LIST = 3 diff --git a/tests/twisted/avahi/request-im.py b/tests/twisted/avahi/request-im.py index d7d2141e..93e3abf7 100644 --- a/tests/twisted/avahi/request-im.py +++ b/tests/twisted/avahi/request-im.py @@ -5,13 +5,11 @@ Test requesting of text 1-1 channels using the old and new request API. import dbus -from saluttest import (exec_test, wait_for_contact_list, - wait_for_contact_in_publish) +from saluttest import (exec_test, wait_for_contact_in_publish) from servicetest import call_async, EventPattern, \ tp_name_prefix, make_channel_proxy from avahitest import get_host_name, AvahiAnnouncer from xmppstream import setup_stream_listener - import constants as cs def test(q, bus, conn): @@ -24,10 +22,6 @@ def test(q, bus, conn): contact_name = "test-request-im@" + get_host_name() listener, port = setup_stream_listener(q, contact_name) - # FIXME: this is a hack to be sure to have all the contact list channels - # announced so they won't interfere with the muc ones announces. - wait_for_contact_list(q, conn) - AvahiAnnouncer(contact_name, "_presence._tcp", port, basic_txt) handle = wait_for_contact_in_publish(q, bus, conn, contact_name) diff --git a/tests/twisted/avahi/request-muc.py b/tests/twisted/avahi/request-muc.py index a6283b2e..9ef67770 100644 --- a/tests/twisted/avahi/request-muc.py +++ b/tests/twisted/avahi/request-muc.py @@ -8,7 +8,7 @@ import avahitest from twisted.words.xish import domish -from saluttest import exec_test, wait_for_contact_list +from saluttest import exec_test from servicetest import call_async, EventPattern, \ tp_name_prefix, tp_path_prefix, make_channel_proxy @@ -21,10 +21,6 @@ def test(q, bus, conn): q.expect('dbus-signal', signal='StatusChanged', args=[0L, 0L]) - # FIXME: this is a hack to be sure to have all the contact list channels - # announced so they won't interfere with the muc ones announces. - wait_for_contact_list(q, conn) - # check if we can request roomlist channels properties = conn.GetAll( tp_name_prefix + '.Connection.Interface.Requests', diff --git a/tests/twisted/avahi/roomlist.py b/tests/twisted/avahi/roomlist.py index 7e84a1be..21fb1824 100644 --- a/tests/twisted/avahi/roomlist.py +++ b/tests/twisted/avahi/roomlist.py @@ -8,7 +8,7 @@ import avahitest from twisted.words.xish import domish -from saluttest import exec_test, wait_for_contact_list +from saluttest import exec_test from servicetest import call_async, EventPattern, \ tp_name_prefix, tp_path_prefix, wrap_channel import constants as cs @@ -20,14 +20,11 @@ def test(q, bus, conn): q.expect('dbus-signal', signal='StatusChanged', args=[0L, 0L]) - # FIXME: this is a hack to be sure to have all the contact list channels - # announced so they won't interfere with the roomlist ones announces. - wait_for_contact_list(q, conn) - # check if we can request roomlist channels properties = conn.GetAll( tp_name_prefix + '.Connection.Interface.Requests', dbus_interface='org.freedesktop.DBus.Properties') + assert ({tp_name_prefix + '.Channel.ChannelType': cs.CHANNEL_TYPE_ROOM_LIST, tp_name_prefix + '.Channel.TargetHandleType': 0, @@ -51,7 +48,7 @@ def test(q, bus, conn): EventPattern('dbus-signal', signal='NewChannels'), ) path2 = ret.value[0] - chan2 = wrap_channel(bus.get_object(conn.bus_name, path2), "RoomList") + chan2 = wrap_channel(bus.get_object(conn.bus_name, path2), "RoomList1") props = ret.value[1] assert props[tp_name_prefix + '.Channel.ChannelType'] ==\ @@ -64,7 +61,7 @@ def test(q, bus, conn): == conn.Properties.Get(cs.CONN, "SelfHandle") assert props[tp_name_prefix + '.Channel.InitiatorID'] \ == self_name - assert props[tp_name_prefix + '.Channel.Type.RoomList.Server'] == '' + assert props[tp_name_prefix + '.Channel.Type.RoomList1.Server'] == '' assert new_sig.args[0][0][0] == path2 assert new_sig.args[0][0][1] == props diff --git a/tests/twisted/avahi/set-presence.py b/tests/twisted/avahi/set-presence.py index 82343c4b..b6f38f1e 100644 --- a/tests/twisted/avahi/set-presence.py +++ b/tests/twisted/avahi/set-presence.py @@ -32,13 +32,13 @@ def test(q, bus, conn): assert status == 'avail', status assert msg is None, msg - statuses = conn.Get(cs.CONN_IFACE_SIMPLE_PRESENCE, 'Statuses', dbus_interface=dbus.PROPERTIES_IFACE) + statuses = conn.Get(cs.CONN_IFACE_PRESENCE, 'Statuses', dbus_interface=dbus.PROPERTIES_IFACE) assert 'available' in statuses assert 'dnd' in statuses assert 'away' in statuses - simple_presence = dbus.Interface(conn, cs.CONN_IFACE_SIMPLE_PRESENCE) + simple_presence = dbus.Interface(conn, cs.CONN_IFACE_PRESENCE) # set your status to away simple_presence.SetPresence('away', 'At the pub') diff --git a/tests/twisted/avahi/text-channel.py b/tests/twisted/avahi/text-channel.py index b37b1c2f..acaed6a2 100644 --- a/tests/twisted/avahi/text-channel.py +++ b/tests/twisted/avahi/text-channel.py @@ -34,7 +34,9 @@ def test(q, bus, conn): cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT, cs.TARGET_HANDLE: handle})[0] text_channel = make_channel_proxy(conn, t, "Channel.Type.Text") - text_channel.Send(cs.MT_NORMAL, INCOMING_MESSAGE) + text_channel.SendMessage([{'message-type': cs.MT_NORMAL}, + {'content-type': 'text/plain', + 'content': INCOMING_MESSAGE}], 0) e = q.expect('incoming-connection', listener = listener) incoming = e.connection @@ -76,11 +78,12 @@ def test(q, bus, conn): e.connection.send(message) - e = q.expect('dbus-signal', signal='Received') - assert e.args[2] == handle - assert e.args[3] == cs.MT_NORMAL - assert e.args[5] == OUTGOING_MESSAGE - + e = q.expect('dbus-signal', signal='MessageReceived') + assert len(e.args[0]) == 2 + assert e.args[0][0]['message-sender-id'] == contact_name + assert e.args[0][0]['message-sender'] == handle + assert e.args[0][0]['message-type'] == cs.MT_NORMAL + assert e.args[0][1]['content'] == OUTGOING_MESSAGE if __name__ == '__main__': exec_test(test) diff --git a/tests/twisted/avahi/tubes/request-muc-tubes.py b/tests/twisted/avahi/tubes/request-muc-tubes.py index 21100f15..206f3384 100644 --- a/tests/twisted/avahi/tubes/request-muc-tubes.py +++ b/tests/twisted/avahi/tubes/request-muc-tubes.py @@ -8,7 +8,7 @@ import avahitest from twisted.words.xish import domish -from saluttest import exec_test, wait_for_contact_list +from saluttest import exec_test from servicetest import call_async, EventPattern, wrap_channel, pretty import constants as cs @@ -19,10 +19,6 @@ def test(q, bus, conn): q.expect('dbus-signal', signal='StatusChanged', args=[0L, 0L]) - # FIXME: this is a hack to be sure to have all the contact list channels - # announced so they won't interfere with the muc ones announces. - wait_for_contact_list(q, conn) - # check if we can request tube channels properties = conn.Properties.GetAll(cs.CONN_IFACE_REQUESTS) assert ({cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_STREAM_TUBE, diff --git a/tests/twisted/avahi/tubes/tubetestutil.py b/tests/twisted/avahi/tubes/tubetestutil.py index d058ef62..4e342f9e 100644 --- a/tests/twisted/avahi/tubes/tubetestutil.py +++ b/tests/twisted/avahi/tubes/tubetestutil.py @@ -1,4 +1,4 @@ -from saluttest import make_connection, wait_for_contact_list +from saluttest import make_connection from avahitest import get_host_name from servicetest import make_channel_proxy @@ -10,10 +10,6 @@ def connect_two_accounts(q, bus, conn): conn.Connect() q.expect('dbus-signal', signal='StatusChanged', args=[cs.CONN_STATUS_CONNECTED, cs.CSR_NONE_SPECIFIED]) - # FIXME: this is a hack to be sure to have all the contact list channels - # announced so they won't interfere with other channels announces. - wait_for_contact_list(q, conn) - # second connection: connect conn2_params = { 'published-name': 'testsuite2', @@ -25,8 +21,6 @@ def connect_two_accounts(q, bus, conn): conn2.Connect() q.expect('dbus-signal', signal='StatusChanged', args=[cs.CONN_STATUS_CONNECTED, cs.CSR_NONE_SPECIFIED]) - wait_for_contact_list(q, conn2) - # first connection: get the contact list publish_handle = conn.RequestHandles(cs.HT_LIST, ["publish"])[0] conn1_publish = conn.RequestChannel(cs.CHANNEL_TYPE_CONTACT_LIST, @@ -62,7 +56,7 @@ def connect_two_accounts(q, bus, conn): # property first contact1_handle_on_conn2 = 0 conn2_members = conn2_publish_proxy.Get( - 'org.freedesktop.Telepathy.Channel.Interface.Group', 'Members', + 'im.telepathy1.Channel.Interface.Group', 'Members', dbus_interface='org.freedesktop.DBus.Properties') for h in conn2_members: name = conn2.InspectHandles(cs.HT_CONTACT, [h])[0] diff --git a/tests/twisted/avahi/tubes/two-muc-dbus-tubes.py b/tests/twisted/avahi/tubes/two-muc-dbus-tubes.py index 6fc81097..ae8864c3 100644 --- a/tests/twisted/avahi/tubes/two-muc-dbus-tubes.py +++ b/tests/twisted/avahi/tubes/two-muc-dbus-tubes.py @@ -21,9 +21,9 @@ def check_dbus_names(tube, members): names = tube.Properties.Get(cs.CHANNEL_TYPE_DBUS_TUBE, 'DBusNames') assert set(names.keys()) == set(members), names.keys() -SERVICE = "org.freedesktop.Telepathy.Tube.Test" +SERVICE = "im.telepathy1.Tube.Test" IFACE = SERVICE -PATH = "/org/freedesktop/Telepathy/Tube/Test" +PATH = "/im/telepathy1/Tube/Test" print "FIXME: MUC tubes tests are currently broken: fdo#69223" # exiting 77 causes automake to consider the test to have been skipped diff --git a/tests/twisted/cm/protocol.py b/tests/twisted/cm/protocol.py index 6f62f1ec..157c6b6f 100644 --- a/tests/twisted/cm/protocol.py +++ b/tests/twisted/cm/protocol.py @@ -16,9 +16,9 @@ def test(q, bus, conn): cm_prop_iface = dbus.Interface(cm, cs.PROPERTIES_IFACE) protocols = unwrap(cm_prop_iface.Get(cs.CM, 'Protocols')) - assertEquals(set(['local-xmpp']), set(protocols.keys())) + assertEquals(set(['local_xmpp']), set(protocols.keys())) - local_props = protocols['local-xmpp'] + local_props = protocols['local_xmpp'] local_params = local_props[cs.PROTOCOL + '.Parameters'] proto = bus.get_object(cm.bus_name, cm.object_path + '/local_xmpp') @@ -39,7 +39,7 @@ def test(q, bus, conn): assertContains(cs.CONN_IFACE_ALIASING, proto_props['ConnectionInterfaces']) assertContains(cs.CONN_IFACE_AVATARS, proto_props['ConnectionInterfaces']) assertContains(cs.CONN_IFACE_CONTACTS, proto_props['ConnectionInterfaces']) - assertContains(cs.CONN_IFACE_SIMPLE_PRESENCE, + assertContains(cs.CONN_IFACE_PRESENCE, proto_props['ConnectionInterfaces']) assertContains(cs.CONN_IFACE_REQUESTS, proto_props['ConnectionInterfaces']) diff --git a/tests/twisted/constants.py b/tests/twisted/constants.py index 8c601678..30283533 100644 --- a/tests/twisted/constants.py +++ b/tests/twisted/constants.py @@ -4,54 +4,43 @@ Some handy constants for other tests to share and enjoy. from dbus import PROPERTIES_IFACE -PREFIX = "org.freedesktop.Telepathy" +PREFIX = "im.telepathy1" CM = PREFIX + ".ConnectionManager" HT_NONE = 0 HT_CONTACT = 1 HT_ROOM = 2 -HT_LIST = 3 -HT_GROUP = 4 CHANNEL = PREFIX + ".Channel" -CHANNEL_IFACE_CALL_STATE = CHANNEL + ".Interface.CallState" -CHANNEL_IFACE_CHAT_STATE = CHANNEL + '.Interface.ChatState' -CHANNEL_IFACE_DESTROYABLE = CHANNEL + ".Interface.Destroyable" -CHANNEL_IFACE_DTMF = CHANNEL + ".Interface.DTMF" -CHANNEL_IFACE_GROUP = CHANNEL + ".Interface.Group" -CHANNEL_IFACE_HOLD = CHANNEL + ".Interface.Hold" -CHANNEL_IFACE_MEDIA_SIGNALLING = CHANNEL + ".Interface.MediaSignalling" -CHANNEL_IFACE_MESSAGES = CHANNEL + ".Interface.Messages" -CHANNEL_IFACE_PASSWORD = CHANNEL + ".Interface.Password" -CHANNEL_IFACE_TUBE = CHANNEL + ".Interface.Tube" -CHANNEL_IFACE_SASL_AUTH = CHANNEL + ".Interface.SASLAuthentication" -CHANNEL_IFACE_CONFERENCE = CHANNEL + '.Interface.Conference' -CHANNEL_IFACE_ROOM = CHANNEL + '.Interface.Room2' +CHANNEL_IFACE_CHAT_STATE = CHANNEL + '.Interface.ChatState1' +CHANNEL_IFACE_DESTROYABLE = CHANNEL + ".Interface.Destroyable1" +CHANNEL_IFACE_DTMF = CHANNEL + ".Interface.DTMF1" +CHANNEL_IFACE_GROUP = CHANNEL + ".Interface.Group1" +CHANNEL_IFACE_HOLD = CHANNEL + ".Interface.Hold1" +CHANNEL_IFACE_PASSWORD = CHANNEL + ".Interface.Password1" +CHANNEL_IFACE_TUBE = CHANNEL + ".Interface.Tube1" +CHANNEL_IFACE_SASL_AUTH = CHANNEL + ".Interface.SASLAuthentication1" +CHANNEL_IFACE_CONFERENCE = CHANNEL + '.Interface.Conference1' +CHANNEL_IFACE_ROOM = CHANNEL + '.Interface.Room1' CHANNEL_IFACE_ROOM_CONFIG = CHANNEL + '.Interface.RoomConfig1' -CHANNEL_IFACE_SUBJECT = CHANNEL + '.Interface.Subject2' -CHANNEL_IFACE_FILE_TRANSFER_METADATA = CHANNEL + '.Interface.FileTransfer.Metadata' +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.ContactList" -CHANNEL_TYPE_CONTACT_SEARCH = CHANNEL + ".Type.ContactSearch" +CHANNEL_TYPE_CONTACT_LIST = CHANNEL + ".Type.ContactList1" +CHANNEL_TYPE_CONTACT_SEARCH = CHANNEL + ".Type.ContactSearch1" +CHANNEL_TYPE_TEXT = CHANNEL + ".Type.Text1" +CHANNEL_TYPE_STREAM_TUBE = CHANNEL + ".Type.StreamTube1" +CHANNEL_TYPE_DBUS_TUBE = CHANNEL + ".Type.DBusTube1" CHANNEL_TYPE_TEXT = CHANNEL + ".Type.Text" -CHANNEL_TYPE_TUBES = CHANNEL + ".Type.Tubes" -CHANNEL_TYPE_STREAM_TUBE = CHANNEL + ".Type.StreamTube" -CHANNEL_TYPE_DBUS_TUBE = CHANNEL + ".Type.DBusTube" -CHANNEL_TYPE_TEXT = CHANNEL + ".Type.Text" -CHANNEL_TYPE_FILE_TRANSFER = CHANNEL + ".Type.FileTransfer" -CHANNEL_TYPE_ROOM_LIST = CHANNEL + ".Type.RoomList" +CHANNEL_TYPE_FILE_TRANSFER = CHANNEL + ".Type.FileTransfer1" +CHANNEL_TYPE_ROOM_LIST = CHANNEL + ".Type.RoomList1" CHANNEL_TYPE_SERVER_AUTHENTICATION = \ - CHANNEL + ".Type.ServerAuthentication" + CHANNEL + ".Type.ServerAuthentication1" CHANNEL_TYPE_SERVER_TLS_CONNECTION = \ - CHANNEL + ".Type.ServerTLSConnection" - -TP_AWKWARD_PROPERTIES = PREFIX + ".Properties" -PROPERTY_FLAG_READ = 1 -PROPERTY_FLAG_WRITE = 2 -PROPERTY_FLAGS_RW = PROPERTY_FLAG_READ | PROPERTY_FLAG_WRITE + CHANNEL + ".Type.ServerTLSConnection1" CHANNEL_TYPE = CHANNEL + '.ChannelType' TARGET_HANDLE_TYPE = CHANNEL + '.TargetHandleType' @@ -165,28 +154,26 @@ CONTACT_LIST_STATE_FAILURE = 2 CONTACT_LIST_STATE_SUCCESS = 3 CONN = PREFIX + ".Connection" -CONN_IFACE_AVATARS = CONN + '.Interface.Avatars' -CONN_IFACE_ALIASING = CONN + '.Interface.Aliasing' -CONN_IFACE_CAPS = CONN + '.Interface.Capabilities' +CONN_IFACE_AVATARS = CONN + '.Interface.Avatars1' +CONN_IFACE_ALIASING = CONN + '.Interface.Aliasing1' CONN_IFACE_CONTACTS = CONN + '.Interface.Contacts' -CONN_IFACE_CONTACT_CAPS = CONN + '.Interface.ContactCapabilities' -CONN_IFACE_CONTACT_INFO = CONN + ".Interface.ContactInfo" -CONN_IFACE_PRESENCE = CONN + '.Interface.Presence' -CONN_IFACE_SIMPLE_PRESENCE = CONN + '.Interface.SimplePresence' +CONN_IFACE_CONTACT_CAPS = CONN + '.Interface.ContactCapabilities1' +CONN_IFACE_CONTACT_INFO = CONN + ".Interface.ContactInfo1" +CONN_IFACE_PRESENCE = CONN + '.Interface.Presence1' CONN_IFACE_REQUESTS = CONN + '.Interface.Requests' -CONN_IFACE_LOCATION = CONN + '.Interface.Location' +CONN_IFACE_LOCATION = CONN + '.Interface.Location1' CONN_IFACE_GABBLE_DECLOAK = CONN + '.Interface.Gabble.Decloak' -CONN_IFACE_MAIL_NOTIFICATION = CONN + '.Interface.MailNotification' -CONN_IFACE_CONTACT_LIST = CONN + '.Interface.ContactList' -CONN_IFACE_CONTACT_GROUPS = CONN + '.Interface.ContactGroups' -CONN_IFACE_CLIENT_TYPES = CONN + '.Interface.ClientTypes' -CONN_IFACE_POWER_SAVING = CONN + '.Interface.PowerSaving' -CONN_IFACE_CONTACT_BLOCKING = CONN + '.Interface.ContactBlocking' +CONN_IFACE_MAIL_NOTIFICATION = CONN + '.Interface.MailNotification1' +CONN_IFACE_CONTACT_LIST = CONN + '.Interface.ContactList1' +CONN_IFACE_CONTACT_GROUPS = CONN + '.Interface.ContactGroups1' +CONN_IFACE_CLIENT_TYPES = CONN + '.Interface.ClientTypes1' +CONN_IFACE_POWER_SAVING = CONN + '.Interface.PowerSaving1' +CONN_IFACE_CONTACT_BLOCKING = CONN + '.Interface.ContactBlocking1' CONN_IFACE_ADDRESSING = CONN + '.Interface.Addressing1' ATTR_CONTACT_ID = CONN + '/contact-id' ATTR_CONTACT_CAPABILITIES = CONN_IFACE_CONTACT_CAPS + '/capabilities' -ATTR_PRESENCE = CONN_IFACE_SIMPLE_PRESENCE + '/presence' +ATTR_PRESENCE = CONN_IFACE_PRESENCE + '/presence' STREAM_HANDLER = PREFIX + '.Media.StreamHandler' @@ -470,9 +457,9 @@ class SendError(object): NOT_IMPLEMENTED = 5 PROTOCOL = PREFIX + '.Protocol' -PROTOCOL_IFACE_PRESENCES = PROTOCOL + '.Interface.Presence' -PROTOCOL_IFACE_ADDRESSING = PROTOCOL + '.Interface.Addressing' -PROTOCOL_IFACE_AVATARS = PROTOCOL + '.Interface.Avatars' +PROTOCOL_IFACE_PRESENCES = PROTOCOL + '.Interface.Presence1' +PROTOCOL_IFACE_ADDRESSING = PROTOCOL + '.Interface.Addressing1' +PROTOCOL_IFACE_AVATARS = PROTOCOL + '.Interface.Avatars1' PARAM_REQUIRED = 1 PARAM_REGISTER = 2 @@ -492,9 +479,9 @@ TLS_REJECT_REASON_UNTRUSTED = 1 # Channel.Interface.Messages -MESSAGE_PART_SUPPORT_FLAGS = CHANNEL_IFACE_MESSAGES + '.MessagePartSupportFlags' -DELIVERY_REPORTING_SUPPORT = CHANNEL_IFACE_MESSAGES + '.DeliveryReportingSupport' -SUPPORTED_CONTENT_TYPES = CHANNEL_IFACE_MESSAGES + '.SupportedContentTypes' +MESSAGE_PART_SUPPORT_FLAGS = CHANNEL_TYPE_TEXT + '.MessagePartSupportFlags' +DELIVERY_REPORTING_SUPPORT = CHANNEL_TYPE_TEXT + '.DeliveryReportingSupport' +SUPPORTED_CONTENT_TYPES = CHANNEL_TYPE_TEXT + '.SupportedContentTypes' MSG_SENDING_FLAGS_REPORT_DELIVERY = 1 MSG_SENDING_FLAGS_REPORT_READ = 2 diff --git a/tests/twisted/saluttest.py b/tests/twisted/saluttest.py index fec5b1ed..0517730e 100644 --- a/tests/twisted/saluttest.py +++ b/tests/twisted/saluttest.py @@ -54,7 +54,7 @@ def make_connection(bus, event_func, params=None): default_params.update(params) return servicetest.make_connection(bus, event_func, 'salut', - 'local-xmpp', default_params) + 'local_xmpp', default_params) def ensure_avahi_is_running(): bus = dbus.SystemBus() @@ -185,31 +185,11 @@ def exec_test(fun, params=None, protocol=None, timeout=None, make_conn) reactor.run() -def wait_for_contact_list(q, conn): - """Request contact list channels and wait for their NewChannel signals. - This is useful to avoid these signals to interfere with your test.""" - - #FIXME: this maybe racy if there are other contacts connected - requestotron = dbus.Interface(conn, cs.CONN_IFACE_REQUESTS) - - # publish - requestotron.EnsureChannel({ - cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_CONTACT_LIST, - cs.TARGET_HANDLE_TYPE: cs.HT_LIST, - cs.TARGET_ID: 'publish'}) - q.expect('dbus-signal', signal='NewChannel') - # subscribe - requestotron.EnsureChannel({ - cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_CONTACT_LIST, - cs.TARGET_HANDLE_TYPE: cs.HT_LIST, - cs.TARGET_ID: 'subscribe'}) - q.expect('dbus-signal', signal='NewChannel') - def wait_for_contact_in_publish(q, bus, conn, contact_name): handle = 0 # Wait until the record shows up in publish while handle == 0: - e = q.expect('dbus-signal', signal='ContactsChangedWithID', + e = q.expect('dbus-signal', signal='ContactsChanged', path=conn.object_path) for h, state in e.args[0].items(): name = e.args[1][h] diff --git a/tests/twisted/servicetest.py b/tests/twisted/servicetest.py index bca3b13b..08c6ab9e 100644 --- a/tests/twisted/servicetest.py +++ b/tests/twisted/servicetest.py @@ -18,8 +18,8 @@ from twisted.internet import reactor import constants as cs -tp_name_prefix = 'org.freedesktop.Telepathy' -tp_path_prefix = '/org/freedesktop/Telepathy' +tp_name_prefix = 'im.telepathy1' +tp_path_prefix = '/im/telepathy1' class DictionarySupersetOf (object): """Utility class for expecting "a dictionary with at least these keys".""" @@ -419,7 +419,7 @@ def sync_dbus(bus, q, conn): assert conn.object.bus_name.startswith(':') root_object = bus.get_object(conn.object.bus_name, '/') call_async( - q, dbus.Interface(root_object, 'org.freedesktop.Telepathy.Tests'), 'DummySyncDBus') + q, dbus.Interface(root_object, 'im.telepathy1.Tests'), 'DummySyncDBus') q.expect('dbus-error', method='DummySyncDBus') class ProxyWrapper: @@ -445,7 +445,7 @@ def wrap_connection(conn): dict([ (name, tp_name_prefix + '.Connection.Interface.' + name) for name in ['Aliasing', 'Avatars', 'Capabilities', 'Contacts', - 'Presence', 'SimplePresence', 'Requests']] + + 'Presence', 'Requests']] + [('Peer', 'org.freedesktop.DBus.Peer'), ('ContactCapabilities', cs.CONN_IFACE_CONTACT_CAPS), ('ContactInfo', cs.CONN_IFACE_CONTACT_INFO), diff --git a/tests/twisted/sidecars.py b/tests/twisted/sidecars.py index 26a7b67c..137a27f8 100644 --- a/tests/twisted/sidecars.py +++ b/tests/twisted/sidecars.py @@ -9,7 +9,7 @@ from saluttest import exec_test import constants as cs from config import PLUGINS_ENABLED -TEST_PLUGIN_IFACE = "org.freedesktop.Telepathy.Salut.Plugin.Test" +TEST_PLUGIN_IFACE = "im.telepathy1.Salut.Plugin.Test" if not PLUGINS_ENABLED: print "NOTE: built without --enable-plugins, not testing plugins" diff --git a/tests/twisted/tools/Makefile.am b/tests/twisted/tools/Makefile.am index aaca6af3..bab9999f 100644 --- a/tests/twisted/tools/Makefile.am +++ b/tests/twisted/tools/Makefile.am @@ -8,12 +8,12 @@ exec-with-log.sh: exec-with-log.sh.in # We don't use the full filename for the .in because > 99 character filenames # in tarballs are non-portable (and automake 1.8 doesn't let us build # non-archaic tarballs) -org.freedesktop.Telepathy.ConnectionManager.%.service: %.service.in +im.telepathy1.ConnectionManager.%.service: %.service.in $(AM_V_GEN)sed -e "s|[@]abs_top_builddir[@]|@abs_top_builddir@|g" $< > $@ # D-Bus service file for testing service_in_files = salut.service.in -service_files = org.freedesktop.Telepathy.ConnectionManager.salut.service +service_files = im.telepathy1.ConnectionManager.salut.service # D-Bus config file for testing conf_in_files = tmp-session-bus.conf.in diff --git a/tests/twisted/tools/salut.service.in b/tests/twisted/tools/salut.service.in index 93adb71d..c517ba10 100644 --- a/tests/twisted/tools/salut.service.in +++ b/tests/twisted/tools/salut.service.in @@ -1,3 +1,3 @@ [D-BUS Service] -Name=org.freedesktop.Telepathy.ConnectionManager.salut +Name=im.telepathy1.ConnectionManager.salut Exec=@abs_top_builddir@/tests/twisted/tools/exec-with-log.sh -- cgit v1.2.1