summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.co.uk>2012-05-10 16:48:18 +0200
committerXavier Claessens <xavier.claessens@collabora.co.uk>2012-05-10 17:07:17 +0200
commit3b5a1460382e089000251412a5c6505ac3942e6c (patch)
treee6d43a5716185e5f23d537b798257f9f19142a65
parentd22f72a7ccd98aa3f848f100633ad69fea4b52f4 (diff)
parent9e6ee0fc8a5f5e07aa006cfc832a469735484849 (diff)
Merge branch 'master' into next
Conflicts: examples/cm/channelspecific/room.c telepathy-glib/base-contact-list.c telepathy-glib/connection-contact-list.c telepathy-glib/connection-handles.c telepathy-glib/connection.h telepathy-glib/contact.c telepathy-glib/contacts-mixin.c tests/dbus/message-mixin.c tests/lib/contact-list-manager.c
-rw-r--r--examples/cm/channelspecific/room.c10
-rw-r--r--examples/cm/contactlist/contact-list.c13
-rw-r--r--telepathy-glib/base-channel.c57
-rw-r--r--telepathy-glib/base-connection.c32
-rw-r--r--telepathy-glib/cli-connection.h4
-rw-r--r--telepathy-glib/connection-contact-list.c4
-rw-r--r--telepathy-glib/connection-handles.c10
-rw-r--r--telepathy-glib/connection.h3
-rw-r--r--telepathy-glib/contact.c9
-rw-r--r--telepathy-glib/contacts-mixin.c5
-rw-r--r--telepathy-glib/group-mixin.c64
-rw-r--r--telepathy-glib/handle-repo.c11
-rw-r--r--telepathy-glib/handle-repo.h10
-rw-r--r--telepathy-glib/handle-set.c32
-rw-r--r--tests/dbus/message-mixin.c13
-rw-r--r--tests/lib/contact-list-manager.c2
-rw-r--r--tests/lib/simple-conn.c3
-rw-r--r--tests/lib/textchan-null.c7
-rw-r--r--tests/lib/util.c44
-rw-r--r--tests/lib/util.h4
20 files changed, 63 insertions, 274 deletions
diff --git a/examples/cm/channelspecific/room.c b/examples/cm/channelspecific/room.c
index fd5dc4eae..c8ce6cf7f 100644
--- a/examples/cm/channelspecific/room.c
+++ b/examples/cm/channelspecific/room.c
@@ -154,7 +154,6 @@ complete_join (ExampleCSHRoomChannel *self)
rp, details);
tp_clear_pointer (&details, g_hash_table_unref);
- tp_handle_unref (contact_repo, new_self);
tp_intset_destroy (removed);
tp_intset_destroy (rp);
}
@@ -188,15 +187,6 @@ complete_join (ExampleCSHRoomChannel *self)
tp_clear_pointer (&details, g_hash_table_unref);
- tp_handle_unref (contact_repo, alice_local);
- tp_handle_unref (contact_repo, bob_local);
- tp_handle_unref (contact_repo, chris_local);
- tp_handle_unref (contact_repo, anon_local);
-
- tp_handle_unref (contact_repo, alice_global);
- tp_handle_unref (contact_repo, bob_global);
- tp_handle_unref (contact_repo, chris_global);
-
/* now that the dust has settled, we can also invite people */
tp_group_mixin_change_flags ((GObject *) self,
TP_CHANNEL_GROUP_FLAG_CAN_ADD | TP_CHANNEL_GROUP_FLAG_MESSAGE_ADD,
diff --git a/examples/cm/contactlist/contact-list.c b/examples/cm/contactlist/contact-list.c
index 410ba45eb..36fa74f40 100644
--- a/examples/cm/contactlist/contact-list.c
+++ b/examples/cm/contactlist/contact-list.c
@@ -395,7 +395,6 @@ receive_contact_lists (gpointer p)
d->publish = TRUE;
d->tags = g_hash_table_new (g_str_hash, g_str_equal);
g_hash_table_insert (d->tags, cambridge, cambridge);
- tp_handle_unref (self->priv->contact_repo, handle);
handle = tp_handle_ensure (self->priv->contact_repo, "guillaume@example.com",
NULL, NULL);
@@ -407,7 +406,6 @@ receive_contact_lists (gpointer p)
d->tags = g_hash_table_new (g_str_hash, g_str_equal);
g_hash_table_insert (d->tags, cambridge, cambridge);
g_hash_table_insert (d->tags, francophones, francophones);
- tp_handle_unref (self->priv->contact_repo, handle);
handle = tp_handle_ensure (self->priv->contact_repo, "olivier@example.com",
NULL, NULL);
@@ -419,7 +417,6 @@ receive_contact_lists (gpointer p)
d->tags = g_hash_table_new (g_str_hash, g_str_equal);
g_hash_table_insert (d->tags, montreal, montreal);
g_hash_table_insert (d->tags, francophones, francophones);
- tp_handle_unref (self->priv->contact_repo, handle);
handle = tp_handle_ensure (self->priv->contact_repo, "travis@example.com",
NULL, NULL);
@@ -428,7 +425,6 @@ receive_contact_lists (gpointer p)
d->alias = g_strdup ("Travis");
d->subscribe = TRUE;
d->publish = TRUE;
- tp_handle_unref (self->priv->contact_repo, handle);
/* Add a couple of people whose presence we've requested. They are
* remote-pending in subscribe */
@@ -442,7 +438,6 @@ receive_contact_lists (gpointer p)
d->tags = g_hash_table_new (g_str_hash, g_str_equal);
g_hash_table_insert (d->tags, cambridge, cambridge);
g_hash_table_insert (d->tags, francophones, francophones);
- tp_handle_unref (self->priv->contact_repo, handle);
handle = tp_handle_ensure (self->priv->contact_repo, "helen@example.com",
NULL, NULL);
@@ -452,7 +447,6 @@ receive_contact_lists (gpointer p)
d->subscribe_requested = TRUE;
d->tags = g_hash_table_new (g_str_hash, g_str_equal);
g_hash_table_insert (d->tags, cambridge, cambridge);
- tp_handle_unref (self->priv->contact_repo, handle);
/* Receive a couple of authorization requests too. These people are
* local-pending in publish; they're not actually on our protocol-level
@@ -463,7 +457,6 @@ receive_contact_lists (gpointer p)
tp_handle_set_add (self->priv->contacts, handle);
g_hash_table_insert (self->priv->publish_requests,
GUINT_TO_POINTER (handle), g_strdup ("I'm more metal than you!"));
- tp_handle_unref (self->priv->contact_repo, handle);
handle = tp_handle_ensure (self->priv->contact_repo, "christian@example.com",
NULL, NULL);
@@ -471,17 +464,14 @@ receive_contact_lists (gpointer p)
g_hash_table_insert (self->priv->publish_requests,
GUINT_TO_POINTER (handle),
g_strdup ("I have some fermented herring for you"));
- tp_handle_unref (self->priv->contact_repo, handle);
/* Add a couple of blocked contacts. */
handle = tp_handle_ensure (self->priv->contact_repo, "bill@example.com",
NULL, NULL);
tp_handle_set_add (self->priv->blocked_contacts, handle);
- tp_handle_unref (self->priv->contact_repo, handle);
handle = tp_handle_ensure (self->priv->contact_repo, "steve@example.com",
NULL, NULL);
tp_handle_set_add (self->priv->blocked_contacts, handle);
- tp_handle_unref (self->priv->contact_repo, handle);
g_hash_table_iter_init (&iter, self->priv->contact_details);
@@ -782,7 +772,7 @@ self_and_contact_new (ExampleContactList *self,
SelfAndContact *ret = g_slice_new0 (SelfAndContact);
ret->self = g_object_ref (self);
- ret->contact = tp_handle_ref (self->priv->contact_repo, contact);
+ ret->contact = contact;
return ret;
}
@@ -791,7 +781,6 @@ self_and_contact_destroy (gpointer p)
{
SelfAndContact *s = p;
- tp_handle_unref (s->self->priv->contact_repo, s->contact);
g_object_unref (s->self);
g_slice_free (SelfAndContact, s);
}
diff --git a/telepathy-glib/base-channel.c b/telepathy-glib/base-channel.c
index cb8456c73..e0174a33d 100644
--- a/telepathy-glib/base-channel.c
+++ b/telepathy-glib/base-channel.c
@@ -371,19 +371,7 @@ tp_base_channel_reopened (TpBaseChannel *chan, TpHandle initiator)
g_object_ref (chan);
if (priv->initiator != initiator)
- {
- TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (
- priv->conn, TP_HANDLE_TYPE_CONTACT);
- TpHandle old_initiator = priv->initiator;
-
- if (initiator != 0)
- tp_handle_ref (contact_repo, initiator);
-
- priv->initiator = initiator;
-
- if (old_initiator != 0)
- tp_handle_unref (contact_repo, old_initiator);
- }
+ priv->initiator = initiator;
chan->priv->requested = FALSE;
@@ -490,9 +478,7 @@ tp_base_channel_get_self_handle (TpBaseChannel *chan)
* Returns the target handle of @chan (without a reference), which will be 0
* if #TpBaseChannelClass.target_handle_type is #TP_HANDLE_TYPE_NONE for this
* class, and non-zero otherwise. This is a shortcut for retrieving the
- * #TpChannelIface:handle property. The reference count of the handle
- * is not increased; you should use tp_handle_ref() if you want to keep a hold
- * of it.
+ * #TpChannelIface:handle property.
*
* Returns: the target handle of @chan
*
@@ -511,9 +497,7 @@ tp_base_channel_get_target_handle (TpBaseChannel *chan)
* @chan: a channel
*
* Returns the initiator handle of @chan, as a shortcut for retrieving the
- * #TpBaseChannel:initiator-handle property. The reference count of the handle
- * is not increased; you should use tp_handle_ref() if you want to keep a hold
- * of it.
+ * #TpBaseChannel:initiator-handle property.
*
* Returns: the initiator handle of @chan
*
@@ -643,7 +627,6 @@ tp_base_channel_constructed (GObject *object)
GObjectClass *parent_class = tp_base_channel_parent_class;
TpBaseChannel *chan = TP_BASE_CHANNEL (object);
TpBaseConnection *conn = chan->priv->conn;
- TpHandleRepoIface *handles;
if (parent_class->constructed != NULL)
parent_class->constructed (object);
@@ -651,21 +634,6 @@ tp_base_channel_constructed (GObject *object)
g_return_if_fail (conn != NULL);
g_return_if_fail (TP_IS_BASE_CONNECTION (conn));
- if (klass->target_handle_type != TP_HANDLE_TYPE_NONE)
- {
- handles = tp_base_connection_get_handles (conn, klass->target_handle_type);
- g_assert (handles != NULL);
- g_assert (chan->priv->target != 0);
- tp_handle_ref (handles, chan->priv->target);
- }
-
- if (chan->priv->initiator != 0)
- {
- handles = tp_base_connection_get_handles (conn, TP_HANDLE_TYPE_CONTACT);
- g_assert (handles != NULL);
- tp_handle_ref (handles, chan->priv->initiator);
- }
-
if (chan->priv->object_path == NULL)
{
gchar *base_path = klass->get_object_path_suffix (chan);
@@ -811,9 +779,7 @@ static void
tp_base_channel_dispose (GObject *object)
{
TpBaseChannel *chan = TP_BASE_CHANNEL (object);
- TpBaseChannelClass *klass = TP_BASE_CHANNEL_GET_CLASS (chan);
TpBaseChannelPrivate *priv = chan->priv;
- TpHandleRepoIface *handles;
if (priv->dispose_has_run)
return;
@@ -825,23 +791,6 @@ tp_base_channel_dispose (GObject *object)
tp_base_channel_destroyed (chan);
}
- if (klass->target_handle_type != TP_HANDLE_TYPE_NONE
- && priv->target != 0)
- {
- handles = tp_base_connection_get_handles (priv->conn,
- klass->target_handle_type);
- tp_handle_unref (handles, priv->target);
- priv->target = 0;
- }
-
- if (priv->initiator != 0)
- {
- handles = tp_base_connection_get_handles (priv->conn,
- TP_HANDLE_TYPE_CONTACT);
- tp_handle_unref (handles, priv->initiator);
- priv->initiator = 0;
- }
-
tp_clear_object (&priv->conn);
if (G_OBJECT_CLASS (tp_base_channel_parent_class)->dispose)
diff --git a/telepathy-glib/base-connection.c b/telepathy-glib/base-connection.c
index e7d15c2b0..deaa4b767 100644
--- a/telepathy-glib/base-connection.c
+++ b/telepathy-glib/base-connection.c
@@ -484,15 +484,7 @@ tp_base_connection_set_property (GObject *object,
if (self->self_handle == new_self_handle)
return;
- if (self->self_handle != 0)
- tp_handle_unref (priv->handles[TP_HANDLE_TYPE_CONTACT],
- self->self_handle);
-
- self->self_handle = 0;
-
- if (new_self_handle != 0)
- self->self_handle = tp_handle_ref (priv->handles[TP_HANDLE_TYPE_CONTACT],
- new_self_handle);
+ self->self_handle = new_self_handle;
tp_svc_connection_emit_self_handle_changed (self, self->self_handle);
}
@@ -566,12 +558,6 @@ tp_base_connection_dispose (GObject *object)
g_assert ((self->status == TP_CONNECTION_STATUS_DISCONNECTED) ||
(self->status == TP_INTERNAL_CONNECTION_STATUS_NEW));
- if (self->self_handle != 0)
- {
- tp_handle_unref (self->priv->handles[TP_HANDLE_TYPE_CONTACT],
- self->self_handle);
- self->self_handle = 0;
- }
tp_base_connection_unregister (self);
@@ -1697,11 +1683,7 @@ out:
g_error_free (error);
}
- if (handles != NULL)
- {
- tp_handles_unref (handle_repo, handles);
- g_array_unref (handles);
- }
+ tp_clear_pointer (&handles, g_array_unref);
}
/**
@@ -2691,22 +2673,12 @@ conn_requests_requestotron_validate_handle (TpBaseConnection *self,
target_id_value);
requested_properties = altered_properties;
-
- tp_handle_ref (handles, target_handle);
}
}
conn_requests_offer_request (self, requested_properties, method, type,
target_handle_type, target_handle, context);
- /* If HandleType was not None, we got the relevant repo and took a reference
- * to target_handle; release it before returning
- */
- if (handles != NULL)
- {
- tp_handle_unref (handles, target_handle);
- }
-
/* If we made a new table, we should destroy it, and whichever of the GValues
* holding TargetHandle or TargetID we filled in. The other GValues are
* borrowed from the supplied requested_properties table.
diff --git a/telepathy-glib/cli-connection.h b/telepathy-glib/cli-connection.h
index 16d5efd5b..9980ab376 100644
--- a/telepathy-glib/cli-connection.h
+++ b/telepathy-glib/cli-connection.h
@@ -31,16 +31,20 @@ G_BEGIN_DECLS
/* connection-handles.c - this has to come after the auto-generated
* stuff because it uses an auto-generated typedef */
+#ifndef TP_DISABLE_DEPRECATED
+_TP_DEPRECATED_IN_UNRELEASED_FOR(tp_client_factory_ensure_contact)
void tp_connection_get_contact_attributes (TpConnection *self,
gint timeout_ms, guint n_handles, const TpHandle *handles,
const gchar * const *interfaces,
tp_cli_connection_interface_contacts_callback_for_get_contact_attributes callback,
gpointer user_data, GDestroyNotify destroy, GObject *weak_object);
+_TP_DEPRECATED_IN_UNRELEASED_FOR(tp_connection_dup_contact_list)
void tp_connection_get_contact_list_attributes (TpConnection *self,
gint timeout_ms, const gchar * const *interfaces,
tp_cli_connection_interface_contacts_callback_for_get_contact_attributes callback,
gpointer user_data, GDestroyNotify destroy, GObject *weak_object);
+#endif
G_END_DECLS
diff --git a/telepathy-glib/connection-contact-list.c b/telepathy-glib/connection-contact-list.c
index 4cd8fcb14..7560d1986 100644
--- a/telepathy-glib/connection-contact-list.c
+++ b/telepathy-glib/connection-contact-list.c
@@ -316,8 +316,8 @@ prepare_roster (TpConnection *self,
supported_interfaces = _tp_contacts_bind_to_signals (self,
(const GQuark *) features->data);
- tp_connection_get_contact_list_attributes (self, -1,
- supported_interfaces,
+ tp_cli_connection_interface_contact_list_call_get_contact_list_attributes (
+ self, -1, supported_interfaces,
got_contact_list_attributes_cb,
features, (GDestroyNotify) g_array_unref,
result ? g_object_ref (result) : NULL);
diff --git a/telepathy-glib/connection-handles.c b/telepathy-glib/connection-handles.c
index 2ab8d44f3..9fa121c8f 100644
--- a/telepathy-glib/connection-handles.c
+++ b/telepathy-glib/connection-handles.c
@@ -80,6 +80,8 @@ request_handles_context_free (gpointer p)
* For convenience, the handle type and IDs requested by the caller are
* passed through to this callback, so the caller does not have to include
* them in @user_data.
+ *
+ * Deprecated: See tp_connection_request_handles().
*/
@@ -158,6 +160,10 @@ connection_requested_handles (TpConnection *self,
* If they are valid, the callback will later be called with the given
* handles; if not all of them are valid, the callback will be called with
* an error.
+ *
+ * Deprecated: If @handle_type is TP_HANDLE_TYPE_CONTACT, use
+ * tp_connection_dup_contact_by_id_async() instead. For channel requests,
+ * use tp_account_channel_request_set_target_id() instead.
*/
void
tp_connection_request_handles (TpConnection *self,
@@ -218,6 +224,8 @@ tp_connection_request_handles (TpConnection *self,
* @callback will later be called with the attributes of those of the given
* handles that were valid. Invalid handles are simply omitted from the
* parameter to the callback.
+ *
+ * Deprecated: Use tp_client_factory_ensure_contact() instead.
*/
void
tp_connection_get_contact_attributes (TpConnection *self,
@@ -276,6 +284,8 @@ tp_connection_get_contact_attributes (TpConnection *self,
*
* The #TpContact API provides a higher-level abstraction which should
* usually be used instead.
+ *
+ * Deprecated: Use tp_connection_dup_contact_list() instead.
*/
void
tp_connection_get_contact_list_attributes (TpConnection *self,
diff --git a/telepathy-glib/connection.h b/telepathy-glib/connection.h
index 18195d77b..e5db572ba 100644
--- a/telepathy-glib/connection.h
+++ b/telepathy-glib/connection.h
@@ -206,15 +206,18 @@ GQuark tp_connection_get_feature_quark_contact_info (void) G_GNUC_CONST;
/* connection-handles.c */
+#ifndef TP_DISABLE_DEPRECATED
typedef void (*TpConnectionRequestHandlesCb) (TpConnection *connection,
TpHandleType handle_type,
guint n_handles, const TpHandle *handles, const gchar * const *ids,
const GError *error, gpointer user_data, GObject *weak_object);
+_TP_DEPRECATED_IN_UNRELEASED
void tp_connection_request_handles (TpConnection *self, gint timeout_ms,
TpHandleType handle_type, const gchar * const *ids,
TpConnectionRequestHandlesCb callback,
gpointer user_data, GDestroyNotify destroy, GObject *weak_object);
+#endif
/* connection-avatars.c */
diff --git a/telepathy-glib/contact.c b/telepathy-glib/contact.c
index 42ffa9369..541b14a24 100644
--- a/telepathy-glib/contact.c
+++ b/telepathy-glib/contact.c
@@ -3491,9 +3491,8 @@ contacts_get_attributes (ContactsContext *context)
/* The Hold parameter is only true if we started from handles, and we don't
* already have all the contacts we need. */
context->refcount++;
- tp_connection_get_contact_attributes (context->connection, -1,
- context->handles->len, (const TpHandle *) context->handles->data,
- supported_interfaces,
+ tp_cli_connection_interface_contacts_call_get_contact_attributes (
+ context->connection, -1, context->handles, supported_interfaces,
contacts_got_attributes,
context, contacts_context_unref, context->weak_object);
g_free (supported_interfaces);
@@ -3804,11 +3803,13 @@ contacts_request_one_handle (ContactsContext *c)
ids[0] = g_ptr_array_index (c->request_ids, c->next_index);
g_assert (ids[0] != NULL);
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
c->refcount++;
tp_connection_request_handles (c->connection, -1,
TP_HANDLE_TYPE_CONTACT, ids,
contacts_requested_one_handle, c, contacts_context_unref,
c->weak_object);
+ G_GNUC_END_IGNORE_DEPRECATIONS
}
@@ -3936,12 +3937,14 @@ tp_connection_get_contacts_by_id (TpConnection *self,
g_ptr_array_add (context->request_ids, NULL);
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/* but first, we need to get the handles in the first place */
tp_connection_request_handles (self, -1,
TP_HANDLE_TYPE_CONTACT,
(const gchar * const *) context->request_ids->pdata,
contacts_requested_handles, context, contacts_context_unref,
weak_object);
+ G_GNUC_END_IGNORE_DEPRECATIONS
}
typedef struct
diff --git a/telepathy-glib/contacts-mixin.c b/telepathy-glib/contacts-mixin.c
index 3dacef0ea..c154271c7 100644
--- a/telepathy-glib/contacts-mixin.c
+++ b/telepathy-glib/contacts-mixin.c
@@ -329,10 +329,6 @@ tp_contacts_mixin_get_contact_attributes (GObject *obj,
}
}
- /* ensure the handles don't disappear while calling out to various functions
- */
- tp_handles_ref (contact_repo, valid_handles);
-
for (i = 0; assumed_interfaces != NULL && assumed_interfaces[i] != NULL; i++)
{
func = g_hash_table_lookup (self->priv->interfaces, assumed_interfaces[i]);
@@ -355,7 +351,6 @@ tp_contacts_mixin_get_contact_attributes (GObject *obj,
func (obj, valid_handles, result);
}
- tp_handles_unref (contact_repo, valid_handles);
g_array_unref (valid_handles);
return result;
diff --git a/telepathy-glib/group-mixin.c b/telepathy-glib/group-mixin.c
index 10ce2cb86..7c856155e 100644
--- a/telepathy-glib/group-mixin.c
+++ b/telepathy-glib/group-mixin.c
@@ -127,7 +127,7 @@ local_pending_info_new (TpHandleRepoIface *repo,
info->repo = repo;
if (actor != 0)
- info->actor = tp_handle_ref (repo, actor);
+ info->actor = actor;
return info;
}
@@ -136,10 +136,6 @@ static void
local_pending_info_free (LocalPendingInfo *info)
{
g_free ((gchar *) info->message);
-
- if (info->actor != 0)
- tp_handle_unref (info->repo, info->actor);
-
g_slice_free (LocalPendingInfo, info);
}
@@ -332,7 +328,7 @@ tp_group_mixin_init (GObject *obj,
mixin->handle_repo = handle_repo;
if (self_handle != 0)
- mixin->self_handle = tp_handle_ref (handle_repo, self_handle);
+ mixin->self_handle = self_handle;
mixin->members = tp_handle_set_new (handle_repo);
mixin->local_pending = tp_handle_set_new (handle_repo);
@@ -366,19 +362,6 @@ tp_group_mixin_remove_external (GObject *obj, GObject *external)
g_ptr_array_remove_fast (mixin->priv->externals, external);
}
-static void
-handle_owners_foreach_unref (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- TpGroupMixin *mixin = user_data;
-
- tp_handle_unref (mixin->handle_repo, GPOINTER_TO_UINT (key));
-
- if (GPOINTER_TO_UINT (value) != 0)
- tp_handle_unref (mixin->handle_repo, GPOINTER_TO_UINT (value));
-}
-
/**
* tp_group_mixin_finalize: (skip)
* @obj: An object implementing the group interface using this mixin
@@ -392,10 +375,6 @@ tp_group_mixin_finalize (GObject *obj)
tp_handle_set_destroy (mixin->priv->actors);
- g_hash_table_foreach (mixin->priv->handle_owners,
- handle_owners_foreach_unref,
- mixin);
-
g_hash_table_unref (mixin->priv->handle_owners);
g_hash_table_unref (mixin->priv->local_pending_info);
@@ -404,9 +383,6 @@ tp_group_mixin_finalize (GObject *obj)
g_slice_free (TpGroupMixinPrivate, mixin->priv);
- if (mixin->self_handle != 0)
- tp_handle_unref (mixin->handle_repo, mixin->self_handle);
-
tp_handle_set_destroy (mixin->members);
tp_handle_set_destroy (mixin->local_pending);
tp_handle_set_destroy (mixin->remote_pending);
@@ -457,23 +433,15 @@ tp_group_mixin_change_self_handle (GObject *obj,
TpHandle new_self_handle)
{
TpGroupMixin *mixin = TP_GROUP_MIXIN (obj);
- TpHandle old_self_handle = mixin->self_handle;
const gchar *new_self_id = tp_handle_inspect (mixin->handle_repo,
new_self_handle);
DEBUG ("%u '%s'", new_self_handle, new_self_id);
- mixin->self_handle = 0;
-
- if (new_self_handle != 0)
- mixin->self_handle = tp_handle_ref (mixin->handle_repo,
- new_self_handle);
+ mixin->self_handle = new_self_handle;
tp_svc_channel_interface_group_emit_self_contact_changed (obj,
new_self_handle, new_self_id);
-
- if (old_self_handle != 0)
- tp_handle_unref (mixin->handle_repo, old_self_handle);
}
@@ -1447,8 +1415,6 @@ change_members (GObject *obj,
}
}
- tp_handles_unref (mixin->handle_repo, arr_owners_removed);
-
g_hash_table_unref (empty_hash_table);
}
@@ -1634,28 +1600,10 @@ add_handle_owners_helper (gpointer key,
gpointer user_data)
{
TpHandle local_handle = GPOINTER_TO_UINT (key);
- TpHandle owner_handle = GPOINTER_TO_UINT (value);
TpGroupMixin *mixin = user_data;
- gpointer orig_key, orig_value;
g_return_if_fail (local_handle != 0);
- tp_handle_ref (mixin->handle_repo, local_handle);
-
- if (owner_handle != 0)
- tp_handle_ref (mixin->handle_repo, owner_handle);
-
- if (g_hash_table_lookup_extended (mixin->priv->handle_owners, key,
- &orig_key, &orig_value))
- {
- /* no need to actually remove - we're about to overwrite them anyway */
-
- tp_handle_unref (mixin->handle_repo, local_handle);
-
- if (GPOINTER_TO_UINT (orig_value) != 0)
- tp_handle_unref (mixin->handle_repo, GPOINTER_TO_UINT (orig_value));
- }
-
g_hash_table_insert (mixin->priv->handle_owners, key, value);
}
@@ -1726,12 +1674,6 @@ remove_handle_owners_if_exist (GObject *obj,
{
g_assert (GPOINTER_TO_UINT (local_handle) == handle);
g_array_append_val (ret, handle);
- /* don't unref local_handle - ownership is transferred to ret */
-
- if (GPOINTER_TO_UINT (owner_handle) != 0)
- tp_handle_unref (mixin->handle_repo,
- GPOINTER_TO_UINT (owner_handle));
-
g_hash_table_remove (priv->handle_owners, GUINT_TO_POINTER (handle));
}
}
diff --git a/telepathy-glib/handle-repo.c b/telepathy-glib/handle-repo.c
index bae82be9b..5fc49bd46 100644
--- a/telepathy-glib/handle-repo.c
+++ b/telepathy-glib/handle-repo.c
@@ -141,6 +141,7 @@ tp_handles_are_valid (TpHandleRepoIface *self,
* this function didn't return anything.
*
* Returns: the same @handle
+ * Deprecated: This is no-op so can be safely removed.
*/
TpHandle
@@ -158,6 +159,8 @@ tp_handle_ref (TpHandleRepoIface *self G_GNUC_UNUSED,
*
* Do nothing. Since version 0.13.8, handles always last as long as
* the connection; previously, this function provided refcounting for handles.
+ *
+ * Deprecated: This is no-op so can be safely removed.
*/
void
tp_handles_ref (TpHandleRepoIface *self G_GNUC_UNUSED,
@@ -173,6 +176,8 @@ tp_handles_ref (TpHandleRepoIface *self G_GNUC_UNUSED,
*
* Do nothing. Since version 0.13.8, handles always last as long as
* the connection; previously, this function provided refcounting for handles.
+ *
+ * Deprecated: This is no-op so can be safely removed.
*/
void
@@ -189,6 +194,8 @@ tp_handle_unref (TpHandleRepoIface *self G_GNUC_UNUSED,
*
* Do nothing. Since version 0.13.8, handles always last as long as
* the connection; previously, this function provided refcounting for handles.
+ *
+ * Deprecated: This is no-op so can be safely removed.
*/
void
tp_handles_unref (TpHandleRepoIface *self G_GNUC_UNUSED,
@@ -208,6 +215,7 @@ tp_handles_unref (TpHandleRepoIface *self G_GNUC_UNUSED,
* the connection; previously, this function provided refcounting for handles.
*
* Returns: %TRUE
+ * Deprecated: This is no-op so can be safely removed.
*/
gboolean
@@ -234,6 +242,7 @@ typedef gboolean (*HoldReleaseFunc) (TpHandleRepoIface *, const gchar *,
* the connection; previously, this function provided refcounting for handles.
*
* Returns: %TRUE
+ * Deprecated: This is no-op so can be safely removed.
*/
gboolean
tp_handles_client_hold (TpHandleRepoIface *self G_GNUC_UNUSED,
@@ -256,6 +265,7 @@ tp_handles_client_hold (TpHandleRepoIface *self G_GNUC_UNUSED,
* the connection; previously, this function provided refcounting for handles.
*
* Returns: %TRUE
+ * Deprecated: This is no-op so can be safely removed.
*/
gboolean
tp_handle_client_release (TpHandleRepoIface *self G_GNUC_UNUSED,
@@ -277,6 +287,7 @@ tp_handle_client_release (TpHandleRepoIface *self G_GNUC_UNUSED,
* the connection; previously, this function provided refcounting for handles.
*
* Returns: %TRUE
+ * Deprecated: This is no-op so can be safely removed.
*/
gboolean
tp_handles_client_release (TpHandleRepoIface *self G_GNUC_UNUSED,
diff --git a/telepathy-glib/handle-repo.h b/telepathy-glib/handle-repo.h
index 2b02cee56..cfe58e4e7 100644
--- a/telepathy-glib/handle-repo.h
+++ b/telepathy-glib/handle-repo.h
@@ -79,19 +79,29 @@ gboolean tp_handle_is_valid (TpHandleRepoIface *self,
gboolean tp_handles_are_valid (TpHandleRepoIface *self,
const GArray *handles, gboolean allow_zero, GError **error);
+#ifndef TP_DISABLE_DEPRECATED
+_TP_DEPRECATED_IN_UNRELEASED
TpHandle tp_handle_ref (TpHandleRepoIface *self, TpHandle handle);
+_TP_DEPRECATED_IN_UNRELEASED
void tp_handles_ref (TpHandleRepoIface *self, const GArray *handles);
+_TP_DEPRECATED_IN_UNRELEASED
void tp_handle_unref (TpHandleRepoIface *self, TpHandle handle);
+_TP_DEPRECATED_IN_UNRELEASED
void tp_handles_unref (TpHandleRepoIface *self, const GArray *handles);
+_TP_DEPRECATED_IN_UNRELEASED
gboolean tp_handle_client_hold (TpHandleRepoIface *self,
const gchar *client, TpHandle handle, GError **error);
+_TP_DEPRECATED_IN_UNRELEASED
gboolean tp_handles_client_hold (TpHandleRepoIface *self,
const gchar *client, const GArray *handles, GError **error);
+_TP_DEPRECATED_IN_UNRELEASED
gboolean tp_handle_client_release (TpHandleRepoIface *self,
const gchar *client, TpHandle handle, GError **error);
+_TP_DEPRECATED_IN_UNRELEASED
gboolean tp_handles_client_release (TpHandleRepoIface *self,
const gchar *client, const GArray *handles, GError **error);
+#endif
const char *tp_handle_inspect (TpHandleRepoIface *self,
TpHandle handle) G_GNUC_WARN_UNUSED_RESULT;
diff --git a/telepathy-glib/handle-set.c b/telepathy-glib/handle-set.c
index ef4011225..d11f1d363 100644
--- a/telepathy-glib/handle-set.c
+++ b/telepathy-glib/handle-set.c
@@ -181,11 +181,7 @@ tp_handle_set_add (TpHandleSet *set, TpHandle handle)
g_return_if_fail (set != NULL);
g_return_if_fail (handle != 0);
- if (!tp_intset_is_member (set->intset, handle))
- {
- tp_intset_add (set->intset,
- tp_handle_ref (set->repo, handle));
- }
+ tp_intset_add (set->intset, handle);
}
/**
@@ -205,14 +201,7 @@ tp_handle_set_remove (TpHandleSet *set, TpHandle handle)
g_return_val_if_fail (set != NULL, FALSE);
g_return_val_if_fail (handle != 0, FALSE);
- if (tp_intset_is_member (set->intset, handle))
- {
- tp_handle_unref (set->repo, handle);
- tp_intset_remove (set->intset, handle);
- return TRUE;
- }
-
- return FALSE;
+ return tp_intset_remove (set->intset, handle);
}
/**
@@ -346,13 +335,6 @@ tp_handle_set_to_identifier_map (
return map;
}
-static void
-ref_one (guint handle, gpointer data)
-{
- TpHandleSet *set = (TpHandleSet *) data;
- tp_handle_ref (set->repo, handle);
-}
-
/**
* tp_handle_set_copy: (skip)
* @other: another handle set
@@ -417,7 +399,6 @@ tp_handle_set_new_from_intset (TpHandleRepoIface *repo,
set = g_slice_new0 (TpHandleSet);
set->repo = repo;
set->intset = tp_intset_copy (intset);
- tp_intset_foreach (set->intset, ref_one, set);
return set;
}
@@ -441,7 +422,6 @@ tp_handle_set_update (TpHandleSet *set, const TpIntset *add)
/* reference each of ADD - CURRENT */
ret = tp_intset_difference (add, set->intset);
- tp_intset_foreach (ret, ref_one, set);
/* update CURRENT to be the union of CURRENT and ADD */
tmp = tp_intset_union (add, set->intset);
@@ -451,13 +431,6 @@ tp_handle_set_update (TpHandleSet *set, const TpIntset *add)
return ret;
}
-static void
-unref_one (guint handle, gpointer data)
-{
- TpHandleSet *set = (TpHandleSet *) data;
- tp_handle_unref (set->repo, handle);
-}
-
/**
* tp_handle_set_difference_update: (skip)
* @set: a #TpHandleSet to update
@@ -485,7 +458,6 @@ tp_handle_set_difference_update (TpHandleSet *set, const TpIntset *remove)
/* dereference each of REMOVE n CURRENT */
ret = tp_intset_intersection (remove, set->intset);
- tp_intset_foreach (ret, unref_one, set);
/* update CURRENT to be CURRENT - REMOVE */
tmp = tp_intset_difference (set->intset, remove);
diff --git a/tests/dbus/message-mixin.c b/tests/dbus/message-mixin.c
index f989cf8c2..d862b2f2f 100644
--- a/tests/dbus/message-mixin.c
+++ b/tests/dbus/message-mixin.c
@@ -216,31 +216,30 @@ main (int argc,
g_hash_table_unref (properties);
}
- handle = tp_tests_connection_run_request_contact_handle (conn,
- "them@example.com");
-
{
GHashTable *request = tp_asv_new (
TP_PROP_CHANNEL_CHANNEL_TYPE,
G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_TEXT,
TP_PROP_CHANNEL_TARGET_HANDLE_TYPE,
G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT,
- TP_PROP_CHANNEL_TARGET_HANDLE, G_TYPE_UINT, handle,
+ TP_PROP_CHANNEL_TARGET_ID, G_TYPE_STRING, "them@example.com",
NULL);
tp_cli_connection_interface_requests_run_create_channel (conn, -1,
- request, &chan_path, NULL, &error, NULL);
+ request, &chan_path, &parameters, &error, NULL);
g_assert_no_error (error);
g_hash_table_unref (request);
}
- chan = tp_channel_new (conn, chan_path, TP_IFACE_CHANNEL_TYPE_TEXT,
- TP_HANDLE_TYPE_CONTACT, handle, &error);
+ chan = tp_channel_new_from_properties (conn, chan_path, parameters, &error);
g_assert_no_error (error);
+ g_hash_table_unref (parameters);
tp_tests_proxy_run_until_prepared (chan, NULL);
+ handle = tp_channel_get_handle (chan, NULL);
+
MYASSERT (
tp_cli_channel_type_text_connect_to_message_received (chan,
on_message_received, NULL, NULL, NULL, NULL) != NULL, "");
diff --git a/tests/lib/contact-list-manager.c b/tests/lib/contact-list-manager.c
index b3ad79de3..f3188abd3 100644
--- a/tests/lib/contact-list-manager.c
+++ b/tests/lib/contact-list-manager.c
@@ -61,7 +61,6 @@ contact_detail_destroy (gpointer p)
g_free (d->publish_request);
g_hash_table_unref (d->groups);
- tp_handle_unref (d->contact_repo, d->handle);
g_slice_free (ContactDetails, d);
}
@@ -89,7 +88,6 @@ ensure_contact (TpTestsContactListManager *self,
d->groups = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
d->handle = handle;
d->contact_repo = self->priv->contact_repo;
- tp_handle_ref (d->contact_repo, d->handle);
g_hash_table_insert (self->priv->contact_details,
GUINT_TO_POINTER (handle), d);
diff --git a/tests/lib/simple-conn.c b/tests/lib/simple-conn.c
index e74c13435..30829143e 100644
--- a/tests/lib/simple-conn.c
+++ b/tests/lib/simple-conn.c
@@ -311,7 +311,6 @@ tp_tests_simple_connection_set_identifier (TpTestsSimpleConnection *self,
g_return_if_fail (handle != 0);
tp_base_connection_set_self_handle (conn, handle);
- tp_handle_unref (contact_repo, handle);
}
TpTestsSimpleConnection *
@@ -368,8 +367,6 @@ tp_tests_simple_connection_ensure_text_chan (TpTestsSimpleConnection *self,
chan);
}
- tp_handle_unref (contact_repo, handle);
-
if (props != NULL)
*props = tp_tests_text_channel_get_props (chan);
diff --git a/tests/lib/textchan-null.c b/tests/lib/textchan-null.c
index 52349b098..4a64f9a65 100644
--- a/tests/lib/textchan-null.c
+++ b/tests/lib/textchan-null.c
@@ -103,8 +103,6 @@ constructor (GType type,
G_OBJECT_CLASS (tp_tests_text_channel_null_parent_class)->constructor (type,
n_props, props);
TpTestsTextChannelNull *self = TP_TESTS_TEXT_CHANNEL_NULL (object);
- TpHandleRepoIface *contact_repo = tp_base_connection_get_handles
- (self->priv->conn, TP_HANDLE_TYPE_CONTACT);
const TpChannelTextMessageType types[] = {
TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL,
TP_CHANNEL_TEXT_MESSAGE_TYPE_ACTION,
@@ -115,8 +113,6 @@ constructor (GType type,
NULL
};
- tp_handle_ref (contact_repo, self->priv->handle);
-
tp_dbus_daemon_register_object (
tp_base_connection_get_dbus_daemon (self->priv->conn),
self->priv->object_path, self);
@@ -254,10 +250,7 @@ static void
finalize (GObject *object)
{
TpTestsTextChannelNull *self = TP_TESTS_TEXT_CHANNEL_NULL (object);
- TpHandleRepoIface *contact_handles = tp_base_connection_get_handles
- (self->priv->conn, TP_HANDLE_TYPE_CONTACT);
- tp_handle_unref (contact_handles, self->priv->handle);
g_free (self->priv->object_path);
tp_message_mixin_finalize (object);
diff --git a/tests/lib/util.c b/tests/lib/util.c
index 0a08442fe..db90649ed 100644
--- a/tests/lib/util.c
+++ b/tests/lib/util.c
@@ -118,50 +118,6 @@ tp_tests_proxy_run_until_dbus_queue_processed (gpointer proxy)
g_main_loop_unref (loop);
}
-typedef struct {
- GMainLoop *loop;
- TpHandle handle;
-} HandleRequestResult;
-
-static void
-handles_requested_cb (TpConnection *connection G_GNUC_UNUSED,
- TpHandleType handle_type G_GNUC_UNUSED,
- guint n_handles,
- const TpHandle *handles,
- const gchar * const *ids G_GNUC_UNUSED,
- const GError *error,
- gpointer user_data,
- GObject *weak_object G_GNUC_UNUSED)
-{
- HandleRequestResult *result = user_data;
-
- g_assert_no_error ((GError *) error);
- g_assert_cmpuint (n_handles, ==, 1);
- result->handle = handles[0];
-}
-
-static void
-handle_request_result_finish (gpointer r)
-{
- HandleRequestResult *result = r;
-
- g_main_loop_quit (result->loop);
-}
-
-TpHandle
-tp_tests_connection_run_request_contact_handle (TpConnection *connection,
- const gchar *id)
-{
- HandleRequestResult result = { g_main_loop_new (NULL, FALSE), 0 };
- const gchar * const ids[] = { id, NULL };
-
- tp_connection_request_handles (connection, -1, TP_HANDLE_TYPE_CONTACT, ids,
- handles_requested_cb, &result, handle_request_result_finish, NULL);
- g_main_loop_run (result.loop);
- g_main_loop_unref (result.loop);
- return result.handle;
-}
-
void
_test_assert_empty_strv (const char *file,
int line,
diff --git a/tests/lib/util.h b/tests/lib/util.h
index 745c08c77..454d99dde 100644
--- a/tests/lib/util.h
+++ b/tests/lib/util.h
@@ -18,10 +18,6 @@ TpDBusDaemon *tp_tests_dbus_daemon_dup_or_die (void);
void tp_tests_proxy_run_until_dbus_queue_processed (gpointer proxy);
-TpHandle tp_tests_connection_run_request_contact_handle (
- TpConnection *connection,
- const gchar *id);
-
void tp_tests_proxy_run_until_prepared (gpointer proxy,
const GQuark *features);
gboolean tp_tests_proxy_run_until_prepared_or_failed (gpointer proxy,