From c488a4d19bd41043f25f92ee5391cc279a117fe9 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 7 May 2012 17:21:37 +0100 Subject: [PATCH 2/3] Use non-deprecated TpIntset APIs --- src/capability-set.c | 35 +++++++++++++++++++---------------- src/muc-channel.c | 20 ++++++++++---------- src/olpc-activity.c | 10 +++++----- 3 files changed, 34 insertions(+), 31 deletions(-) diff --git a/src/capability-set.c b/src/capability-set.c index fe6b730..bd2a7bb 100644 --- a/src/capability-set.c +++ b/src/capability-set.c @@ -426,7 +426,7 @@ void gabble_capability_set_update (GabbleCapabilitySet *target, const GabbleCapabilitySet *source) { - TpIntSet *ret; + TpIntset *ret; g_return_if_fail (target != NULL); g_return_if_fail (source != NULL); @@ -586,16 +586,17 @@ gboolean gabble_capability_set_has_one (const GabbleCapabilitySet *caps, const GabbleCapabilitySet *alternatives) { - TpIntSetIter iter; + TpIntsetFastIter iter; + guint element; g_return_val_if_fail (caps != NULL, FALSE); g_return_val_if_fail (alternatives != NULL, FALSE); - tp_intset_iter_init (&iter, tp_handle_set_peek (alternatives->handles)); + tp_intset_fast_iter_init (&iter, tp_handle_set_peek (alternatives->handles)); - while (tp_intset_iter_next (&iter)) + while (tp_intset_fast_iter_next (&iter, &element)) { - if (tp_handle_set_is_member (caps->handles, iter.element)) + if (tp_handle_set_is_member (caps->handles, element)) { return TRUE; } @@ -609,16 +610,17 @@ gboolean gabble_capability_set_at_least (const GabbleCapabilitySet *caps, const GabbleCapabilitySet *query) { - TpIntSetIter iter; + TpIntsetFastIter iter; + guint element; g_return_val_if_fail (caps != NULL, FALSE); g_return_val_if_fail (query != NULL, FALSE); - tp_intset_iter_init (&iter, tp_handle_set_peek (query->handles)); + tp_intset_fast_iter_init (&iter, tp_handle_set_peek (query->handles)); - while (tp_intset_iter_next (&iter)) + while (tp_intset_fast_iter_next (&iter, &element)) { - if (!tp_handle_set_is_member (caps->handles, iter.element)) + if (!tp_handle_set_is_member (caps->handles, element)) { return FALSE; } @@ -643,16 +645,17 @@ void gabble_capability_set_foreach (const GabbleCapabilitySet *caps, GFunc func, gpointer user_data) { - TpIntSetIter iter; + TpIntsetFastIter iter; + guint element; g_return_if_fail (caps != NULL); g_return_if_fail (func != NULL); - tp_intset_iter_init (&iter, tp_handle_set_peek (caps->handles)); + tp_intset_fast_iter_init (&iter, tp_handle_set_peek (caps->handles)); - while (tp_intset_iter_next (&iter)) + while (tp_intset_fast_iter_next (&iter, &element)) { - const gchar *var = tp_handle_inspect (feature_handles, iter.element); + const gchar *var = tp_handle_inspect (feature_handles, element); g_return_if_fail (var != NULL); @@ -663,10 +666,10 @@ gabble_capability_set_foreach (const GabbleCapabilitySet *caps, static void append_intset (GString *ret, - const TpIntSet *cap_ints, + const TpIntset *cap_ints, const gchar *indent) { - TpIntSetFastIter iter; + TpIntsetFastIter iter; guint element; tp_intset_fast_iter_init (&iter, cap_ints); @@ -712,7 +715,7 @@ gabble_capability_set_dump_diff (const GabbleCapabilitySet *old_caps, const GabbleCapabilitySet *new_caps, const gchar *indent) { - TpIntSet *old_ints, *new_ints, *rem, *add; + TpIntset *old_ints, *new_ints, *rem, *add; GString *ret; g_return_val_if_fail (old_caps != NULL, NULL); diff --git a/src/muc-channel.c b/src/muc-channel.c index 93caa55..38bf002 100644 --- a/src/muc-channel.c +++ b/src/muc-channel.c @@ -180,8 +180,8 @@ salut_muc_channel_add_self_to_members (SalutMucChannel *self) SalutMucChannelPrivate *priv = self->priv; TpBaseConnection *base_conn = tp_base_channel_get_connection ( TP_BASE_CHANNEL (self)); - TpIntSet *empty; - TpIntSet *add; + TpIntset *empty; + TpIntset *add; priv->connected = TRUE; g_signal_emit (self, signals[READY], 0); @@ -409,7 +409,7 @@ send_invite_cb (GObject *source_object, TP_BASE_CHANNEL (data->self)); GError *error = NULL; TpHandle handle; - TpIntSet *empty, *removed; + TpIntset *empty, *removed; if (wocky_porter_send_finish (porter, result, &error)) /* success */ @@ -492,13 +492,13 @@ salut_muc_channel_add_member (GObject *iface, SalutMucChannel *self = SALUT_MUC_CHANNEL (iface); TpBaseConnection *base_connection = tp_base_channel_get_connection ( TP_BASE_CHANNEL (self)); - TpIntSet *empty, *remote_pending; + TpIntset *empty, *remote_pending; if (handle == base_connection->self_handle) { /* adding yourself, let's join the muc */ - TpIntSet *empty_; - TpIntSet *add; + TpIntset *empty_; + TpIntset *add; gboolean ret = TRUE; if (tp_handle_set_is_member (self->group.remote_pending, @@ -792,8 +792,8 @@ salut_muc_channel_invited (SalutMucChannel *self, TpHandle inviter, } else { - TpIntSet *empty = tp_intset_new (); - TpIntSet *local_pending = tp_intset_new (); + TpIntset *empty = tp_intset_new (); + TpIntset *local_pending = tp_intset_new (); g_assert (stanza != NULL); @@ -836,7 +836,7 @@ salut_muc_channel_add_members (SalutMucChannel *self, SalutMucChannelPrivate *priv = self->priv; TpBaseConnection *base_conn = tp_base_channel_get_connection ( TP_BASE_CHANNEL (self)); - TpIntSet *empty, *changes; + TpIntset *empty, *changes; guint i; SalutContactManager *contact_mgr; @@ -881,7 +881,7 @@ salut_muc_channel_remove_members (SalutMucChannel *self, base_chan); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( base_connection, TP_HANDLE_TYPE_CONTACT); - TpIntSet *empty, *changes; + TpIntset *empty, *changes; guint i; empty = tp_intset_new (); diff --git a/src/olpc-activity.c b/src/olpc-activity.c index 333c884..df3f9b5 100644 --- a/src/olpc-activity.c +++ b/src/olpc-activity.c @@ -608,8 +608,8 @@ salut_olpc_activity_revoke_invitations (SalutOlpcActivity *self) (TpBaseConnection *) self->connection, TP_HANDLE_TYPE_CONTACT); TpHandleRepoIface *room_repo = tp_base_connection_get_handles ( (TpBaseConnection *) self->connection, TP_HANDLE_TYPE_CONTACT); - TpIntSetIter iter = TP_INTSET_ITER_INIT (tp_handle_set_peek ( - priv->invited)); + TpIntsetFastIter iter; + guint contact_handle; SalutContactManager *contact_mgr; WockyNode *top_node; @@ -632,14 +632,14 @@ salut_olpc_activity_revoke_invitations (SalutOlpcActivity *self) NULL); g_assert (contact_mgr != NULL); + tp_intset_fast_iter_init (&iter, tp_handle_set_peek (priv->invited)); + DEBUG ("revoke invitations for activity %s", self->id); - while (tp_intset_iter_next (&iter)) + while (tp_intset_fast_iter_next (&iter, &contact_handle)) { - TpHandle contact_handle; SalutContact *contact; const gchar *to; - contact_handle = iter.element; contact = salut_contact_manager_get_contact (contact_mgr, contact_handle); if (contact == NULL) { -- 1.7.10