aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2010-11-17 22:29:01 +0800
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2010-11-17 22:29:01 +0800
commit479275712b6f5984d58728d28d9bad99c94108cf (patch)
tree75c279e79e7d3c4f47a27e8176856bafb068df54 /libempathy
parenta631e25e2ec0d4fdf0f526a38df6171a6a6b26bd (diff)
parentde93254a7b91ea0620a4b6ae1c5cad2d922add91 (diff)
downloadgsoc2013-empathy-479275712b6f5984d58728d28d9bad99c94108cf.tar
gsoc2013-empathy-479275712b6f5984d58728d28d9bad99c94108cf.tar.gz
gsoc2013-empathy-479275712b6f5984d58728d28d9bad99c94108cf.tar.bz2
gsoc2013-empathy-479275712b6f5984d58728d28d9bad99c94108cf.tar.lz
gsoc2013-empathy-479275712b6f5984d58728d28d9bad99c94108cf.tar.xz
gsoc2013-empathy-479275712b6f5984d58728d28d9bad99c94108cf.tar.zst
gsoc2013-empathy-479275712b6f5984d58728d28d9bad99c94108cf.zip
Merge branch 'bug-547658'
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-contact.c52
-rw-r--r--libempathy/empathy-contact.h1
-rw-r--r--libempathy/empathy-tp-contact-factory.c1
3 files changed, 53 insertions, 1 deletions
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c
index 4db37f693..5383187c1 100644
--- a/libempathy/empathy-contact.c
+++ b/libempathy/empathy-contact.c
@@ -70,6 +70,7 @@ typedef struct {
*/
GHashTable *location;
GHashTable *groups;
+ gchar **client_types;
} EmpathyContactPriv;
static void contact_finalize (GObject *object);
@@ -85,6 +86,9 @@ static void update_geocode (EmpathyContact *contact);
static void empathy_contact_set_location (EmpathyContact *contact,
GHashTable *location);
+static void contact_set_client_types (EmpathyContact *contact,
+ const gchar * const *types);
+
static void set_capabilities_from_tp_caps (EmpathyContact *self,
TpCapabilities *caps);
@@ -110,7 +114,8 @@ enum
PROP_HANDLE,
PROP_CAPABILITIES,
PROP_IS_USER,
- PROP_LOCATION
+ PROP_LOCATION,
+ PROP_CLIENT_TYPES
};
enum {
@@ -163,6 +168,11 @@ tp_contact_notify_cb (TpContact *tp_contact,
{
contact_set_avatar_from_tp_contact (EMPATHY_CONTACT (contact));
}
+ else if (!tp_strdiff (param->name, "client-types"))
+ {
+ contact_set_client_types (EMPATHY_CONTACT (contact),
+ tp_contact_get_client_types (tp_contact));
+ }
}
static void
@@ -223,6 +233,7 @@ contact_constructed (GObject *object)
GHashTable *location;
TpHandle self_handle;
TpHandle handle;
+ const gchar * const *client_types;
if (priv->tp_contact == NULL)
return;
@@ -233,6 +244,10 @@ contact_constructed (GObject *object)
if (location != NULL)
empathy_contact_set_location (contact, location);
+ client_types = tp_contact_get_client_types (priv->tp_contact);
+ if (client_types != NULL)
+ contact_set_client_types (contact, client_types);
+
set_capabilities_from_tp_caps (contact,
tp_contact_get_capabilities (priv->tp_contact));
@@ -365,6 +380,14 @@ empathy_contact_class_init (EmpathyContactClass *class)
G_TYPE_HASH_TABLE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (object_class,
+ PROP_CLIENT_TYPES,
+ g_param_spec_boxed ("client-types",
+ "Contact client types",
+ "Client types of the contact",
+ G_TYPE_STRV,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
signals[PRESENCE_CHANGED] =
g_signal_new ("presence-changed",
G_TYPE_FROM_CLASS (class),
@@ -388,6 +411,7 @@ empathy_contact_init (EmpathyContact *contact)
contact->priv = priv;
priv->location = NULL;
+ priv->client_types = NULL;
priv->groups = NULL;
}
@@ -404,6 +428,7 @@ contact_finalize (GObject *object)
g_hash_table_destroy (priv->groups);
g_free (priv->alias);
g_free (priv->id);
+ g_strfreev (priv->client_types);
G_OBJECT_CLASS (empathy_contact_parent_class)->finalize (object);
}
@@ -1396,6 +1421,31 @@ empathy_contact_set_location (EmpathyContact *contact,
g_object_notify (G_OBJECT (contact), "location");
}
+const gchar * const *
+empathy_contact_get_client_types (EmpathyContact *contact)
+{
+ EmpathyContactPriv *priv;
+
+ g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
+
+ priv = GET_PRIV (contact);
+
+ return (const gchar * const *) priv->client_types;
+}
+
+static void
+contact_set_client_types (EmpathyContact *contact,
+ const gchar * const *client_types)
+{
+ EmpathyContactPriv *priv = GET_PRIV (contact);
+
+ if (priv->client_types != NULL)
+ g_strfreev (priv->client_types);
+
+ priv->client_types = g_strdupv ((gchar **) client_types);
+ g_object_notify (G_OBJECT (contact), "client-types");
+}
+
/**
* empathy_contact_equal:
* @contact1: an #EmpathyContact
diff --git a/libempathy/empathy-contact.h b/libempathy/empathy-contact.h
index 005cf1e7a..f9217c108 100644
--- a/libempathy/empathy-contact.h
+++ b/libempathy/empathy-contact.h
@@ -125,6 +125,7 @@ gboolean empathy_avatar_save_to_file (EmpathyAvatar *avatar,
const gchar *filename, GError **error);
GHashTable * empathy_contact_get_location (EmpathyContact *contact);
+const gchar * const * empathy_contact_get_client_types (EmpathyContact *contact);
gboolean empathy_contact_equal (gconstpointer contact1,
gconstpointer contact2);
diff --git a/libempathy/empathy-tp-contact-factory.c b/libempathy/empathy-tp-contact-factory.c
index ff572cc43..87c65385e 100644
--- a/libempathy/empathy-tp-contact-factory.c
+++ b/libempathy/empathy-tp-contact-factory.c
@@ -31,6 +31,7 @@ static TpContactFeature contact_features[] = {
TP_CONTACT_FEATURE_PRESENCE,
TP_CONTACT_FEATURE_LOCATION,
TP_CONTACT_FEATURE_CAPABILITIES,
+ TP_CONTACT_FEATURE_CLIENT_TYPES,
};
typedef union {