diff options
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | src/avahi-olpc-activity-manager.c | 2 | ||||
-rw-r--r-- | src/connection-contact-info.c | 2 | ||||
-rw-r--r-- | src/connection.c | 78 | ||||
-rw-r--r-- | src/file-transfer-channel.c | 3 | ||||
-rw-r--r-- | src/ft-manager.c | 4 | ||||
-rw-r--r-- | src/im-channel.c | 17 | ||||
-rw-r--r-- | src/im-manager.c | 10 | ||||
-rw-r--r-- | src/muc-channel.c | 51 | ||||
-rw-r--r-- | src/muc-manager.c | 9 | ||||
-rw-r--r-- | src/muc-tube-dbus.c | 18 | ||||
-rw-r--r-- | src/muc-tube-stream.c | 18 | ||||
-rw-r--r-- | src/protocol.c | 7 | ||||
-rw-r--r-- | src/roomlist-channel.c | 3 | ||||
-rw-r--r-- | src/roomlist-manager.c | 2 | ||||
-rw-r--r-- | src/text-helper.c | 3 | ||||
-rw-r--r-- | src/tube-dbus.c | 17 | ||||
-rw-r--r-- | src/tube-stream.c | 17 | ||||
-rw-r--r-- | src/tubes-manager.c | 11 | ||||
-rw-r--r-- | tests/twisted/avahi/tubes/two-muc-dbus-tubes.py | 11 | ||||
-rw-r--r-- | tests/twisted/avahi/tubes/two-muc-stream-tubes.py | 11 |
21 files changed, 173 insertions, 122 deletions
diff --git a/configure.ac b/configure.ac index 8a10fc13..583e2bdf 100644 --- a/configure.ac +++ b/configure.ac @@ -198,6 +198,7 @@ PKG_CHECK_MODULES(LIBXML2, [libxml-2.0]) AC_SUBST(LIBXML2_CFLAGS) AC_SUBST(LIBXML2_LIBS) +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_20], [Ignore post 0.20 deprecations]) AC_DEFINE([TP_VERSION_MAX_ALLOWED], [TP_VERSION_0_20], [Prevent post 0.20 APIs]) diff --git a/src/avahi-olpc-activity-manager.c b/src/avahi-olpc-activity-manager.c index 304a73d2..f7ae90fd 100644 --- a/src/avahi-olpc-activity-manager.c +++ b/src/avahi-olpc-activity-manager.c @@ -155,7 +155,7 @@ browser_found (GaServiceBrowser *browser, if (flags & AVAHI_LOOKUP_RESULT_OUR_OWN) return; - if (base_conn->status == TP_CONNECTION_STATUS_DISCONNECTED) + if (tp_base_connection_is_destroyed (base_conn)) return; if (!split_activity_name (name, &room_name, &contact_name)) diff --git a/src/connection-contact-info.c b/src/connection-contact-info.c index c6dc5599..cf1f0cb6 100644 --- a/src/connection-contact-info.c +++ b/src/connection-contact-info.c @@ -201,7 +201,7 @@ salut_conn_contact_info_fill_contact_attributes ( TpHandle handle = g_array_index (contacts, TpHandle, i); GPtrArray *contact_info = NULL; - if (base->self_handle == handle) + if (tp_base_connection_get_self_handle (base) == handle) { /* TODO: dig contact info out of SalutSelf. There's overlap with * connection parameters here … should they be DBus_Property diff --git a/src/connection.c b/src/connection.c index 46860deb..395c906e 100644 --- a/src/connection.c +++ b/src/connection.c @@ -591,6 +591,7 @@ get_contact_statuses (GObject *obj, 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; @@ -611,7 +612,7 @@ get_contact_statuses (GObject *obj, (SALUT_PRESENCE_OFFLINE, NULL); const gchar *message = NULL; - if (handle == base->self_handle) + if (handle == self_handle) { ps->index = priv->self->status; message = priv->self->status_message; @@ -656,12 +657,13 @@ set_self_presence (SalutConnection *self, if (salut_self_set_presence (priv->self, presence, message, error)) { + TpHandle self_handle = tp_base_connection_get_self_handle (base); TpPresenceStatus ps = { priv->self->status, make_presence_opt_args (priv->self->status, priv->self->status_message) }; tp_presence_mixin_emit_one_presence_update ((GObject *) self, - base->self_handle, &ps); + self_handle, &ps); if (ps.optional_arguments != NULL) g_hash_table_unref (ps.optional_arguments); @@ -729,6 +731,21 @@ static const gchar *interfaces [] = { #endif NULL }; +static GPtrArray * +get_interfaces (TpBaseConnection *base) +{ + GPtrArray *arr; + const gchar **iter; + + arr = TP_BASE_CONNECTION_CLASS ( + salut_connection_parent_class)->get_interfaces_always_present (base); + + for (iter = interfaces; *iter != NULL; iter++) + g_ptr_array_add (arr, (gchar *) *iter); + + return arr; +} + const gchar * const * salut_connection_get_implemented_interfaces (void) { @@ -774,7 +791,7 @@ salut_connection_class_init (SalutConnectionClass *salut_connection_class) salut_connection_shut_down; tp_connection_class->start_connecting = salut_connection_start_connecting; - tp_connection_class->interfaces_always_present = interfaces; + tp_connection_class->get_interfaces_always_present = get_interfaces; salut_connection_class->properties_mixin.interfaces = prop_interfaces; tp_dbus_properties_mixin_class_init (object_class, @@ -1093,7 +1110,8 @@ _self_established_cb (SalutSelf *s, gpointer data) g_free (self->name); self->name = g_strdup (s->name); - base->self_handle = tp_handle_ensure (handle_repo, self->name, NULL, NULL); + tp_base_connection_set_self_handle (base, + tp_handle_ensure (handle_repo, self->name, NULL, NULL)); wocky_session_set_jid (self->session, self->name); @@ -1301,7 +1319,7 @@ salut_connection_get_alias (SalutConnection *self, TpHandle handle) TP_HANDLE_TYPE_CONTACT); const gchar *alias; - if (handle == base->self_handle) + if (handle == tp_base_connection_get_self_handle (base)) { alias = salut_self_get_alias (priv->self); } @@ -1438,7 +1456,7 @@ salut_connection_get_handle_contact_capabilities (SalutConnection *self, const GabbleCapabilitySet *set; SalutContact *contact = NULL; - if (handle == base_conn->self_handle) + if (handle == tp_base_connection_get_self_handle (base_conn)) { if (self->priv->self == NULL) return; @@ -1512,10 +1530,11 @@ salut_connection_set_aliases (TpSvcConnectionInterfaceAliasing *iface, { SalutConnection *self = SALUT_CONNECTION (iface); TpBaseConnection *base = (TpBaseConnection *) self; + TpHandle self_handle = tp_base_connection_get_self_handle (base); SalutConnectionPrivate *priv = self->priv; GError *error = NULL; const gchar *alias = g_hash_table_lookup (aliases, - GUINT_TO_POINTER (base->self_handle)); + GUINT_TO_POINTER (self_handle)); TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, context); @@ -1617,6 +1636,7 @@ salut_connection_set_avatar (TpSvcConnectionInterfaceAvatars *iface, SalutConnectionPrivate *priv = self->priv; GError *error = NULL; TpBaseConnection *base = (TpBaseConnection *) self; + TpHandle self_handle = tp_base_connection_get_self_handle (base); TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, context); @@ -1629,7 +1649,7 @@ salut_connection_set_avatar (TpSvcConnectionInterfaceAvatars *iface, } tp_svc_connection_interface_avatars_emit_avatar_updated (self, - base->self_handle, priv->self->avatar_token); + self_handle, priv->self->avatar_token); tp_svc_connection_interface_avatars_return_from_set_avatar (context, priv->self->avatar_token); } @@ -1645,6 +1665,7 @@ salut_connection_get_avatar_tokens (TpSvcConnectionInterfaceAvatars *iface, 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); @@ -1664,7 +1685,7 @@ salut_connection_get_avatar_tokens (TpSvcConnectionInterfaceAvatars *iface, for (i = 0; i < contacts->len ; i++) { TpHandle handle = g_array_index (contacts, TpHandle, i); - if (base->self_handle == handle) + if (self_handle == handle) { ret[i] = priv->self->avatar_token; } @@ -1701,6 +1722,7 @@ salut_connection_get_known_avatar_tokens ( 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); @@ -1722,7 +1744,7 @@ salut_connection_get_known_avatar_tokens ( TpHandle handle = g_array_index (contacts, TpHandle, i); gchar *tokens = NULL; - if (base->self_handle == handle) + if (self_handle == handle) { tokens = g_strdup (priv->self->avatar_token); } @@ -1759,6 +1781,7 @@ salut_connection_avatars_fill_contact_attributes (GObject *obj, guint i; SalutConnection *self = SALUT_CONNECTION (obj); TpBaseConnection *base = TP_BASE_CONNECTION (self); + TpHandle self_handle = tp_base_connection_get_self_handle (base); SalutConnectionPrivate *priv = self->priv; for (i = 0; i < contacts->len; i++) @@ -1766,7 +1789,7 @@ salut_connection_avatars_fill_contact_attributes (GObject *obj, TpHandle handle = g_array_index (contacts, TpHandle, i); gchar *token = NULL; - if (base->self_handle == handle) + if (self_handle == handle) { token = g_strdup (priv->self->avatar_token); } @@ -1829,6 +1852,7 @@ salut_connection_request_avatars ( 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); @@ -1847,7 +1871,7 @@ salut_connection_request_avatars ( { TpHandle handle = g_array_index (contacts, TpHandle, i); - if (base->self_handle == handle) + if (self_handle == handle) { GArray *arr; @@ -1859,7 +1883,7 @@ salut_connection_request_avatars ( priv->self->avatar_size); tp_svc_connection_interface_avatars_emit_avatar_retrieved ( - (GObject *) self, base->self_handle, + (GObject *) self, self_handle, priv->self->avatar_token, arr, ""); g_array_unref (arr); } @@ -1912,6 +1936,7 @@ salut_connection_request_avatar (TpSvcConnectionInterfaceAvatars *iface, 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; @@ -1928,7 +1953,7 @@ salut_connection_request_avatar (TpSvcConnectionInterfaceAvatars *iface, return; } - if (handle == base->self_handle) + if (handle == self_handle) { _request_avatar_cb (NULL, priv->self->avatar, priv->self->avatar_size, context); @@ -2239,6 +2264,8 @@ salut_connection_update_capabilities ( if ((before != NULL && !gabble_capability_set_equals (before, after)) || (before_forms != NULL && !data_forms_equal (before_forms, after_forms))) { + TpHandle self_handle = tp_base_connection_get_self_handle (base); + if (DEBUGGING) { gchar *dump = gabble_capability_set_dump (after, " "); @@ -2254,7 +2281,7 @@ salut_connection_update_capabilities ( return; } - _emit_contact_capabilities_changed (self, base->self_handle); + _emit_contact_capabilities_changed (self, self_handle); } /* after now belongs to SalutSelf, or priv->pre_connect_caps */ @@ -2459,6 +2486,7 @@ salut_connection_olpc_get_properties (SalutSvcOLPCBuddyInfo *iface, 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); GHashTable *properties = NULL; TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, context); @@ -2466,7 +2494,7 @@ salut_connection_olpc_get_properties (SalutSvcOLPCBuddyInfo *iface, if (!check_contact (base, handle, context)) return; - if (handle == base->self_handle) + if (handle == self_handle) { properties = get_properties_hash (priv->self->olpc_key, priv->self->olpc_color, priv->self->jid, NULL, NULL); @@ -2677,6 +2705,7 @@ salut_connection_olpc_get_current_activity (SalutSvcOLPCBuddyInfo *iface, { SalutConnection *self = SALUT_CONNECTION (iface); TpBaseConnection *base = (TpBaseConnection *) self; + TpHandle self_handle = tp_base_connection_get_self_handle (base); SalutConnectionPrivate *priv = self->priv; TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, context); @@ -2686,7 +2715,7 @@ salut_connection_olpc_get_current_activity (SalutSvcOLPCBuddyInfo *iface, if (!check_contact (base, handle, context)) return; - if (handle == base->self_handle) + if (handle == self_handle) { DEBUG ("Returning my own cur.act.: %s -> %u", priv->self->olpc_cur_act ? priv->self->olpc_cur_act : "", @@ -2770,6 +2799,7 @@ salut_connection_olpc_get_activities (SalutSvcOLPCBuddyInfo *iface, SalutConnection *self = SALUT_CONNECTION (iface); SalutConnectionPrivate *priv = self->priv; TpBaseConnection *base = (TpBaseConnection *) self; + TpHandle self_handle = tp_base_connection_get_self_handle (base); GPtrArray *arr; TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, context); @@ -2779,7 +2809,7 @@ salut_connection_olpc_get_activities (SalutSvcOLPCBuddyInfo *iface, if (!check_contact (base, handle, context)) return; - if (handle == base->self_handle) + if (handle == self_handle) { arr = g_ptr_array_new (); salut_self_foreach_olpc_activity (priv->self, append_activity, arr); @@ -3548,6 +3578,7 @@ muc_channel_closed_cb (SalutMucChannel *chan, SalutConnection *conn; SalutConnectionPrivate *priv; TpBaseConnection *base; + TpHandle self_handle; GPtrArray *activities = g_ptr_array_new (); g_signal_handlers_disconnect_by_func (chan, @@ -3559,11 +3590,12 @@ muc_channel_closed_cb (SalutMucChannel *chan, priv = conn->priv; base = (TpBaseConnection *) conn; + self_handle = tp_base_connection_get_self_handle (base); salut_self_remove_olpc_activity (priv->self, activity); salut_self_foreach_olpc_activity (priv->self, append_activity, activities); - salut_svc_olpc_buddy_info_emit_activities_changed (conn, base->self_handle, + salut_svc_olpc_buddy_info_emit_activities_changed (conn, self_handle, activities); free_olpc_activities (activities); @@ -3830,7 +3862,8 @@ make_sidecar_path ( TpBaseConnection *base_conn = TP_BASE_CONNECTION (conn); return g_strdelimit ( - g_strdup_printf ("%s/Sidecar/%s", base_conn->object_path, sidecar_iface), + g_strdup_printf ("%s/Sidecar/%s", + tp_base_connection_get_object_path (base_conn), sidecar_iface), ".", '/'); } @@ -3968,7 +4001,7 @@ salut_connection_ensure_sidecar ( gpointer key, value; GError *error = NULL; - if (base_conn->status == TP_CONNECTION_STATUS_DISCONNECTED) + if (tp_base_connection_is_destroyed (base_conn)) { GError e = { TP_ERROR, TP_ERROR_DISCONNECTED, "This connection has already disconnected" }; @@ -4022,7 +4055,8 @@ salut_connection_ensure_sidecar ( g_hash_table_insert (priv->pending_sidecars, g_strdup (sidecar_iface), g_list_prepend (NULL, context)); - if (base_conn->status == TP_CONNECTION_STATUS_CONNECTED) + if (tp_base_connection_get_status (base_conn) == + TP_CONNECTION_STATUS_CONNECTED) { SalutPluginLoader *loader = salut_plugin_loader_dup (); diff --git a/src/file-transfer-channel.c b/src/file-transfer-channel.c index 516a71cf..78271d63 100644 --- a/src/file-transfer-channel.c +++ b/src/file-transfer-channel.c @@ -71,8 +71,6 @@ G_DEFINE_TYPE_WITH_CODE (SalutFileTransferChannel, salut_file_transfer_channel, #define SALUT_UNDEFINED_FILE_SIZE G_MAXUINT64 -static const char *salut_file_transfer_channel_interfaces[] = { NULL }; - /* properties */ enum { @@ -532,7 +530,6 @@ salut_file_transfer_channel_class_init ( object_class->set_property = salut_file_transfer_channel_set_property; base_class->channel_type = TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER; - base_class->interfaces = salut_file_transfer_channel_interfaces; base_class->target_handle_type = TP_HANDLE_TYPE_CONTACT; base_class->close = salut_file_transfer_channel_close; base_class->fill_immutable_properties = diff --git a/src/ft-manager.c b/src/ft-manager.c index 6c98c2a7..5156eabf 100644 --- a/src/ft-manager.c +++ b/src/ft-manager.c @@ -320,7 +320,7 @@ salut_ft_manager_handle_request (TpChannelManager *manager, goto error; /* Don't support opening a channel to our self handle */ - if (handle == base_connection->self_handle) + if (handle == tp_base_connection_get_self_handle (base_connection)) { g_set_error (&error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, "Can't open a file transfer channel to yourself"); @@ -442,7 +442,7 @@ salut_ft_manager_handle_request (TpChannelManager *manager, tp_handle_inspect (contact_repo, handle)); chan = salut_file_transfer_channel_new (priv->connection, contact, - handle, base_connection->self_handle, + handle, tp_base_connection_get_self_handle (base_connection), TP_FILE_TRANSFER_STATE_PENDING, content_type, filename, size, content_hash_type, content_hash, description, date, initial_offset, file_uri, service_name, metadata); diff --git a/src/im-channel.c b/src/im-channel.c index 7001cb75..d7a409be 100644 --- a/src/im-channel.c +++ b/src/im-channel.c @@ -52,11 +52,6 @@ G_DEFINE_TYPE_WITH_CODE (SalutImChannel, salut_im_channel, TP_TYPE_BASE_CHANNEL, tp_message_mixin_messages_iface_init); ); -static const gchar *salut_im_channel_interfaces[] = { - TP_IFACE_CHANNEL_INTERFACE_MESSAGES, - NULL -}; - /* properties */ enum { @@ -229,6 +224,16 @@ 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) { @@ -246,7 +251,7 @@ 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->interfaces = salut_im_channel_interfaces; + 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/im-manager.c b/src/im-manager.c index 0cfa0cbf..ecaec174 100644 --- a/src/im-manager.c +++ b/src/im-manager.c @@ -411,7 +411,7 @@ salut_im_manager_requestotron (SalutImManager *self, } /* Don't support opening a channel to our self handle */ - if (handle == base_conn->self_handle) + if (handle == tp_base_connection_get_self_handle (base_conn)) { g_set_error (&error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, "Can't open a text channel to yourself"); @@ -422,8 +422,8 @@ salut_im_manager_requestotron (SalutImManager *self, if (channel == NULL) { - salut_im_manager_new_channel (self, handle, base_conn->self_handle, - request_token); + salut_im_manager_new_channel (self, handle, + tp_base_connection_get_self_handle (base_conn), request_token); return TRUE; } @@ -530,7 +530,6 @@ salut_im_manager_new_channel (SalutImManager *mgr, SalutImChannel *chan; SalutContact *contact; const gchar *name; - gchar *path = NULL; GSList *requests = NULL; g_assert (g_hash_table_lookup (priv->channels, GUINT_TO_POINTER (handle)) @@ -549,8 +548,6 @@ salut_im_manager_new_channel (SalutImManager *mgr, return NULL; } - path = g_strdup_printf ("%s/IMChannel/%u", - base_connection->object_path, handle); chan = g_object_new (SALUT_TYPE_IM_CHANNEL, "connection", priv->connection, "contact", contact, @@ -560,7 +557,6 @@ salut_im_manager_new_channel (SalutImManager *mgr, NULL); tp_base_channel_register ((TpBaseChannel *) chan); g_object_unref (contact); - g_free (path); g_hash_table_insert (priv->channels, GUINT_TO_POINTER (handle), chan); if (request != NULL) diff --git a/src/muc-channel.c b/src/muc-channel.c index d1736e40..091e60a2 100644 --- a/src/muc-channel.c +++ b/src/muc-channel.c @@ -64,12 +64,6 @@ G_DEFINE_TYPE_WITH_CODE(SalutMucChannel, salut_muc_channel, TP_TYPE_BASE_CHANNEL tp_message_mixin_messages_iface_init); ) -static const char *salut_muc_channel_interfaces[] = { - TP_IFACE_CHANNEL_INTERFACE_GROUP, - TP_IFACE_CHANNEL_INTERFACE_MESSAGES, - NULL -}; - /* signal enum */ enum { @@ -210,10 +204,11 @@ salut_muc_channel_add_self_to_members (SalutMucChannel *self) /* Now we are connected, move yourself to members */ empty = tp_intset_new (); add = tp_intset_new (); - tp_intset_add (add, base_conn->self_handle); + tp_intset_add (add, tp_base_connection_get_self_handle (base_conn)); tp_group_mixin_change_members (G_OBJECT (self), - "", add, empty, empty, empty, base_conn->self_handle, + "", add, empty, empty, empty, + tp_base_connection_get_self_handle (base_conn), TP_CHANNEL_GROUP_CHANGE_REASON_NONE); tp_intset_destroy (empty); @@ -306,7 +301,7 @@ salut_muc_channel_constructed (GObject *obj) G_CALLBACK (muc_connection_connected_cb), obj); tp_group_mixin_init (obj, G_STRUCT_OFFSET(SalutMucChannel, group), - contact_repo, base_conn->self_handle); + contact_repo, tp_base_connection_get_self_handle (base_conn)); tp_group_mixin_change_flags (obj, TP_CHANNEL_GROUP_FLAG_PROPERTIES | @@ -436,7 +431,7 @@ send_invite_cb (GObject *source_object, tp_intset_add (removed, handle); tp_group_mixin_change_members (G_OBJECT (data->self), "", empty, removed, empty, - empty, base_connection->self_handle, + empty, tp_base_connection_get_self_handle (base_connection), TP_CHANNEL_GROUP_CHANGE_REASON_ERROR); tp_intset_destroy (empty); @@ -504,7 +499,7 @@ salut_muc_channel_add_member (GObject *iface, TP_BASE_CHANNEL (self)); TpIntset *empty, *remote_pending; - if (handle == base_connection->self_handle) + if (handle == tp_base_connection_get_self_handle (base_connection)) { /* adding yourself, let's join the muc */ TpIntset *empty_; @@ -512,7 +507,7 @@ salut_muc_channel_add_member (GObject *iface, gboolean ret = TRUE; if (tp_handle_set_is_member (self->group.remote_pending, - base_connection->self_handle)) + tp_base_connection_get_self_handle (base_connection))) { /* Already in remote pending, no need to redo */ return TRUE; @@ -529,7 +524,7 @@ salut_muc_channel_add_member (GObject *iface, * is not connected */ tp_group_mixin_change_members (G_OBJECT (self), message, empty_, empty_, empty_, add, - base_connection->self_handle, + tp_base_connection_get_self_handle (base_connection), TP_CHANNEL_GROUP_CHANGE_REASON_NONE); } else @@ -557,7 +552,7 @@ salut_muc_channel_add_member (GObject *iface, remote_pending = tp_intset_new (); tp_intset_add (remote_pending, handle); tp_group_mixin_change_members (G_OBJECT(self), "", empty, empty, empty, - remote_pending, base_connection->self_handle, + remote_pending, tp_base_connection_get_self_handle (base_connection), TP_CHANNEL_GROUP_CHANGE_REASON_INVITED); tp_intset_destroy (empty); tp_intset_destroy (remote_pending); @@ -601,7 +596,7 @@ salut_muc_channel_remove_member_with_reason (GObject *object, TpBaseConnection *base_connection = tp_base_channel_get_connection ( TP_BASE_CHANNEL (self)); - if (handle != base_connection->self_handle) + if (handle != tp_base_connection_get_self_handle (base_connection)) { g_set_error (error, TP_ERROR, TP_ERROR_NOT_IMPLEMENTED, "Contacts cannot be kicked from Clique chatrooms"); @@ -630,6 +625,17 @@ salut_muc_channel_fill_immutable_properties (TpBaseChannel *chan, NULL); } +static GPtrArray * +salut_muc_channel_get_interfaces (TpBaseChannel *chan) +{ + GPtrArray *interfaces = TP_BASE_CHANNEL_CLASS (salut_muc_channel_parent_class) + ->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; +} + static void salut_muc_channel_class_init (SalutMucChannelClass *salut_muc_channel_class) { @@ -648,7 +654,7 @@ salut_muc_channel_class_init (SalutMucChannelClass *salut_muc_channel_class) object_class->set_property = salut_muc_channel_set_property; base_class->channel_type = TP_IFACE_CHANNEL_TYPE_TEXT; - base_class->interfaces = salut_muc_channel_interfaces; + base_class->get_interfaces = salut_muc_channel_get_interfaces; base_class->target_handle_type = TP_HANDLE_TYPE_ROOM; base_class->close = salut_muc_channel_close; base_class->fill_immutable_properties = @@ -789,6 +795,7 @@ salut_muc_channel_invited (SalutMucChannel *self, TpHandle inviter, { TpBaseConnection *base_connection = tp_base_channel_get_connection ( TP_BASE_CHANNEL (self)); + TpHandle self_handle = tp_base_connection_get_self_handle (base_connection); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (base_connection, TP_HANDLE_TYPE_CONTACT); gboolean ret = TRUE; @@ -800,17 +807,15 @@ salut_muc_channel_invited (SalutMucChannel *self, TpHandle inviter, tp_handle_inspect (contact_repo, inviter)); /* If we are already a member, no further actions are needed */ - if (tp_handle_set_is_member (self->group.members, - base_connection->self_handle)) { + if (tp_handle_set_is_member (self->group.members, self_handle)) return TRUE; - } - if (inviter == base_connection->self_handle) + if (inviter == self_handle) { /* Invited ourselves, go straight to members */ gboolean r; GArray *members = g_array_sized_new (FALSE, FALSE, sizeof (TpHandle), 1); - g_array_append_val (members, base_connection->self_handle); + g_array_append_val (members, self_handle); r = tp_group_mixin_add_members (G_OBJECT (self), members, "", error); g_assert (r); g_array_unref (members); @@ -822,7 +827,7 @@ salut_muc_channel_invited (SalutMucChannel *self, TpHandle inviter, g_assert (stanza != NULL); - tp_intset_add (local_pending, base_connection->self_handle); + tp_intset_add (local_pending, self_handle); tp_group_mixin_change_members (G_OBJECT(self), stanza, empty, empty, local_pending, empty, @@ -1315,7 +1320,7 @@ salut_muc_channel_new_senders (GibberMucConnection *connection, salut_muc_channel_add_members (self, senders); if (!tp_handle_set_is_member (self->group.members, - base_connection->self_handle)) + tp_base_connection_get_self_handle (base_connection))) { DEBUG ("Got new senders. Adding myself as member"); salut_muc_channel_add_self_to_members (self); diff --git a/src/muc-manager.c b/src/muc-manager.c index e09b65a2..41cd3438 100644 --- a/src/muc-manager.c +++ b/src/muc-manager.c @@ -587,7 +587,8 @@ salut_muc_manager_new_muc_channel (SalutMucManager *mgr, /* FIXME The name of the muc and the handle might need to be different at * some point.. E.g. if two rooms are called the same */ name = tp_handle_inspect (room_repo, handle); - path = g_strdup_printf ("%s/MucChannel/%u", base_connection->object_path, + path = g_strdup_printf ("%s/MucChannel/%u", + tp_base_connection_get_object_path (base_connection), handle); chan = SALUT_MUC_MANAGER_GET_CLASS (mgr)->create_muc_channel (mgr, @@ -691,10 +692,10 @@ salut_muc_manager_request_new_muc_channel (SalutMucManager *mgr, requested = (request_token != NULL); text_chan = salut_muc_manager_new_muc_channel (mgr, handle, - connection, base_connection->self_handle, params == NULL, - requested, announce); + connection, tp_base_connection_get_self_handle (base_connection), + (params == NULL), requested, announce); r = salut_muc_channel_invited (text_chan, - base_connection->self_handle, NULL, NULL); + tp_base_connection_get_self_handle (base_connection), NULL, NULL); /* Inviting ourselves to a connected channel should always * succeed */ g_assert (r); diff --git a/src/muc-tube-dbus.c b/src/muc-tube-dbus.c index 0fedeaf4..5d639f40 100644 --- a/src/muc-tube-dbus.c +++ b/src/muc-tube-dbus.c @@ -24,17 +24,21 @@ G_DEFINE_TYPE (SalutMucTubeDBus, salut_muc_tube_dbus, SALUT_TYPE_TUBE_DBUS) -static const gchar *salut_muc_tube_dbus_interfaces[] = { - TP_IFACE_CHANNEL_INTERFACE_GROUP, - TP_IFACE_CHANNEL_INTERFACE_TUBE, - NULL -}; - static void salut_muc_tube_dbus_init (SalutMucTubeDBus *self) { } +static GPtrArray * +salut_muc_tube_dbus_get_interfaces (TpBaseChannel *chan) +{ + GPtrArray *interfaces = TP_BASE_CHANNEL_CLASS (salut_muc_tube_dbus_parent_class) + ->get_interfaces (chan); + + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_GROUP); + return interfaces; +} + static void salut_muc_tube_dbus_class_init ( SalutMucTubeDBusClass *salut_muc_tube_dbus_class) @@ -42,6 +46,6 @@ salut_muc_tube_dbus_class_init ( TpBaseChannelClass *base_class = TP_BASE_CHANNEL_CLASS ( salut_muc_tube_dbus_class); - base_class->interfaces = salut_muc_tube_dbus_interfaces; + base_class->get_interfaces = salut_muc_tube_dbus_get_interfaces; base_class->target_handle_type = TP_HANDLE_TYPE_ROOM; } diff --git a/src/muc-tube-stream.c b/src/muc-tube-stream.c index 0833d4df..8155b9c2 100644 --- a/src/muc-tube-stream.c +++ b/src/muc-tube-stream.c @@ -24,17 +24,21 @@ G_DEFINE_TYPE (SalutMucTubeStream, salut_muc_tube_stream, SALUT_TYPE_TUBE_STREAM) -static const gchar *salut_muc_tube_stream_interfaces[] = { - TP_IFACE_CHANNEL_INTERFACE_GROUP, - TP_IFACE_CHANNEL_INTERFACE_TUBE, - NULL -}; - static void salut_muc_tube_stream_init (SalutMucTubeStream *self) { } +static GPtrArray * +salut_muc_tube_stream_get_interfaces (TpBaseChannel *chan) +{ + GPtrArray *interfaces = TP_BASE_CHANNEL_CLASS (salut_muc_tube_stream_parent_class) + ->get_interfaces (chan); + + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_GROUP); + return interfaces; +} + static void salut_muc_tube_stream_class_init ( SalutMucTubeStreamClass *salut_muc_tube_stream_class) @@ -42,6 +46,6 @@ salut_muc_tube_stream_class_init ( TpBaseChannelClass *base_class = TP_BASE_CHANNEL_CLASS ( salut_muc_tube_stream_class); - base_class->interfaces = salut_muc_tube_stream_interfaces; + base_class->get_interfaces = salut_muc_tube_stream_get_interfaces; base_class->target_handle_type = TP_HANDLE_TYPE_ROOM; } diff --git a/src/protocol.c b/src/protocol.c index 3b817402..4295451b 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -137,12 +137,6 @@ identify_account (TpBaseProtocol *self G_GNUC_UNUSED, return g_strdup (""); } -static GStrv -get_interfaces (TpBaseProtocol *self) -{ - return g_new0 (gchar *, 1); -} - static void get_connection_details (TpBaseProtocol *self, GStrv *connection_interfaces, @@ -293,7 +287,6 @@ salut_protocol_class_init (SalutProtocolClass *klass) base_class->new_connection = new_connection; base_class->normalize_contact = normalize_contact; base_class->identify_account = identify_account; - base_class->get_interfaces = get_interfaces; base_class->get_connection_details = get_connection_details; object_class->get_property = salut_protocol_get_property; diff --git a/src/roomlist-channel.c b/src/roomlist-channel.c index 6ddf9080..bdaa5c99 100644 --- a/src/roomlist-channel.c +++ b/src/roomlist-channel.c @@ -41,8 +41,6 @@ G_DEFINE_TYPE_WITH_CODE (SalutRoomlistChannel, salut_roomlist_channel, roomlist_iface_init); ); -static const char *salut_roomlist_channel_interfaces[] = { NULL }; - /* properties */ enum { @@ -130,7 +128,6 @@ salut_roomlist_channel_class_init ( object_class->finalize = salut_roomlist_channel_finalize; base_class->channel_type = TP_IFACE_CHANNEL_TYPE_ROOM_LIST; - base_class->interfaces = salut_roomlist_channel_interfaces; base_class->target_handle_type = TP_HANDLE_TYPE_NONE; base_class->fill_immutable_properties = salut_roomlist_channel_fill_immutable_properties; diff --git a/src/roomlist-manager.c b/src/roomlist-manager.c index d23629ae..1b808c74 100644 --- a/src/roomlist-manager.c +++ b/src/roomlist-manager.c @@ -351,7 +351,7 @@ make_roomlist_channel (SalutRoomlistManager *self) /* FIXME: this is not optimal as all the Connection will share the same cpt * and we could have problem if we overflow the guint. */ object_path = g_strdup_printf ("%s/RoomlistChannel%u", - conn->object_path, cpt++); + tp_base_connection_get_object_path (conn), cpt++); roomlist_channel = salut_roomlist_channel_new (priv->connection, object_path); diff --git a/src/text-helper.c b/src/text-helper.c index b9fe1b91..d9d8d4d2 100644 --- a/src/text-helper.c +++ b/src/text-helper.c @@ -313,7 +313,8 @@ text_helper_report_delivery_error (TpSvcChannel *self, NULL); delivery_echo = tp_cm_message_new (base_conn, 2); - tp_cm_message_set_sender (delivery_echo, base_conn->self_handle); + tp_cm_message_set_sender (delivery_echo, + tp_base_connection_get_self_handle (base_conn)); tp_message_set_uint32 (delivery_echo, 0, "message-type", type); tp_message_set_int64 (delivery_echo, 0, "message-sent", (gint64)timestamp); tp_message_set_string (delivery_echo, 1, "content-type", "text/plain"); diff --git a/src/tube-dbus.c b/src/tube-dbus.c index cc1763d5..0c2f0577 100644 --- a/src/tube-dbus.c +++ b/src/tube-dbus.c @@ -63,11 +63,6 @@ G_DEFINE_TYPE_WITH_CODE (SalutTubeDBus, salut_tube_dbus, TP_TYPE_BASE_CHANNEL, G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_TUBE, NULL)) -static const gchar *salut_tube_dbus_interfaces[] = { - TP_IFACE_CHANNEL_INTERFACE_TUBE, - NULL -}; - static const gchar * const salut_tube_dbus_channel_allowed_properties[] = { TP_IFACE_CHANNEL ".TargetHandle", TP_IFACE_CHANNEL ".TargetID", @@ -875,6 +870,16 @@ salut_tube_dbus_close_dbus (TpBaseChannel *base) do_close ((SalutTubeDBus *) base); } +static GPtrArray * +salut_tube_dbus_get_interfaces (TpBaseChannel *chan) +{ + GPtrArray *interfaces = TP_BASE_CHANNEL_CLASS (salut_tube_dbus_parent_class) + ->get_interfaces (chan); + + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_TUBE); + return interfaces; +} + static void salut_tube_dbus_class_init (SalutTubeDBusClass *salut_tube_dbus_class) { @@ -911,7 +916,7 @@ salut_tube_dbus_class_init (SalutTubeDBusClass *salut_tube_dbus_class) object_class->constructor = salut_tube_dbus_constructor; base_class->channel_type = TP_IFACE_CHANNEL_TYPE_DBUS_TUBE; - base_class->interfaces = salut_tube_dbus_interfaces; + base_class->get_interfaces = salut_tube_dbus_get_interfaces; base_class->target_handle_type = TP_HANDLE_TYPE_CONTACT; base_class->close = salut_tube_dbus_close_dbus; base_class->fill_immutable_properties = diff --git a/src/tube-stream.c b/src/tube-stream.c index 0320a9f8..99255576 100644 --- a/src/tube-stream.c +++ b/src/tube-stream.c @@ -77,11 +77,6 @@ G_DEFINE_TYPE_WITH_CODE (SalutTubeStream, salut_tube_stream, G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_TUBE, NULL)); -static const gchar *salut_tube_stream_interfaces[] = { - TP_IFACE_CHANNEL_INTERFACE_TUBE, - NULL -}; - static const gchar * const salut_tube_stream_channel_allowed_properties[] = { TP_IFACE_CHANNEL ".TargetHandle", TP_IFACE_CHANNEL ".TargetID", @@ -1277,6 +1272,16 @@ salut_tube_stream_close_dbus (TpBaseChannel *base) salut_tube_iface_close ((SalutTubeIface *) base, FALSE); } +static GPtrArray * +salut_tube_stream_get_interfaces (TpBaseChannel *chan) +{ + GPtrArray *interfaces = TP_BASE_CHANNEL_CLASS (salut_tube_stream_parent_class) + ->get_interfaces (chan); + + g_ptr_array_add (interfaces, TP_IFACE_CHANNEL_INTERFACE_TUBE); + return interfaces; +} + static void salut_tube_stream_class_init (SalutTubeStreamClass *salut_tube_stream_class) { @@ -1313,7 +1318,7 @@ salut_tube_stream_class_init (SalutTubeStreamClass *salut_tube_stream_class) object_class->constructor = salut_tube_stream_constructor; base_class->channel_type = TP_IFACE_CHANNEL_TYPE_STREAM_TUBE; - base_class->interfaces = salut_tube_stream_interfaces; + base_class->get_interfaces = salut_tube_stream_get_interfaces; base_class->target_handle_type = TP_HANDLE_TYPE_CONTACT; base_class->close = salut_tube_stream_close_dbus; base_class->fill_immutable_properties = diff --git a/src/tubes-manager.c b/src/tubes-manager.c index 2622e34b..998296cc 100644 --- a/src/tubes-manager.c +++ b/src/tubes-manager.c @@ -717,20 +717,21 @@ create_new_tube (SalutTubesManager *self, SalutTubesManagerPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE (self, SALUT_TYPE_TUBES_MANAGER, SalutTubesManagerPrivate); TpBaseConnection *base_conn = TP_BASE_CONNECTION (priv->conn); + TpHandle self_handle = tp_base_connection_get_self_handle (base_conn); SalutTubeIface *tube; if (type == TP_TUBE_TYPE_STREAM) { tube = SALUT_TUBE_IFACE (salut_tube_stream_new (priv->conn, handle, TP_HANDLE_TYPE_CONTACT, - base_conn->self_handle, base_conn->self_handle, FALSE, service, + self_handle, self_handle, FALSE, service, parameters, tube_id, portnum, iq_req, TRUE)); } else if (type == TP_TUBE_TYPE_DBUS) { tube = SALUT_TUBE_IFACE (salut_tube_dbus_new (priv->conn, - handle, TP_HANDLE_TYPE_CONTACT, base_conn->self_handle, NULL, - base_conn->self_handle, service, parameters, tube_id, TRUE)); + handle, TP_HANDLE_TYPE_CONTACT, self_handle, NULL, + self_handle, service, parameters, tube_id, TRUE)); } else { @@ -890,7 +891,7 @@ salut_tubes_manager_requestotron (SalutTubesManager *self, goto error; /* Don't support opening a channel to our self handle */ - if (handle == base_conn->self_handle) + if (handle == tp_base_connection_get_self_handle (base_conn)) { g_set_error (&error, TP_ERROR, TP_ERROR_NOT_AVAILABLE, "Can't open a channel to your self handle"); @@ -1160,7 +1161,7 @@ salut_tubes_manager_get_contact_caps_from_set ( GetContactCapsClosure closure = { FALSE, arr, handle }; /* Always claim that we support tubes. */ - closure.supports_tubes = (handle == base->self_handle); + closure.supports_tubes = (handle == tp_base_connection_get_self_handle (base)); gabble_capability_set_foreach (caps, get_contact_caps_foreach, &closure); diff --git a/tests/twisted/avahi/tubes/two-muc-dbus-tubes.py b/tests/twisted/avahi/tubes/two-muc-dbus-tubes.py index c34a8e2e..c47026cc 100644 --- a/tests/twisted/avahi/tubes/two-muc-dbus-tubes.py +++ b/tests/twisted/avahi/tubes/two-muc-dbus-tubes.py @@ -2,7 +2,8 @@ from saluttest import exec_test import dbus from dbus.service import method, signal, Object -from servicetest import wrap_channel, call_async, EventPattern, Event +from servicetest import (wrap_channel, call_async, EventPattern, Event, + assertSameSets) import constants as cs import tubetestutil as t @@ -81,8 +82,8 @@ def test(q, bus, conn): assert props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_DBUS_TUBE assert props[cs.REQUESTED] == True - assert props[cs.INTERFACES] == [cs.CHANNEL_IFACE_GROUP, - cs.CHANNEL_IFACE_TUBE] + assertSameSets([cs.CHANNEL_IFACE_GROUP, cs.CHANNEL_IFACE_TUBE], + props[cs.INTERFACES]) assert props[cs.DBUS_TUBE_SERVICE_NAME] == 'com.example.TestCase' assert props[cs.DBUS_TUBE_SUPPORTED_ACCESS_CONTROLS] == [ cs.SOCKET_ACCESS_CONTROL_CREDENTIALS, cs.SOCKET_ACCESS_CONTROL_LOCALHOST] @@ -128,8 +129,8 @@ def test(q, bus, conn): assert props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_DBUS_TUBE assert props[cs.REQUESTED] == False - assert props[cs.INTERFACES] == [cs.CHANNEL_IFACE_GROUP, - cs.CHANNEL_IFACE_TUBE] + assertSameSets([cs.CHANNEL_IFACE_GROUP, cs.CHANNEL_IFACE_TUBE], + props[cs.INTERFACES]) assert props[cs.TUBE_PARAMETERS] == sample_parameters assert props[cs.DBUS_TUBE_SERVICE_NAME] == 'com.example.TestCase' assert props[cs.DBUS_TUBE_SUPPORTED_ACCESS_CONTROLS] == [ diff --git a/tests/twisted/avahi/tubes/two-muc-stream-tubes.py b/tests/twisted/avahi/tubes/two-muc-stream-tubes.py index 82696335..71dfcd52 100644 --- a/tests/twisted/avahi/tubes/two-muc-stream-tubes.py +++ b/tests/twisted/avahi/tubes/two-muc-stream-tubes.py @@ -5,7 +5,8 @@ import errno import string import tempfile -from servicetest import wrap_channel, Event, call_async, EventPattern +from servicetest import (wrap_channel, Event, call_async, EventPattern, + assertSameSets) from twisted.internet.protocol import Factory, Protocol, ClientCreator from twisted.internet import reactor @@ -91,8 +92,8 @@ def test(q, bus, conn): path, props = channels[0] assert props[CHANNEL_TYPE] == CHANNEL_TYPE_STREAM_TUBE assert props[REQUESTED] == True - assert props[INTERFACES] == [CHANNEL_IFACE_GROUP, - CHANNEL_IFACE_TUBE] + assertSameSets([CHANNEL_IFACE_GROUP, CHANNEL_IFACE_TUBE], + props[INTERFACES]) assert props[STREAM_TUBE_SERVICE] == 'test' assert props[INITIATOR_HANDLE] == conn1_self_handle assert props[INITIATOR_ID] == contact1_name @@ -139,8 +140,8 @@ def test(q, bus, conn): path, props = channels[0] assert props[REQUESTED] == False - assert props[INTERFACES] == [CHANNEL_IFACE_GROUP, - CHANNEL_IFACE_TUBE] + assertSameSets([CHANNEL_IFACE_GROUP, CHANNEL_IFACE_TUBE], + props[INTERFACES]) assert props[STREAM_TUBE_SERVICE] == 'test' assert props[TUBE_PARAMETERS] == sample_parameters |