From cfd345b897d9fbf5095446b4a7cd57047043be35 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Mon, 13 Jun 2011 20:32:09 +0200 Subject: [PATCH] export some internal functions of contact.c --- telepathy-glib/contact-internal.h | 13 ++++++++ telepathy-glib/contact.c | 59 +++++++++++++++++++++++++++++------- 2 files changed, 60 insertions(+), 12 deletions(-) diff --git a/telepathy-glib/contact-internal.h b/telepathy-glib/contact-internal.h index 394602b..4e0573e 100644 --- a/telepathy-glib/contact-internal.h +++ b/telepathy-glib/contact-internal.h @@ -28,6 +28,19 @@ TpContact *_tp_contact_new (TpConnection *connection, TpHandle handle, const gchar *identifier); +gboolean _tp_contact_set_attributes (TpContact *contact, + GHashTable *asv, + guint n_features, + const TpContactFeature *features, + GError **error); + +const gchar **_tp_contacts_bind_to_signals (TpConnection *connection, + guint n_features, + const TpContactFeature *features); + +void _tp_contact_set_subscription_states (TpContact *self, + GValueArray *value_array); + G_END_DECLS #endif diff --git a/telepathy-glib/contact.c b/telepathy-glib/contact.c index b2e30db..fb981f0 100644 --- a/telepathy-glib/contact.c +++ b/telepathy-glib/contact.c @@ -3291,6 +3291,20 @@ contact_set_subscription_states (TpContact *self, self->priv->subscribe, self->priv->publish, self->priv->publish_request); } +void +_tp_contact_set_subscription_states (TpContact *self, + GValueArray *value_array) +{ + TpSubscriptionState subscribe; + TpSubscriptionState publish; + const gchar *publish_request; + + tp_value_array_unpack (value_array, 3, + &subscribe, &publish, &publish_request); + + contact_set_subscription_states (self, subscribe, publish, publish_request); +} + static void contacts_changed_cb (TpConnection *connection, GHashTable *changes, @@ -3306,20 +3320,10 @@ contacts_changed_cb (TpConnection *connection, while (g_hash_table_iter_next (&iter, &key, &value)) { TpHandle handle = GPOINTER_TO_UINT (key); - GValueArray *value_array = value; TpContact *contact = _tp_connection_lookup_contact (connection, handle); - TpSubscriptionState subscribe; - TpSubscriptionState publish; - const gchar *publish_request; - - if (contact == NULL) - continue; - - tp_value_array_unpack (value_array, 3, - &subscribe, &publish, &publish_request); - contact_set_subscription_states (contact, subscribe, publish, - publish_request); + if (contact != NULL) + _tp_contact_set_subscription_states (contact, value); } for (i = 0; i < removals->len; i++) @@ -3704,6 +3708,24 @@ tp_contact_set_attributes (TpContact *contact, return TRUE; } +static gboolean get_feature_flags (guint n_features, + const TpContactFeature *features, ContactFeatureFlags *flags); + +gboolean +_tp_contact_set_attributes (TpContact *contact, + GHashTable *asv, + guint n_features, + const TpContactFeature *features, + GError **error) +{ + ContactFeatureFlags feature_flags = 0; + + if (!get_feature_flags (n_features, features, &feature_flags)) + return FALSE; + + return tp_contact_set_attributes (contact, asv, feature_flags, error); +} + static void contacts_got_attributes (TpConnection *connection, GHashTable *attributes, @@ -3892,6 +3914,19 @@ contacts_bind_to_signals (TpConnection *connection, return (const gchar **) g_ptr_array_free (array, FALSE); } +const gchar ** +_tp_contacts_bind_to_signals (TpConnection *connection, + guint n_features, + const TpContactFeature *features) +{ + ContactFeatureFlags feature_flags = 0; + + if (!get_feature_flags (n_features, features, &feature_flags)) + return NULL; + + return contacts_bind_to_signals (connection, feature_flags); +} + static void contacts_get_attributes (ContactsContext *context) { -- 1.7.4.1