From ae86c959db1d9a2b66433e0c3cb020914f01421a Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Mon, 7 May 2012 21:40:40 +0200 Subject: [PATCH] TpChannel: rename a few Group APIs: TP_CHANNEL_FEATURE_CONTACTS -> TP_CHANNEL_FEATURE_GROUP tp_channel_group_dup_members_contacts -> tp_channel_group_dup_members tp_channel_group_dup_local_pending_contacts -> tp_channel_group_dup_local_pending tp_channel_group_get_local_pending_contact_info -> tp_channel_group_get_local_pending_info tp_channel_group_dup_remote_pending_contacts -> tp_channel_group_dup_remote_pending "group-contacts-changed" -> "group-members-changed" https://bugs.freedesktop.org/show_bug.cgi?id=49371 --- docs/reference/telepathy-glib-sections.txt | 10 +-- examples/client/inspect-channel.c | 2 +- telepathy-glib/channel-contacts.c | 110 ++++++++++++++-------------- telepathy-glib/channel-internal.h | 10 +-- telepathy-glib/channel.c | 68 +++++++++-------- telepathy-glib/channel.h | 14 ++-- tests/dbus/call-channel.c | 3 - tests/dbus/channel-introspect.c | 4 +- tests/dbus/channel.c | 12 +-- tests/dbus/cli-group.c | 14 ++-- tests/dbus/group-mixin.c | 4 +- tests/lib/util.c | 2 +- 12 files changed, 128 insertions(+), 125 deletions(-) diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt index abd0c90..bd5197c 100644 --- a/docs/reference/telepathy-glib-sections.txt +++ b/docs/reference/telepathy-glib-sections.txt @@ -3019,13 +3019,13 @@ tp_channel_get_feature_quark_password TP_CHANNEL_FEATURE_CHAT_STATES tp_channel_get_chat_state -TP_CHANNEL_FEATURE_CONTACTS +TP_CHANNEL_FEATURE_GROUP tp_channel_group_get_flags tp_channel_group_get_self_contact -tp_channel_group_dup_members_contacts -tp_channel_group_dup_local_pending_contacts -tp_channel_group_get_local_pending_contact_info -tp_channel_group_dup_remote_pending_contacts +tp_channel_group_dup_members +tp_channel_group_dup_local_pending +tp_channel_group_get_local_pending_info +tp_channel_group_dup_remote_pending tp_channel_group_get_contact_owner TP_ERRORS_REMOVED_FROM_GROUP diff --git a/examples/client/inspect-channel.c b/examples/client/inspect-channel.c index 9702b05..fc43850 100644 --- a/examples/client/inspect-channel.c +++ b/examples/client/inspect-channel.c @@ -65,7 +65,7 @@ channel_ready_cb (GObject *source, if (tp_proxy_has_interface_by_id (channel, TP_IFACE_QUARK_CHANNEL_INTERFACE_GROUP)) { - GPtrArray *members = tp_channel_group_dup_members_contacts (channel); + GPtrArray *members = tp_channel_group_dup_members (channel); guint i; printf ("Group members:\n"); diff --git a/telepathy-glib/channel-contacts.c b/telepathy-glib/channel-contacts.c index 166e49d..193046f 100644 --- a/telepathy-glib/channel-contacts.c +++ b/telepathy-glib/channel-contacts.c @@ -484,7 +484,7 @@ set_local_pending_info (TpChannel *self, reason == TP_CHANNEL_GROUP_CHANGE_REASON_NONE) { /* we just don't bother storing informationless local-pending */ - g_hash_table_remove (self->priv->group_local_pending_contact_info, + g_hash_table_remove (self->priv->group_local_pending_info, GUINT_TO_POINTER (tp_contact_get_handle (contact))); return; } @@ -494,7 +494,7 @@ set_local_pending_info (TpChannel *self, info->reason = reason; info->message = g_strdup (message); - g_hash_table_insert (self->priv->group_local_pending_contact_info, + g_hash_table_insert (self->priv->group_local_pending_info, GUINT_TO_POINTER (tp_contact_get_handle (contact)), info); } @@ -636,11 +636,11 @@ members_changed_prepared_cb (GObject *object, TpContact *contact = g_ptr_array_index (data->added, i); gpointer key = GUINT_TO_POINTER (tp_contact_get_handle (contact)); - g_hash_table_insert (self->priv->group_members_contacts, key, + g_hash_table_insert (self->priv->group_members, key, g_object_ref (contact)); - g_hash_table_remove (self->priv->group_local_pending_contacts, key); - g_hash_table_remove (self->priv->group_local_pending_contact_info, key); - g_hash_table_remove (self->priv->group_remote_pending_contacts, key); + g_hash_table_remove (self->priv->group_local_pending, key); + g_hash_table_remove (self->priv->group_local_pending_info, key); + g_hash_table_remove (self->priv->group_remote_pending, key); } for (i = 0; i < data->local_pending->len; i++) @@ -648,10 +648,10 @@ members_changed_prepared_cb (GObject *object, TpContact *contact = g_ptr_array_index (data->local_pending, i); gpointer key = GUINT_TO_POINTER (tp_contact_get_handle (contact)); - g_hash_table_remove (self->priv->group_members_contacts, key); - g_hash_table_insert (self->priv->group_local_pending_contacts, key, + g_hash_table_remove (self->priv->group_members, key); + g_hash_table_insert (self->priv->group_local_pending, key, g_object_ref (contact)); - g_hash_table_remove (self->priv->group_remote_pending_contacts, key); + g_hash_table_remove (self->priv->group_remote_pending, key); /* Special-case renaming a local-pending contact, if the * signal is spec-compliant. Keep the old actor/reason/message in @@ -664,7 +664,7 @@ members_changed_prepared_cb (GObject *object, { TpHandle old = g_array_index (data->removed, TpHandle, 0); LocalPendingInfo *info = g_hash_table_lookup ( - self->priv->group_local_pending_contact_info, + self->priv->group_local_pending_info, GUINT_TO_POINTER (old)); if (info != NULL) @@ -684,10 +684,10 @@ members_changed_prepared_cb (GObject *object, TpContact *contact = g_ptr_array_index (data->remote_pending, i); gpointer key = GUINT_TO_POINTER (tp_contact_get_handle (contact)); - g_hash_table_remove (self->priv->group_members_contacts, key); - g_hash_table_remove (self->priv->group_local_pending_contacts, key); - g_hash_table_remove (self->priv->group_local_pending_contact_info, key); - g_hash_table_insert (self->priv->group_remote_pending_contacts, key, + g_hash_table_remove (self->priv->group_members, key); + g_hash_table_remove (self->priv->group_local_pending, key); + g_hash_table_remove (self->priv->group_local_pending_info, key); + g_hash_table_insert (self->priv->group_remote_pending, key, g_object_ref (contact)); } @@ -701,13 +701,13 @@ members_changed_prepared_cb (GObject *object, gpointer key = GUINT_TO_POINTER (handle); TpContact *contact; - contact = g_hash_table_lookup (self->priv->group_members_contacts, key); + contact = g_hash_table_lookup (self->priv->group_members, key); if (contact == NULL) contact = g_hash_table_lookup ( - self->priv->group_local_pending_contacts, key); + self->priv->group_local_pending, key); if (contact == NULL) contact = g_hash_table_lookup ( - self->priv->group_remote_pending_contacts, key); + self->priv->group_remote_pending, key); if (contact == NULL) { @@ -718,10 +718,10 @@ members_changed_prepared_cb (GObject *object, g_ptr_array_add (removed, g_object_ref (contact)); - g_hash_table_remove (self->priv->group_members_contacts, key); - g_hash_table_remove (self->priv->group_local_pending_contacts, key); - g_hash_table_remove (self->priv->group_local_pending_contact_info, key); - g_hash_table_remove (self->priv->group_remote_pending_contacts, key); + g_hash_table_remove (self->priv->group_members, key); + g_hash_table_remove (self->priv->group_local_pending, key); + g_hash_table_remove (self->priv->group_local_pending_info, key); + g_hash_table_remove (self->priv->group_remote_pending, key); if (contact == self->priv->group_self_contact || contact == tp_connection_get_self_contact (self->priv->connection)) @@ -775,7 +775,7 @@ members_changed_prepared_cb (GObject *object, } } - g_signal_emit_by_name (self, "group-contacts-changed", data->added, + g_signal_emit_by_name (self, "group-members-changed", data->added, removed, data->local_pending, data->remote_pending, data->actor, data->details); @@ -1010,10 +1010,10 @@ set_local_pending (TpChannel *self, { guint i; - self->priv->group_local_pending_contacts = g_hash_table_new_full ( - NULL, NULL, NULL, g_object_unref); - self->priv->group_local_pending_contact_info = g_hash_table_new_full ( - NULL, NULL, NULL, (GDestroyNotify) local_pending_info_free); + self->priv->group_local_pending = g_hash_table_new_full (NULL, NULL, + NULL, g_object_unref); + self->priv->group_local_pending_info = g_hash_table_new_full (NULL, NULL, + NULL, (GDestroyNotify) local_pending_info_free); if (info == NULL) return; @@ -1034,7 +1034,7 @@ set_local_pending (TpChannel *self, if (contact == NULL) continue; - g_hash_table_insert (self->priv->group_local_pending_contacts, + g_hash_table_insert (self->priv->group_local_pending, GUINT_TO_POINTER (handle), contact); actor_contact = dup_contact (self, actor, identifiers); @@ -1082,7 +1082,7 @@ got_group_properties_cb (TpProxy *proxy, tp_asv_get_uint32 (asv, "SelfHandle", NULL), identifiers); - self->priv->group_members_contacts = dup_contacts_table (self, + self->priv->group_members = dup_contacts_table (self, tp_asv_get_boxed (asv, "Members", au_type), identifiers); @@ -1091,7 +1091,7 @@ got_group_properties_cb (TpProxy *proxy, TP_ARRAY_TYPE_LOCAL_PENDING_INFO_LIST), identifiers); - self->priv->group_remote_pending_contacts = dup_contacts_table (self, + self->priv->group_remote_pending = dup_contacts_table (self, tp_asv_get_boxed (asv, "RemotePendingMembers", au_type), identifiers); @@ -1105,12 +1105,12 @@ got_group_properties_cb (TpProxy *proxy, if (self->priv->group_self_contact != NULL) g_ptr_array_add (contacts, self->priv->group_self_contact); - append_contacts (contacts, self->priv->group_members_contacts); - append_contacts (contacts, self->priv->group_local_pending_contacts); - append_contacts (contacts, self->priv->group_remote_pending_contacts); + append_contacts (contacts, self->priv->group_members); + append_contacts (contacts, self->priv->group_local_pending); + append_contacts (contacts, self->priv->group_remote_pending); append_contacts (contacts, self->priv->group_contact_owners); - g_hash_table_iter_init (&iter, self->priv->group_local_pending_contact_info); + g_hash_table_iter_init (&iter, self->priv->group_local_pending_info); while (g_hash_table_iter_next (&iter, NULL, &value)) { LocalPendingInfo *info = value; @@ -1126,7 +1126,7 @@ got_group_properties_cb (TpProxy *proxy, } void -_tp_channel_contacts_prepare_async (TpProxy *proxy, +_tp_channel_group_prepare_async (TpProxy *proxy, const TpProxyFeature *feature, GAsyncReadyCallback callback, gpointer user_data) @@ -1161,7 +1161,7 @@ _tp_channel_contacts_prepare_async (TpProxy *proxy, g_assert_no_error (error); result = g_simple_async_result_new ((GObject *) self, callback, user_data, - _tp_channel_contacts_prepare_async); + _tp_channel_group_prepare_async); tp_cli_dbus_properties_call_get_all (self, -1, TP_IFACE_CHANNEL_INTERFACE_GROUP, got_group_properties_cb, @@ -1203,13 +1203,13 @@ tp_channel_group_get_self_contact (TpChannel *self) } /** - * tp_channel_group_dup_members_contacts: + * tp_channel_group_dup_members: * @self: a channel * - * If @self is a group and the %TP_CHANNEL_FEATURE_CONTACTS feature has been + * If @self is a group and the %TP_CHANNEL_FEATURE_GROUP feature has been * prepared, return a #GPtrArray containing its members. * - * If @self is a group but %TP_CHANNEL_FEATURE_CONTACTS has not been prepared, + * If @self is a group but %TP_CHANNEL_FEATURE_GROUP has not been prepared, * the result may either be a set of members, or %NULL. * * If @self is not a group, return %NULL. @@ -1220,21 +1220,21 @@ tp_channel_group_get_self_contact (TpChannel *self) * Since: 0.15.6 */ GPtrArray * -tp_channel_group_dup_members_contacts (TpChannel *self) +tp_channel_group_dup_members (TpChannel *self) { g_return_val_if_fail (TP_IS_CHANNEL (self), NULL); - return _tp_contacts_from_values (self->priv->group_members_contacts); + return _tp_contacts_from_values (self->priv->group_members); } /** - * tp_channel_group_dup_local_pending_contacts: + * tp_channel_group_dup_local_pending: * @self: a channel * - * If @self is a group and the %TP_CHANNEL_FEATURE_CONTACTS feature has been + * If @self is a group and the %TP_CHANNEL_FEATURE_GROUP feature has been * prepared, return a #GPtrArray containing its local-pending members. * - * If @self is a group but %TP_CHANNEL_FEATURE_CONTACTS has not been prepared, + * If @self is a group but %TP_CHANNEL_FEATURE_GROUP has not been prepared, * the result may either be a set of local-pending members, or %NULL. * * If @self is not a group, return %NULL. @@ -1245,21 +1245,21 @@ tp_channel_group_dup_members_contacts (TpChannel *self) * Since: 0.15.6 */ GPtrArray * -tp_channel_group_dup_local_pending_contacts (TpChannel *self) +tp_channel_group_dup_local_pending (TpChannel *self) { g_return_val_if_fail (TP_IS_CHANNEL (self), NULL); - return _tp_contacts_from_values (self->priv->group_local_pending_contacts); + return _tp_contacts_from_values (self->priv->group_local_pending); } /** - * tp_channel_group_dup_remote_pending_contacts: + * tp_channel_group_dup_remote_pending: * @self: a channel * - * If @self is a group and the %TP_CHANNEL_FEATURE_CONTACTS feature has been + * If @self is a group and the %TP_CHANNEL_FEATURE_GROUP feature has been * prepared, return a #GPtrArray containing its remote-pending members. * - * If @self is a group but %TP_CHANNEL_FEATURE_CONTACTS has not been prepared, + * If @self is a group but %TP_CHANNEL_FEATURE_GROUP has not been prepared, * the result may either be a set of remote-pending members, or %NULL. * * If @self is not a group, return %NULL. @@ -1270,15 +1270,15 @@ tp_channel_group_dup_local_pending_contacts (TpChannel *self) * Since: 0.15.6 */ GPtrArray * -tp_channel_group_dup_remote_pending_contacts (TpChannel *self) +tp_channel_group_dup_remote_pending (TpChannel *self) { g_return_val_if_fail (TP_IS_CHANNEL (self), NULL); - return _tp_contacts_from_values (self->priv->group_remote_pending_contacts); + return _tp_contacts_from_values (self->priv->group_remote_pending); } /** - * tp_channel_group_get_local_pending_contact_info: + * tp_channel_group_get_local_pending_info: * @self: a channel * @local_pending: the #TpContact of a local-pending contact about whom more * information is needed @@ -1302,7 +1302,7 @@ tp_channel_group_dup_remote_pending_contacts (TpChannel *self) * Since: 0.15.6 */ gboolean -tp_channel_group_get_local_pending_contact_info (TpChannel *self, +tp_channel_group_get_local_pending_info (TpChannel *self, TpContact *local_pending, TpContact **actor, TpChannelGroupChangeReason *reason, @@ -1323,14 +1323,14 @@ tp_channel_group_get_local_pending_contact_info (TpChannel *self, gpointer key = GUINT_TO_POINTER (tp_contact_get_handle (local_pending)); /* it could conceivably be someone who is local-pending */ - ret = g_hash_table_contains (self->priv->group_local_pending_contacts, + ret = g_hash_table_contains (self->priv->group_local_pending, key); if (ret) { /* we might even have information about them */ LocalPendingInfo *info = g_hash_table_lookup ( - self->priv->group_local_pending_contact_info, key); + self->priv->group_local_pending_info, key); if (info != NULL) { @@ -1365,7 +1365,7 @@ tp_channel_group_get_local_pending_contact_info (TpChannel *self, * * - if @self is not a group or @contact is not a member of this channel, * result is undefined; - * - if %TP_CHANNEL_FEATURE_CONTACTS has not yet been prepared, result is + * - if %TP_CHANNEL_FEATURE_GROUP has not yet been prepared, result is * undefined; * - if @self does not have flags that include * %TP_CHANNEL_GROUP_FLAG_PROPERTIES, diff --git a/telepathy-glib/channel-internal.h b/telepathy-glib/channel-internal.h index 21f59c0..e2eb57a 100644 --- a/telepathy-glib/channel-internal.h +++ b/telepathy-glib/channel-internal.h @@ -62,13 +62,13 @@ struct _TpChannelPrivate { TpContact *initiator_contact; TpContact *group_self_contact; /* TpHandle -> reffed TpContact */ - GHashTable *group_members_contacts; - GHashTable *group_local_pending_contacts; - GHashTable *group_remote_pending_contacts; + GHashTable *group_members; + GHashTable *group_local_pending; + GHashTable *group_remote_pending; /* TpHandle -> reffed TpContact or NULL */ GHashTable *group_contact_owners; /* TpHandle -> LocalPendingInfo */ - GHashTable *group_local_pending_contact_info; + GHashTable *group_local_pending_info; gboolean group_properties_retrieved; /* Queue of GSimpleAsyncResult with ContactsQueueItem payload */ @@ -100,7 +100,7 @@ void _tp_channel_abort_introspection (TpChannel *self, /* channel-contacts.c internals */ -void _tp_channel_contacts_prepare_async (TpProxy *proxy, +void _tp_channel_group_prepare_async (TpProxy *proxy, const TpProxyFeature *feature, GAsyncReadyCallback callback, gpointer user_data); diff --git a/telepathy-glib/channel.c b/telepathy-glib/channel.c index 58da73d..1a33999 100644 --- a/telepathy-glib/channel.c +++ b/telepathy-glib/channel.c @@ -103,7 +103,7 @@ enum enum { SIGNAL_GROUP_FLAGS_CHANGED, - SIGNAL_GROUP_CONTACTS_CHANGED, + SIGNAL_GROUP_MEMBERS_CHANGED, SIGNAL_CHAT_STATE_CHANGED, N_SIGNALS }; @@ -145,27 +145,33 @@ tp_channel_get_feature_quark_core (void) } /** - * TP_CHANNEL_FEATURE_CONTACTS: + * TP_CHANNEL_FEATURE_GROUP: * * Expands to a call to a function that returns a quark representing the - * Contacts features of a TpChannel. + * group features of a TpChannel. * - * When this feature is prepared, the #TpContact objects of this channel are - * guaranteed to have all of the features previously passed to - * tp_client_factory_add_contact_features() prepared. + * When this feature is prepared, the Group properties of the + * Channel have been retrieved and are available for use, and + * change-notification has been set up for those that can change: * - * On older connection managers, this feature may fail to prepare. + * - the initial value of the #TpChannel:group-self-handle property will + * have been fetched and change notification will have been set up + * - the initial value of the #TpChannel:group-flags property will + * have been fetched and change notification will have been set up + * + * All #TpContact objects are guaranteed to have all of the features previously + * passed to tp_client_factory_add_contact_features() prepared. * * One can ask for a feature to be prepared using the * tp_proxy_prepare_async() function, and waiting for it to callback. * - * Since: 0.15.6 + * Since: 0.UNRELEASED */ GQuark -tp_channel_get_feature_quark_contacts (void) +tp_channel_get_feature_quark_group (void) { - return g_quark_from_static_string ("tp-channel-feature-contacts"); + return g_quark_from_static_string ("tp-channel-feature-group"); } /** @@ -1099,13 +1105,13 @@ tp_channel_dispose (GObject *object) g_clear_object (&self->priv->target_contact); g_clear_object (&self->priv->initiator_contact); g_clear_object (&self->priv->group_self_contact); - tp_clear_pointer (&self->priv->group_members_contacts, + tp_clear_pointer (&self->priv->group_members, g_hash_table_unref); - tp_clear_pointer (&self->priv->group_local_pending_contacts, + tp_clear_pointer (&self->priv->group_local_pending, g_hash_table_unref); - tp_clear_pointer (&self->priv->group_local_pending_contact_info, + tp_clear_pointer (&self->priv->group_local_pending_info, g_hash_table_unref); - tp_clear_pointer (&self->priv->group_remote_pending_contacts, + tp_clear_pointer (&self->priv->group_remote_pending, g_hash_table_unref); tp_clear_pointer (&self->priv->group_contact_owners, g_hash_table_unref); @@ -1201,7 +1207,7 @@ tp_channel_prepare_password_async (TpProxy *proxy, enum { FEAT_CORE, - FEAT_CONTACTS, + FEAT_GROUP, FEAT_CHAT_STATES, FEAT_PASSWORD, N_FEAT @@ -1220,9 +1226,9 @@ tp_channel_list_features (TpProxyClass *cls G_GNUC_UNUSED) features[FEAT_CORE].name = TP_CHANNEL_FEATURE_CORE; features[FEAT_CORE].core = TRUE; - features[FEAT_CONTACTS].name = TP_CHANNEL_FEATURE_CONTACTS; - features[FEAT_CONTACTS].prepare_async = - _tp_channel_contacts_prepare_async; + features[FEAT_GROUP].name = TP_CHANNEL_FEATURE_GROUP; + features[FEAT_GROUP].prepare_async = + _tp_channel_group_prepare_async; features[FEAT_CHAT_STATES].name = TP_CHANNEL_FEATURE_CHAT_STATES; features[FEAT_CHAT_STATES].prepare_async = @@ -1331,7 +1337,7 @@ tp_channel_class_init (TpChannelClass *klass) /** * TpChannel:group-flags: * - * If the %TP_CHANNEL_FEATURE_CONTACTS feature has been prepared successfully, + * If the %TP_CHANNEL_FEATURE_GROUP feature has been prepared successfully, * #TpChannelGroupFlags indicating the capabilities and behaviour of that * group. * @@ -1492,7 +1498,7 @@ tp_channel_class_init (TpChannelClass *klass) /** * TpChannel:group-self-contact: * - * If this channel is a group and %TP_CHANNEL_FEATURE_CONTACTS has been + * If this channel is a group and %TP_CHANNEL_FEATURE_GROUP has been * prepared, and the user is a member of the group, the #TpContact * representing them in this group. * @@ -1501,7 +1507,7 @@ tp_channel_class_init (TpChannelClass *klass) * * Change notification is via notify::group-self-contact. * - * Since: 0.15.6 + * Since: 0.UNRELEASED */ param_spec = g_param_spec_object ("group-self-contact", "Group.SelfHandle", "Undefined if not a group", TP_TYPE_CONTACT, @@ -1510,7 +1516,7 @@ tp_channel_class_init (TpChannelClass *klass) param_spec); /** - * TpChannel::group-contacts-changed: + * TpChannel::group-members-changed: * @self: a channel * @added: (type GLib.PtrArray) (element-type TelepathyGLib.Contact): * a #GPtrArray of #TpContact containing the full members added @@ -1530,13 +1536,13 @@ tp_channel_class_init (TpChannelClass *klass) * Emitted when the group members change in a Group channel. * * This is not guaranteed to be emitted until tp_proxy_prepare_async() has - * finished preparing %TP_CHANNEL_FEATURE_CONTACTS; until then, it may be + * finished preparing %TP_CHANNEL_FEATURE_GROUP; until then, it may be * omitted. * - * Since: 0.15.6 + * Since: 0.UNRELEASED */ - signals[SIGNAL_GROUP_CONTACTS_CHANGED] = g_signal_new ( - "group-contacts-changed", G_OBJECT_CLASS_TYPE (klass), + signals[SIGNAL_GROUP_MEMBERS_CHANGED] = g_signal_new ( + "group-members-changed", G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, NULL, @@ -1767,7 +1773,7 @@ channel_join_cb (TpChannel *self, * You can then call tp_channel_join_finish() to get the result of * the operation. * - * %TP_CHANNEL_FEATURE_CONTACTS feature must be prepared before calling this + * %TP_CHANNEL_FEATURE_GROUP feature must be prepared before calling this * function. * * Since: 0.UNRELEASED @@ -1783,7 +1789,7 @@ tp_channel_join_async (TpChannel *self, GArray *array; g_return_if_fail (TP_IS_CHANNEL (self)); - g_return_if_fail (tp_proxy_is_prepared (self, TP_CHANNEL_FEATURE_CONTACTS)); + g_return_if_fail (tp_proxy_is_prepared (self, TP_CHANNEL_FEATURE_GROUP)); result = g_simple_async_result_new (G_OBJECT (self), callback, user_data, tp_channel_join_async); @@ -1878,7 +1884,7 @@ channel_remove_self_cb (TpChannel *channel, * @user_data: data to pass to @callback * * Leave channel @self with @reason as reason and @message as leave message. - * If %TP_CHANNEL_FEATURE_CONTACTS feature is not prepared, we close it. + * If %TP_CHANNEL_FEATURE_GROUP feature is not prepared, we close it. * * When we left the channel, @callback will be called. * You can then call tp_channel_leave_finish() to get the result of @@ -1902,9 +1908,9 @@ tp_channel_leave_async (TpChannel *self, result = g_simple_async_result_new (G_OBJECT (self), callback, user_data, tp_channel_leave_async); - if (!tp_proxy_is_prepared (self, TP_CHANNEL_FEATURE_CONTACTS)) + if (!tp_proxy_is_prepared (self, TP_CHANNEL_FEATURE_GROUP)) { - DEBUG ("TP_CHANNEL_FEATURE_CONTACTS is not prepared; " + DEBUG ("TP_CHANNEL_FEATURE_GROUP is not prepared; " "fallback to Close()"); tp_cli_channel_call_close (self, -1, channel_close_cb, result, diff --git a/telepathy-glib/channel.h b/telepathy-glib/channel.h index 788f27d..f261baa 100644 --- a/telepathy-glib/channel.h +++ b/telepathy-glib/channel.h @@ -132,23 +132,23 @@ TpContact *tp_channel_get_target_contact (TpChannel *self); _TP_AVAILABLE_IN_0_16 TpContact *tp_channel_get_initiator_contact (TpChannel *self); -#define TP_CHANNEL_FEATURE_CONTACTS \ - tp_channel_get_feature_quark_contacts () +#define TP_CHANNEL_FEATURE_GROUP \ + tp_channel_get_feature_quark_group () _TP_AVAILABLE_IN_0_16 -GQuark tp_channel_get_feature_quark_contacts (void) G_GNUC_CONST; +GQuark tp_channel_get_feature_quark_group (void) G_GNUC_CONST; TpChannelGroupFlags tp_channel_group_get_flags (TpChannel *self); _TP_AVAILABLE_IN_0_16 TpContact *tp_channel_group_get_self_contact (TpChannel *self); _TP_AVAILABLE_IN_0_16 -GPtrArray *tp_channel_group_dup_members_contacts (TpChannel *self); +GPtrArray *tp_channel_group_dup_members (TpChannel *self); _TP_AVAILABLE_IN_0_16 -GPtrArray *tp_channel_group_dup_local_pending_contacts (TpChannel *self); +GPtrArray *tp_channel_group_dup_local_pending (TpChannel *self); _TP_AVAILABLE_IN_0_16 -GPtrArray *tp_channel_group_dup_remote_pending_contacts (TpChannel *self); +GPtrArray *tp_channel_group_dup_remote_pending (TpChannel *self); _TP_AVAILABLE_IN_0_16 -gboolean tp_channel_group_get_local_pending_contact_info (TpChannel *self, +gboolean tp_channel_group_get_local_pending_info (TpChannel *self, TpContact *local_pending, TpContact **actor, TpChannelGroupChangeReason *reason, const gchar **message); _TP_AVAILABLE_IN_0_16 diff --git a/tests/dbus/call-channel.c b/tests/dbus/call-channel.c index 1caacd2..0b61be1 100644 --- a/tests/dbus/call-channel.c +++ b/tests/dbus/call-channel.c @@ -110,9 +110,6 @@ setup (Test *test, g_assert_no_error (test->error); test->factory = tp_automatic_client_factory_new (test->dbus); - tp_client_factory_add_channel_features_varargs (test->factory, - TP_CHANNEL_FEATURE_CONTACTS, - 0); test->conn = tp_client_factory_ensure_connection (test->factory, object_path, NULL, &test->error); diff --git a/tests/dbus/channel-introspect.c b/tests/dbus/channel-introspect.c index a17fe6e..66a6d6a 100644 --- a/tests/dbus/channel-introspect.c +++ b/tests/dbus/channel-introspect.c @@ -110,7 +110,7 @@ main (int argc, GAsyncResult *prepare_result; GQuark chat_states_features[] = { TP_CHANNEL_FEATURE_CORE, TP_CHANNEL_FEATURE_CHAT_STATES, 0 }; - GQuark contacts_features[] = { TP_CHANNEL_FEATURE_CONTACTS, 0 }; + GQuark group_features[] = { TP_CHANNEL_FEATURE_GROUP, 0 }; g_type_init (); tp_tests_abort_after (10); @@ -278,7 +278,7 @@ main (int argc, g_hash_table_unref (asv); asv = NULL; - tp_tests_proxy_run_until_prepared (chan, contacts_features); + tp_tests_proxy_run_until_prepared (chan, group_features); g_assert_cmpuint (g_hash_table_size ( TP_TESTS_PROPS_TEXT_CHANNEL (service_props_group_chan) ->dbus_property_interfaces_retrieved), ==, 2); diff --git a/tests/dbus/channel.c b/tests/dbus/channel.c index 34e80d7..d352070 100644 --- a/tests/dbus/channel.c +++ b/tests/dbus/channel.c @@ -320,7 +320,7 @@ static void test_leave_room_prepared_no_reason (Test *test, gconstpointer data G_GNUC_UNUSED) { - GQuark features[] = { TP_CHANNEL_FEATURE_CONTACTS, 0 }; + GQuark features[] = { TP_CHANNEL_FEATURE_GROUP, 0 }; g_assert (tp_proxy_get_invalidated (test->channel_room) == NULL); @@ -344,7 +344,7 @@ static void test_leave_room_prepared_reason (Test *test, gconstpointer data G_GNUC_UNUSED) { - GQuark features[] = { TP_CHANNEL_FEATURE_CONTACTS, 0 }; + GQuark features[] = { TP_CHANNEL_FEATURE_GROUP, 0 }; g_assert (tp_proxy_get_invalidated (test->channel_room) == NULL); @@ -552,7 +552,7 @@ static void test_join_room (Test *test, gconstpointer data G_GNUC_UNUSED) { - GQuark features[] = { TP_CHANNEL_FEATURE_CONTACTS, 0 }; + GQuark features[] = { TP_CHANNEL_FEATURE_GROUP, 0 }; tp_tests_proxy_run_until_prepared (test->channel_room, features); @@ -587,7 +587,7 @@ test_contacts (Test *test, const gchar *id = "badger"; const gchar *alias1 = "Alias 1"; const gchar *alias2 = "Alias 2"; - GQuark channel_features[] = { TP_CHANNEL_FEATURE_CONTACTS, 0 }; + GQuark channel_features[] = { TP_CHANNEL_FEATURE_GROUP, 0 }; TpHandle handle; GArray *handles; TpContact *contact; @@ -630,7 +630,7 @@ test_contacts (Test *test, TP_TESTS_CONTACTS_CONNECTION (test->base_connection), 1, &handle, &alias2); - g_signal_connect (test->channel_room, "group-contacts-changed", + g_signal_connect (test->channel_room, "group-members-changed", G_CALLBACK (group_contacts_changed_cb), test); handles = g_array_new (FALSE, FALSE, sizeof (TpHandle)); @@ -642,7 +642,7 @@ test_contacts (Test *test, g_main_loop_run (test->mainloop); /* There is ourself and the new contact, get the new one */ - contacts = tp_channel_group_dup_members_contacts (test->channel_room); + contacts = tp_channel_group_dup_members (test->channel_room); g_assert (contacts != NULL); g_assert (contacts->len == 2); contact = g_ptr_array_index (contacts, 0); diff --git a/tests/dbus/cli-group.c b/tests/dbus/cli-group.c index 60e496f..fa62b9e 100644 --- a/tests/dbus/cli-group.c +++ b/tests/dbus/cli-group.c @@ -70,12 +70,12 @@ test_channel_proxy (TpTestsTextChannelGroup *service_chan, { TpIntset *add, *rem, *expected_members; GHashTable *details; - GQuark features[] = { TP_CHANNEL_FEATURE_CONTACTS, 0 }; + GQuark features[] = { TP_CHANNEL_FEATURE_GROUP, 0 }; GMainLoop *loop = g_main_loop_new (NULL, FALSE); tp_tests_proxy_run_until_prepared (chan, features); - g_signal_connect (chan, "group-contacts-changed", + g_signal_connect (chan, "group-members-changed", (GCallback) group_members_changed_cb, loop); /* Add a couple of members. */ @@ -98,7 +98,7 @@ test_channel_proxy (TpTestsTextChannelGroup *service_chan, tp_clear_pointer (&details, g_hash_table_unref); - /* Run until we get "group-contacts-changed" signal */ + /* Run until we get "group-members-changed" signal */ g_main_loop_run (loop); expected_members = add; @@ -126,7 +126,7 @@ test_channel_proxy (TpTestsTextChannelGroup *service_chan, tp_intset_destroy (add); tp_intset_destroy (rem); - /* Run until we get "group-contacts-changed" signal */ + /* Run until we get "group-members-changed" signal */ g_main_loop_run (loop); tp_intset_add (expected_members, h3); @@ -221,7 +221,7 @@ run_until_members_changed (TpChannel *channel) GMainLoop *loop = g_main_loop_new (NULL, FALSE); gulong id; - id = g_signal_connect_swapped (channel, "group-contacts-changed", + id = g_signal_connect_swapped (channel, "group-members-changed", G_CALLBACK (g_main_loop_quit), loop); g_main_loop_run (loop); @@ -234,7 +234,7 @@ run_until_members_changed (TpChannel *channel) static void check_removed_unknown_error_in_invalidated (void) { - GQuark features[] = { TP_CHANNEL_FEATURE_CONTACTS, 0 }; + GQuark features[] = { TP_CHANNEL_FEATURE_GROUP, 0 }; gchar *chan_path; TpTestsTextChannelGroup *service_chan; TpChannel *chan; @@ -326,7 +326,7 @@ check_invalidated_known_error_cb (TpProxy *proxy, static void check_removed_known_error_in_invalidated (void) { - GQuark features[] = { TP_CHANNEL_FEATURE_CONTACTS, 0 }; + GQuark features[] = { TP_CHANNEL_FEATURE_GROUP, 0 }; gchar *chan_path; TpTestsTextChannelGroup *service_chan; TpChannel *chan; diff --git a/tests/dbus/group-mixin.c b/tests/dbus/group-mixin.c index 702ee4d..6a218c1 100644 --- a/tests/dbus/group-mixin.c +++ b/tests/dbus/group-mixin.c @@ -474,13 +474,13 @@ in_the_desert (void) static void test_group_mixin (void) { - GQuark features[] = { TP_CHANNEL_FEATURE_CONTACTS, 0 }; + GQuark features[] = { TP_CHANNEL_FEATURE_GROUP, 0 }; tp_tests_proxy_run_until_prepared (chan, features); MYASSERT (tp_proxy_has_interface (chan, TP_IFACE_CHANNEL_INTERFACE_GROUP), ""); - g_signal_connect (chan, "group-contacts-changed", + g_signal_connect (chan, "group-members-changed", G_CALLBACK (on_members_changed), NULL); check_initial_properties (); diff --git a/tests/lib/util.c b/tests/lib/util.c index d70134c..f8e373e 100644 --- a/tests/lib/util.c +++ b/tests/lib/util.c @@ -522,7 +522,7 @@ tp_tests_channel_assert_expect_members (TpChannel *channel, guint i; members = tp_intset_new (); - contacts = tp_channel_group_dup_members_contacts (channel); + contacts = tp_channel_group_dup_members (channel); if (contacts != NULL) { for (i = 0; i < contacts->len; i++) -- 1.7.9.5