From a83da438f0255407395fdeeb0a2c4724110d2ad9 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Mon, 7 May 2012 18:54:09 +0200 Subject: [PATCH] remove channel-group.c This removes TP_CHANNEL_FEATURE_GROUP and all APIs relatede to it. TP_CHANNEL_FEATURE_CONTACTS replaces it. https://bugs.freedesktop.org/show_bug.cgi?id=49371 --- docs/reference/telepathy-glib-sections.txt | 13 +- telepathy-glib/Makefile.am | 1 - telepathy-glib/channel-group.c | 806 ---------------------------- telepathy-glib/channel-internal.h | 14 - telepathy-glib/channel.c | 103 ---- telepathy-glib/channel.h | 26 - telepathy-glib/introspection.am | 1 - 7 files changed, 3 insertions(+), 961 deletions(-) delete mode 100644 telepathy-glib/channel-group.c diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt index 87917b1..3389bfd 100644 --- a/docs/reference/telepathy-glib-sections.txt +++ b/docs/reference/telepathy-glib-sections.txt @@ -3002,7 +3002,6 @@ tp_channel_new_from_properties tp_channel_init_known_interfaces TP_CHANNEL_FEATURE_CORE -TP_CHANNEL_FEATURE_CONTACTS tp_channel_borrow_connection tp_channel_borrow_immutable_properties tp_channel_get_channel_type @@ -3030,20 +3029,14 @@ tp_channel_get_feature_quark_password TP_CHANNEL_FEATURE_CHAT_STATES tp_channel_get_chat_state -TP_CHANNEL_FEATURE_GROUP +TP_CHANNEL_FEATURE_CONTACTS tp_channel_group_get_flags -tp_channel_group_get_handle_owner -tp_channel_group_get_contact_owner -tp_channel_group_get_self_handle tp_channel_group_get_self_contact -tp_channel_group_get_members tp_channel_group_dup_members_contacts -tp_channel_group_get_local_pending tp_channel_group_dup_local_pending_contacts -tp_channel_group_get_remote_pending -tp_channel_group_dup_remote_pending_contacts -tp_channel_group_get_local_pending_info tp_channel_group_get_local_pending_contact_info +tp_channel_group_dup_remote_pending_contacts +tp_channel_group_get_contact_owner TP_ERRORS_REMOVED_FROM_GROUP TP_CHANNEL_FEATURE_PASSWORD diff --git a/telepathy-glib/Makefile.am b/telepathy-glib/Makefile.am index aeba990..352d7d9 100644 --- a/telepathy-glib/Makefile.am +++ b/telepathy-glib/Makefile.am @@ -245,7 +245,6 @@ libtelepathy_glib_main_internal_la_SOURCES = \ call-stream-endpoint.c \ channel.c \ channel-contacts.c \ - channel-group.c \ channel-internal.h \ channel-dispatcher.c \ channel-dispatch-operation.c \ diff --git a/telepathy-glib/channel-group.c b/telepathy-glib/channel-group.c deleted file mode 100644 index dd28426..0000000 --- a/telepathy-glib/channel-group.c +++ /dev/null @@ -1,806 +0,0 @@ -/* - * channel.c - proxy for a Telepathy channel (Group interface) - * - * Copyright (C) 2007-2008 Collabora Ltd. - * Copyright (C) 2007-2008 Nokia Corporation - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" - -#include "telepathy-glib/channel-internal.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#define DEBUG_FLAG TP_DEBUG_GROUPS -#include "telepathy-glib/debug-internal.h" -#include "telepathy-glib/proxy-internal.h" - -/* channel-group.c is ~all deprecated APIs, modern APIs are in - * channel-contacts.c. So we allow this module to use deprecated functions. */ -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - -/** - * TP_ERRORS_REMOVED_FROM_GROUP: - * - * #GError domain representing the local user being removed from a channel - * with the Group interface. The @code in a #GError with this domain must - * be a member of #TpChannelGroupChangeReason. - * - * This error may be raised on non-Group channels with certain reason codes - * if there's no better error code to use (mainly - * %TP_CHANNEL_GROUP_CHANGE_REASON_NONE). - * - * This macro expands to a function call returning a #GQuark. - * - * Since: 0.7.1 - */ -GQuark -tp_errors_removed_from_group_quark (void) -{ - static GQuark q = 0; - - if (q == 0) - q = g_quark_from_static_string ("tp_errors_removed_from_group_quark"); - - return q; -} - - -static void -local_pending_info_free (LocalPendingInfo *info) -{ - g_free (info->message); - g_clear_object (&info->actor_contact); - g_slice_free (LocalPendingInfo, info); -} - - -/** - * tp_channel_group_get_self_handle: - * @self: a channel - * - * Return the #TpChannel:group-self-handle property (see the description - * of that property for notes on validity). - * - * Returns: the handle representing the user, or 0 - * Since: 0.7.12 - * Deprecated: New code should use tp_channel_group_get_self_contact() instead. - */ -TpHandle -tp_channel_group_get_self_handle (TpChannel *self) -{ - g_return_val_if_fail (TP_IS_CHANNEL (self), 0); - - return self->priv->group_self_handle; -} - -/** - * tp_channel_group_get_members: - * @self: a channel - * - * If @self is a group and the %TP_CHANNEL_FEATURE_GROUP feature has been - * prepared, return a #TpIntset containing its members. - * - * 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. - * - * Returns: (transfer none): the members, or %NULL - * Since: 0.7.12 - * Deprecated: New code should use tp_channel_group_dup_members_contacts() - * instead. - */ -const TpIntset * -tp_channel_group_get_members (TpChannel *self) -{ - g_return_val_if_fail (TP_IS_CHANNEL (self), NULL); - - return self->priv->group_members; -} - - -/** - * tp_channel_group_get_local_pending: - * @self: a channel - * - * If @self is a group and the %TP_CHANNEL_FEATURE_GROUP feature has been - * prepared, return a #TpIntset containing its local-pending members. - * - * 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. - * - * Returns: (transfer none): the local-pending members, or %NULL - * Since: 0.7.12 - * Deprecated: New code should use tp_channel_group_dup_local_pending_contacts() - * instead. - */ -const TpIntset * -tp_channel_group_get_local_pending (TpChannel *self) -{ - g_return_val_if_fail (TP_IS_CHANNEL (self), NULL); - - return self->priv->group_local_pending; -} - - -/** - * tp_channel_group_get_remote_pending: - * @self: a channel - * - * If @self is a group and the %TP_CHANNEL_FEATURE_GROUP feature has been - * prepared, return a #TpIntset containing its remote-pending members. - * - * 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. - * - * Returns: (transfer none): the remote-pending members, or %NULL - * Since: 0.7.12 - * Deprecated: New code should use - * tp_channel_group_dup_remote_pending_contacts() instead. - */ -const TpIntset * -tp_channel_group_get_remote_pending (TpChannel *self) -{ - g_return_val_if_fail (TP_IS_CHANNEL (self), NULL); - - return self->priv->group_remote_pending; -} - - -/** - * tp_channel_group_get_local_pending_info: - * @self: a channel - * @local_pending: the handle of a local-pending contact about whom more - * information is needed - * @actor: (out) (allow-none): either %NULL or a location to return the contact - * who requested the change - * @reason: (out) (allow-none): either %NULL or a location to return the reason - * for the change - * @message: (out) (transfer none) (allow-none): either %NULL or a location to - * return the user-supplied message - * - * If @local_pending is actually the handle of a local-pending contact, - * write additional information into @actor, @reason and @message and return - * %TRUE. The handle and message are not referenced or copied, and can only be - * assumed to remain valid until the main loop is re-entered. - * - * If @local_pending is not the handle of a local-pending contact, - * write 0 into @actor, %TP_CHANNEL_GROUP_CHANGE_REASON_NONE into @reason - * and "" into @message, and return %FALSE. - * - * Returns: %TRUE if the contact is in fact local-pending - * Since: 0.7.12 - * Deprecated: New code should use - * tp_channel_group_get_local_pending_contact_info() instead. - */ -gboolean -tp_channel_group_get_local_pending_info (TpChannel *self, - TpHandle local_pending, - TpHandle *actor, - TpChannelGroupChangeReason *reason, - const gchar **message) -{ - gboolean ret = FALSE; - TpHandle a = 0; - TpChannelGroupChangeReason r = TP_CHANNEL_GROUP_CHANGE_REASON_NONE; - const gchar *m = ""; - - g_return_val_if_fail (TP_IS_CHANNEL (self), FALSE); - - if (self->priv->group_local_pending != NULL) - { - /* it could conceivably be someone who is local-pending */ - - ret = tp_intset_is_member (self->priv->group_local_pending, - local_pending); - - if (ret && self->priv->group_local_pending_info != NULL) - { - /* we might even have information about them */ - LocalPendingInfo *info = g_hash_table_lookup ( - self->priv->group_local_pending_info, - GUINT_TO_POINTER (local_pending)); - - if (info != NULL) - { - a = info->actor; - r = info->reason; - - if (info->message != NULL) - m = info->message; - } - /* else we have no info, which means (0, NONE, NULL) */ - } - } - - if (actor != NULL) - *actor = a; - - if (message != NULL) - *message = m; - - if (reason != NULL) - *reason = r; - - return ret; -} - - -/** - * tp_channel_group_get_handle_owner: - * @self: a channel - * @handle: a handle which is a member of this channel - * - * Synopsis (see below for further explanation): - * - * - if @self is not a group or @handle is not a member of this channel, - * result is undefined; - * - 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, - * result is undefined; - * - if @handle is channel-specific and its globally valid "owner" is known, - * return that owner; - * - if @handle is channel-specific and its globally valid "owner" is unknown, - * return zero; - * - if @handle is globally valid, return @handle itself - * - * Some channels (those with flags that include - * %TP_CHANNEL_GROUP_FLAG_CHANNEL_SPECIFIC_HANDLES) have a concept of - * "channel-specific handles". These are handles that only have meaning within - * the context of the channel - for instance, in XMPP Multi-User Chat, - * participants in a chatroom are identified by an in-room JID consisting - * of the JID of the chatroom plus a local nickname. - * - * Depending on the protocol and configuration, it might be possible to find - * out what globally valid handle (i.e. an identifier that you could add to - * your contact list) "owns" a channel-specific handle. For instance, in - * most XMPP MUC chatrooms, normal users cannot see what global JID - * corresponds to an in-room JID, but moderators can. - * - * This is further complicated by the fact that channels with channel-specific - * handles can sometimes have members with globally valid handles (for - * instance, if you invite someone to an XMPP MUC using their globally valid - * JID, you would expect to see the handle representing that JID in the - * Group's remote-pending set). - * - * This function's result is undefined unless the channel is ready - * and its flags include %TP_CHANNEL_GROUP_FLAG_PROPERTIES (an implementation - * without extra D-Bus round trips is not possible using the older API). - * - * Returns: the global handle that owns the given handle, or 0 - * Since: 0.7.12 - * Deprecated: New code should use tp_channel_group_get_contact_owner() instead. - */ -TpHandle -tp_channel_group_get_handle_owner (TpChannel *self, - TpHandle handle) -{ - gpointer key, value; - - g_return_val_if_fail (TP_IS_CHANNEL (self), 0); - - if (self->priv->group_handle_owners == NULL) - { - /* undefined result - pretending it's global is probably as good as - * any other behaviour, since we can't know either way */ - return handle; - } - - if (g_hash_table_lookup_extended (self->priv->group_handle_owners, - GUINT_TO_POINTER (handle), &key, &value)) - { - /* channel-specific, value is either owner or 0 if unknown */ - return GPOINTER_TO_UINT (value); - } - else - { - /* either already globally valid, or not a member */ - return handle; - } -} - -static void -tp_channel_group_self_handle_changed_cb (TpChannel *self, - guint self_handle, - gpointer unused G_GNUC_UNUSED, - GObject *unused_object G_GNUC_UNUSED) -{ - if (self_handle == self->priv->group_self_handle) - return; - - DEBUG ("%p SelfHandle changed to %u", self, self_handle); - - self->priv->group_self_handle = self_handle; - g_object_notify ((GObject *) self, "group-self-handle"); -} - -static void -tp_channel_group_self_contact_changed_cb (TpChannel *self, - guint self_handle, - const gchar *identifier, - gpointer user_data, - GObject *weak_object) -{ - tp_channel_group_self_handle_changed_cb (self, self_handle, user_data, - weak_object); -} - -static void -_tp_channel_group_set_one_lp (TpChannel *self, - TpHandle handle, - TpHandle actor, - TpChannelGroupChangeReason reason, - const gchar *message) -{ - LocalPendingInfo *info = NULL; - - g_assert (self->priv->group_local_pending != NULL); - - tp_intset_add (self->priv->group_local_pending, handle); - tp_intset_remove (self->priv->group_members, handle); - tp_intset_remove (self->priv->group_remote_pending, handle); - - if (actor == 0 && reason == TP_CHANNEL_GROUP_CHANGE_REASON_NONE && - tp_str_empty (message)) - { - /* we just don't bother storing informationless local-pending */ - if (self->priv->group_local_pending_info != NULL) - { - g_hash_table_remove (self->priv->group_local_pending_info, - GUINT_TO_POINTER (handle)); - } - - return; - } - - if (self->priv->group_local_pending_info == NULL) - { - self->priv->group_local_pending_info = g_hash_table_new_full ( - g_direct_hash, g_direct_equal, NULL, - (GDestroyNotify) local_pending_info_free); - } - else - { - info = g_hash_table_lookup (self->priv->group_local_pending_info, - GUINT_TO_POINTER (handle)); - } - - if (info == NULL) - { - info = g_slice_new0 (LocalPendingInfo); - } - else - { - g_hash_table_steal (self->priv->group_local_pending_info, - GUINT_TO_POINTER (handle)); - } - - info->actor = actor; - info->reason = reason; - g_free (info->message); - - if (tp_str_empty (message)) - info->message = NULL; - else - info->message = g_strdup (message); - - g_hash_table_insert (self->priv->group_local_pending_info, - GUINT_TO_POINTER (handle), info); -} - - -static void -_tp_channel_group_set_lp (TpChannel *self, - const GPtrArray *info) -{ - guint i; - - /* should only be called during initialization */ - g_assert (self->priv->group_local_pending != NULL); - g_assert (self->priv->group_local_pending_info == NULL); - - tp_intset_clear (self->priv->group_local_pending); - - /* NULL-safe for ease of use with tp_asv_get_boxed */ - if (info == NULL) - { - return; - } - - for (i = 0; i < info->len; i++) - { - GValueArray *item = g_ptr_array_index (info, i); - TpHandle handle = g_value_get_uint (item->values + 0); - TpHandle actor = g_value_get_uint (item->values + 1); - TpChannelGroupChangeReason reason = g_value_get_uint ( - item->values + 2); - const gchar *message = g_value_get_string (item->values + 3); - - if (handle == 0) - { - DEBUG ("Ignoring handle 0, claimed to be in local-pending"); - continue; - } - - DEBUG ("+L %u, actor=%u, reason=%u, message=%s", handle, - actor, reason, message); - _tp_channel_group_set_one_lp (self, handle, actor, - reason, message); - } -} - -static void -_tp_channel_emit_initial_sets (TpChannel *self) -{ - GArray *added, *remote_pending; - GArray empty_array = { NULL, 0 }; - TpIntsetFastIter iter; - TpHandle handle; - - added = tp_intset_to_array (self->priv->group_members); - remote_pending = tp_intset_to_array (self->priv->group_remote_pending); - - g_signal_emit_by_name (self, "group-members-changed", "", - added, &empty_array, &empty_array, remote_pending, 0, 0); - - tp_intset_fast_iter_init (&iter, self->priv->group_local_pending); - while (tp_intset_fast_iter_next (&iter, &handle)) - { - GArray local_pending = { (gchar *) &handle, 1 }; - TpHandle actor; - TpChannelGroupChangeReason reason; - const gchar *message; - - tp_channel_group_get_local_pending_info (self, handle, &actor, &reason, - &message); - - g_signal_emit_by_name (self, "group-members-changed", message, - &empty_array, &empty_array, &local_pending, &empty_array, actor, - reason); - } - - g_array_unref (added); - g_array_unref (remote_pending); -} - -static void -tp_channel_got_group_properties_cb (TpProxy *proxy, - GHashTable *asv, - const GError *error, - gpointer unused G_GNUC_UNUSED, - GObject *unused_object G_GNUC_UNUSED) -{ - TpChannel *self = TP_CHANNEL (proxy); - static GType au_type = 0; - - if (G_UNLIKELY (au_type == 0)) - { - au_type = dbus_g_type_get_collection ("GArray", G_TYPE_UINT); - } - - if (error != NULL) - { - _tp_channel_abort_introspection (self, "GetAll on GROUP iface failed", - error); - } - else - { - GHashTable *table; - GArray *arr; - - DEBUG ("Received %u group properties", g_hash_table_size (asv)); - - tp_channel_group_self_handle_changed_cb (self, - tp_asv_get_uint32 (asv, "SelfHandle", NULL), NULL, NULL); - - g_assert (self->priv->group_members == NULL); - g_assert (self->priv->group_remote_pending == NULL); - - arr = tp_asv_get_boxed (asv, "Members", au_type); - - if (arr == NULL) - self->priv->group_members = tp_intset_new (); - else - self->priv->group_members = tp_intset_from_array (arr); - - if (tp_intset_remove (self->priv->group_members, 0)) - { - DEBUG ("Ignoring handle 0, claimed to be in group"); - } - - arr = tp_asv_get_boxed (asv, "RemotePendingMembers", au_type); - - if (arr == NULL) - self->priv->group_remote_pending = tp_intset_new (); - else - self->priv->group_remote_pending = tp_intset_from_array (arr); - - if (tp_intset_remove (self->priv->group_remote_pending, 0)) - { - DEBUG ("Ignoring handle 0, claimed to be in remote-pending"); - } - - g_assert (self->priv->group_local_pending == NULL); - g_assert (self->priv->group_local_pending_info == NULL); - - self->priv->group_local_pending = tp_intset_new (); - - /* this is NULL-safe with respect to the array */ - _tp_channel_group_set_lp (self, - tp_asv_get_boxed (asv, "LocalPendingMembers", - TP_ARRAY_TYPE_LOCAL_PENDING_INFO_LIST)); - - table = tp_asv_get_boxed (asv, "HandleOwners", - TP_HASH_TYPE_HANDLE_OWNER_MAP); - - self->priv->group_handle_owners = g_hash_table_new (g_direct_hash, - g_direct_equal); - - if (table != NULL) - tp_g_hash_table_update (self->priv->group_handle_owners, - table, NULL, NULL); - - table = tp_asv_get_boxed (asv, "MemberIdentifiers", - TP_HASH_TYPE_HANDLE_IDENTIFIER_MAP); - - _tp_channel_emit_initial_sets (self); - _tp_channel_continue_introspection (self); - } -} - -static void -handle_members_changed (TpChannel *self, - const gchar *message, - const GArray *added, - const GArray *removed, - const GArray *local_pending, - const GArray *remote_pending, - guint actor, - guint reason, - GHashTable *details) -{ - guint i; - - if (self->priv->group_members == NULL) - return; - - g_assert (self->priv->group_local_pending != NULL); - g_assert (self->priv->group_remote_pending != NULL); - - for (i = 0; i < added->len; i++) - { - TpHandle handle = g_array_index (added, guint, i); - - DEBUG ("+++ contact#%u", handle); - - if (handle == 0) - { - DEBUG ("handle 0 shouldn't be in MembersChanged, ignoring"); - continue; - } - - tp_intset_add (self->priv->group_members, handle); - tp_intset_remove (self->priv->group_local_pending, handle); - tp_intset_remove (self->priv->group_remote_pending, handle); - } - - for (i = 0; i < local_pending->len; i++) - { - TpHandle handle = g_array_index (local_pending, guint, i); - - DEBUG ("+LP contact#%u", handle); - - if (handle == 0) - { - DEBUG ("handle 0 shouldn't be in MembersChanged, ignoring"); - continue; - } - - /* Special-case renaming a local-pending contact, if the - * signal is spec-compliant. Keep the old actor/reason/message in - * this case */ - if (reason == TP_CHANNEL_GROUP_CHANGE_REASON_RENAMED && - added->len == 0 && - local_pending->len == 1 && - remote_pending->len == 0 && - removed->len == 1 && - self->priv->group_local_pending_info != NULL) - { - TpHandle old = g_array_index (removed, guint, 0); - LocalPendingInfo *info = g_hash_table_lookup ( - self->priv->group_local_pending_info, - GUINT_TO_POINTER (old)); - - if (info != NULL) - { - _tp_channel_group_set_one_lp (self, handle, - info->actor, info->reason, info->message); - continue; - } - } - - /* not reached if the Renamed special case occurred */ - _tp_channel_group_set_one_lp (self, handle, actor, - reason, message); - } - - for (i = 0; i < remote_pending->len; i++) - { - TpHandle handle = g_array_index (remote_pending, guint, i); - - DEBUG ("+RP contact#%u", handle); - - if (handle == 0) - { - DEBUG ("handle 0 shouldn't be in MembersChanged, ignoring"); - continue; - } - - tp_intset_add (self->priv->group_remote_pending, handle); - tp_intset_remove (self->priv->group_members, handle); - tp_intset_remove (self->priv->group_local_pending, handle); - } - - for (i = 0; i < removed->len; i++) - { - TpHandle handle = g_array_index (removed, guint, i); - - DEBUG ("--- contact#%u", handle); - - if (handle == 0) - { - DEBUG ("handle 0 shouldn't be in MembersChanged, ignoring"); - continue; - } - - if (self->priv->group_local_pending_info != NULL) - g_hash_table_remove (self->priv->group_local_pending_info, - GUINT_TO_POINTER (handle)); - - tp_intset_remove (self->priv->group_members, handle); - tp_intset_remove (self->priv->group_local_pending, handle); - tp_intset_remove (self->priv->group_remote_pending, handle); - } - - g_signal_emit_by_name (self, "group-members-changed", added, - removed, local_pending, remote_pending, details); -} - -static void -tp_channel_group_members_changed_cb (TpChannel *self, - const GArray *added, - const GArray *removed, - const GArray *local_pending, - const GArray *remote_pending, - GHashTable *details, - gpointer unused G_GNUC_UNUSED, - GObject *weak_obj G_GNUC_UNUSED) -{ - const gchar *message; - guint actor; - guint reason; - - DEBUG ("%p MembersChanged: added %u, removed %u, " - "moved %u to LP and %u to RP", - self, added->len, removed->len, local_pending->len, remote_pending->len); - - actor = tp_asv_get_uint32 (details, "actor", NULL); - reason = tp_asv_get_uint32 (details, "change-reason", NULL); - message = tp_asv_get_string (details, "message"); - - if (message == NULL) - message = ""; - - handle_members_changed (self, message, added, removed, local_pending, - remote_pending, actor, reason, details); -} - - -static void -tp_channel_handle_owners_changed_cb (TpChannel *self, - GHashTable *added, - const GArray *removed, - GHashTable *identifiers, - gpointer unused G_GNUC_UNUSED, - GObject *unused_object G_GNUC_UNUSED) -{ - guint i; - - /* ignore the signal if we don't have the initial set yet */ - if (self->priv->group_handle_owners == NULL) - return; - - tp_g_hash_table_update (self->priv->group_handle_owners, added, NULL, NULL); - - for (i = 0; i < removed->len; i++) - { - g_hash_table_remove (self->priv->group_handle_owners, - GUINT_TO_POINTER (g_array_index (removed, guint, i))); - } -} - - - -void -_tp_channel_get_group_properties (TpChannel *self) -{ - TpProxySignalConnection *sc; - GError *error = NULL; - - if (!tp_proxy_has_interface_by_id (self, - TP_IFACE_QUARK_CHANNEL_INTERFACE_GROUP)) - { - _tp_proxy_set_feature_prepared ((TpProxy *) self, - TP_CHANNEL_FEATURE_GROUP, FALSE); - - DEBUG ("%p: not a Group, continuing", self); - _tp_channel_continue_introspection (self); - return; - } - - DEBUG ("%p", self); - - /* If this callback has been called, 'self' has not been invalidated. And we - * just checked above that the proxy has the Group interface. So, connecting - * to these signals must succeed. */ -#define DIE(sig) \ - { \ - CRITICAL ("couldn't connect to " sig ": %s", error->message); \ - g_assert_not_reached (); \ - g_error_free (error); \ - return; \ - } - - sc = tp_cli_channel_interface_group_connect_to_members_changed (self, - tp_channel_group_members_changed_cb, NULL, NULL, NULL, &error); - - if (sc == NULL) - DIE ("MembersChanged"); - - sc = tp_cli_channel_interface_group_connect_to_self_contact_changed (self, - tp_channel_group_self_contact_changed_cb, NULL, NULL, NULL, &error); - - if (sc == NULL) - DIE ("SelfContactChanged"); - - sc = tp_cli_channel_interface_group_connect_to_handle_owners_changed ( - self, tp_channel_handle_owners_changed_cb, NULL, NULL, NULL, - &error); - - if (sc == NULL) - DIE ("HandleOwnersChanged"); - - tp_cli_dbus_properties_call_get_all (self, -1, - TP_IFACE_CHANNEL_INTERFACE_GROUP, tp_channel_got_group_properties_cb, - NULL, NULL, NULL); -} - -G_GNUC_END_IGNORE_DEPRECATIONS diff --git a/telepathy-glib/channel-internal.h b/telepathy-glib/channel-internal.h index fdec30d..21f59c0 100644 --- a/telepathy-glib/channel-internal.h +++ b/telepathy-glib/channel-internal.h @@ -31,7 +31,6 @@ typedef void (*TpChannelProc) (TpChannel *self); typedef struct { TpContact *actor_contact; - TpHandle actor; TpChannelGroupChangeReason reason; gchar *message; } LocalPendingInfo; @@ -53,19 +52,10 @@ struct _TpChannelPrivate { /* owned string (iface + "." + prop) => slice-allocated GValue */ GHashTable *channel_properties; - TpHandle group_self_handle; TpChannelGroupFlags group_flags; - /* NULL if members not discovered yet */ - TpIntset *group_members; - TpIntset *group_local_pending; - TpIntset *group_remote_pending; - /* (TpHandle => LocalPendingInfo), or NULL if members not discovered yet */ - GHashTable *group_local_pending_info; /* reason the self-handle left */ GError *group_remove_error /* implicitly zero-initialized */ ; - /* guint => guint, NULL if not discovered yet */ - GHashTable *group_handle_owners; /* reffed TpContact */ TpContact *target_contact; @@ -108,10 +98,6 @@ void _tp_channel_abort_introspection (TpChannel *self, const gchar *debug, const GError *error); -/* channel-group.c internals */ - -void _tp_channel_get_group_properties (TpChannel *self); - /* channel-contacts.c internals */ void _tp_channel_contacts_prepare_async (TpProxy *proxy, diff --git a/telepathy-glib/channel.c b/telepathy-glib/channel.c index f2286cb..a5a34ae 100644 --- a/telepathy-glib/channel.c +++ b/telepathy-glib/channel.c @@ -92,7 +92,6 @@ enum PROP_HANDLE, PROP_IDENTIFIER, PROP_CHANNEL_PROPERTIES, - PROP_GROUP_SELF_HANDLE, PROP_GROUP_FLAGS, PROP_REQUESTED, PROP_PASSWORD_NEEDED, @@ -104,7 +103,6 @@ enum enum { SIGNAL_GROUP_FLAGS_CHANGED, - SIGNAL_GROUP_MEMBERS_CHANGED, SIGNAL_GROUP_CONTACTS_CHANGED, SIGNAL_CHAT_STATE_CHANGED, N_SIGNALS @@ -147,33 +145,6 @@ tp_channel_get_feature_quark_core (void) } /** - * TP_CHANNEL_FEATURE_GROUP: - * - * Expands to a call to a function that returns a quark representing the Group - * features of a TpChannel. - * - * 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: - * - * - 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 - * - * One can ask for a feature to be prepared using the - * tp_proxy_prepare_async() function, and waiting for it to callback. - * - * Since: 0.11.3 - */ - -GQuark -tp_channel_get_feature_quark_group (void) -{ - return g_quark_from_static_string ("tp-channel-feature-group"); -} - -/** * TP_CHANNEL_FEATURE_CONTACTS: * * Expands to a call to a function that returns a quark representing the @@ -428,8 +399,6 @@ tp_channel_get_property (GObject *object, { TpChannel *self = TP_CHANNEL (object); - /* We still need to use deprecated getters funcs */ - G_GNUC_BEGIN_IGNORE_DEPRECATIONS switch (property_id) { case PROP_CONNECTION: @@ -451,9 +420,6 @@ tp_channel_get_property (GObject *object, case PROP_CHANNEL_PROPERTIES: g_value_set_boxed (value, self->priv->channel_properties); break; - case PROP_GROUP_SELF_HANDLE: - g_value_set_uint (value, self->priv->group_self_handle); - break; case PROP_GROUP_FLAGS: g_value_set_uint (value, self->priv->group_flags); break; @@ -476,7 +442,6 @@ tp_channel_get_property (GObject *object, G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } - G_GNUC_END_IGNORE_DEPRECATIONS } /** @@ -775,14 +740,8 @@ _tp_channel_continue_introspection (TpChannel *self) DEBUG ("%p: channel ready", self); - /* for now, we only have one introspection queue, so CORE and - * (if supported) GROUP turn up simultaneously */ _tp_proxy_set_feature_prepared ((TpProxy *) self, TP_CHANNEL_FEATURE_CORE, TRUE); - _tp_proxy_set_feature_prepared ((TpProxy *) self, - TP_CHANNEL_FEATURE_GROUP, - tp_proxy_has_interface_by_id (self, - TP_IFACE_QUARK_CHANNEL_INTERFACE_GROUP)); } else { @@ -1104,10 +1063,6 @@ tp_channel_constructor (GType type, g_queue_push_tail (self->priv->introspect_needed, _tp_channel_create_contacts); - /* this needs doing *after* GetInterfaces so we know whether we're a group */ - g_queue_push_tail (self->priv->introspect_needed, - _tp_channel_get_group_properties); - _tp_channel_continue_introspection (self); return (GObject *) self; @@ -1171,11 +1126,6 @@ tp_channel_finalize (GObject *object) DEBUG ("%p", self); g_clear_error (&self->priv->group_remove_error); - tp_clear_pointer (&self->priv->group_local_pending_info, g_hash_table_unref); - tp_clear_pointer (&self->priv->group_members, tp_intset_destroy); - tp_clear_pointer (&self->priv->group_local_pending, tp_intset_destroy); - tp_clear_pointer (&self->priv->group_remote_pending, tp_intset_destroy); - tp_clear_pointer (&self->priv->group_handle_owners, g_hash_table_unref); tp_clear_pointer (&self->priv->introspect_needed, g_queue_free); tp_clear_pointer (&self->priv->chat_states, g_hash_table_unref); tp_clear_pointer (&self->priv->channel_properties, g_hash_table_unref); @@ -1255,7 +1205,6 @@ tp_channel_prepare_password_async (TpProxy *proxy, enum { FEAT_CORE, - FEAT_GROUP, FEAT_CONTACTS, FEAT_CHAT_STATES, FEAT_PASSWORD, @@ -1275,8 +1224,6 @@ tp_channel_list_features (TpProxyClass *cls G_GNUC_UNUSED) features[FEAT_CORE].name = TP_CHANNEL_FEATURE_CORE; features[FEAT_CORE].core = TRUE; - features[FEAT_GROUP].name = TP_CHANNEL_FEATURE_GROUP; - features[FEAT_CONTACTS].name = TP_CHANNEL_FEATURE_CONTACTS; features[FEAT_CONTACTS].prepare_async = _tp_channel_contacts_prepare_async; @@ -1307,7 +1254,6 @@ tp_channel_class_init (TpChannelClass *klass) GParamSpec *param_spec; TpProxyClass *proxy_class = (TpProxyClass *) klass; GObjectClass *object_class = (GObjectClass *) klass; - GType au_type = dbus_g_type_get_collection ("GArray", G_TYPE_UINT); tp_channel_init_known_interfaces (); @@ -1389,26 +1335,6 @@ tp_channel_class_init (TpChannelClass *klass) param_spec); /** - * TpChannel:group-self-handle: - * - * If this channel is a group and %TP_CHANNEL_FEATURE_GROUP has been - * prepared, and the user is a member of the group, the #TpHandle - * representing them in this group. - * - * Otherwise, the result may be either a handle representing the user, or 0. - * - * Change notification is via notify::group-self-handle. - * - * Since: 0.7.12 - * Deprecated: Use #TpChannel:group-self-contact instead. - */ - param_spec = g_param_spec_uint ("group-self-handle", "Group.SelfHandle", - "Undefined if not a group", 0, G_MAXUINT32, 0, - G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); - g_object_class_install_property (object_class, PROP_GROUP_SELF_HANDLE, - param_spec); - - /** * TpChannel:group-flags: * * If the %TP_CHANNEL_FEATURE_CONTACTS feature has been prepared successfully, @@ -1496,35 +1422,6 @@ tp_channel_class_init (TpChannelClass *klass) G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT); /** - * TpChannel::group-members-changed: - * @self: a channel - * @added: (type GLib.Array) (element-type uint): a #GArray of #guint - * containing the full members added - * @removed: (type GLib.Array) (element-type uint): a #GArray of #guint - * containing the members (full, local-pending or remote-pending) removed - * @local_pending: (type GLib.Array) (element-type uint): a #GArray of - * #guint containing the local-pending members added - * @remote_pending: (type GLib.Array) (element-type uint): a #GArray of - * #guint containing the remote-pending members added - * @details: (type GLib.HashTable) (element-type utf8 GObject.Value): - * a #GHashTable mapping (gchar *) to #GValue containing details - * about the change, as described in the specification of the - * MembersChanged signal. - * - * Emitted when the group members change in a Group channel that is ready. - * - * Since: 0.7.21 - * Deprecated: Use #TpChannel::group-contacts-changed instead. - */ - 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, - G_TYPE_NONE, 5, - au_type, au_type, au_type, au_type, TP_HASH_TYPE_STRING_VARIANT_MAP); - - /** * TpChannel::chat-state-changed: * @self: a channel * @contact: a contact handle for the local user or another contact diff --git a/telepathy-glib/channel.h b/telepathy-glib/channel.h index 3aa0af5..21c8869 100644 --- a/telepathy-glib/channel.h +++ b/telepathy-glib/channel.h @@ -132,32 +132,6 @@ 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_GROUP \ - tp_channel_get_feature_quark_group () -GQuark tp_channel_get_feature_quark_group (void) G_GNUC_CONST; - -#ifndef TP_DISABLE_DEPRECATED -_TP_DEPRECATED_IN_0_20_FOR (tp_channel_group_get_self_contact) -TpHandle tp_channel_group_get_self_handle (TpChannel *self); - -_TP_DEPRECATED_IN_0_20_FOR (tp_channel_group_dup_members_contacts) -const TpIntset *tp_channel_group_get_members (TpChannel *self); - -_TP_DEPRECATED_IN_0_20_FOR (tp_channel_group_dup_local_pending_contacts) -const TpIntset *tp_channel_group_get_local_pending (TpChannel *self); - -_TP_DEPRECATED_IN_0_20_FOR (tp_channel_group_dup_remote_pending_contacts) -const TpIntset *tp_channel_group_get_remote_pending (TpChannel *self); - -_TP_DEPRECATED_IN_0_20_FOR (tp_channel_group_get_local_pending_contact_info) -gboolean tp_channel_group_get_local_pending_info (TpChannel *self, - TpHandle local_pending, TpHandle *actor, - TpChannelGroupChangeReason *reason, const gchar **message); - -_TP_DEPRECATED_IN_0_20_FOR (tp_channel_group_get_contact_owner) -TpHandle tp_channel_group_get_handle_owner (TpChannel *self, TpHandle handle); -#endif - #define TP_CHANNEL_FEATURE_CONTACTS \ tp_channel_get_feature_quark_contacts () _TP_AVAILABLE_IN_0_16 diff --git a/telepathy-glib/introspection.am b/telepathy-glib/introspection.am index b6bdcc5..5c7a332 100644 --- a/telepathy-glib/introspection.am +++ b/telepathy-glib/introspection.am @@ -27,7 +27,6 @@ TelepathyGLib_1_gir_FILES = \ $(srcdir)/protocol.c $(srcdir)/protocol.h \ $(srcdir)/connection-manager.c $(srcdir)/connection-manager.h \ $(srcdir)/channel.c $(srcdir)/channel.h \ - $(srcdir)/channel-group.c \ $(srcdir)/channel-contacts.c \ $(srcdir)/handle.c $(srcdir)/handle.h \ $(srcdir)/handle-channels-context.c $(srcdir)/handle-channels-context.h \ -- 1.7.9.5