diff options
author | Pierre-Luc Beaudoin <pierre-luc@pierlux.com> | 2008-12-03 06:29:38 +0800 |
---|---|---|
committer | Pierre-Luc Beaudoin <pierre-luc@pierlux.com> | 2009-05-08 01:37:02 +0800 |
commit | dedfd1e8315b0af219293f9fd470525bed1b52c8 (patch) | |
tree | 74da4fe8b2e0fa0676ba31132d79e8859618e9b4 /libempathy | |
parent | 14e396ae3e86222dc98f2f85faed0c005ba27c86 (diff) | |
download | gsoc2013-empathy-dedfd1e8315b0af219293f9fd470525bed1b52c8.tar gsoc2013-empathy-dedfd1e8315b0af219293f9fd470525bed1b52c8.tar.gz gsoc2013-empathy-dedfd1e8315b0af219293f9fd470525bed1b52c8.tar.bz2 gsoc2013-empathy-dedfd1e8315b0af219293f9fd470525bed1b52c8.tar.lz gsoc2013-empathy-dedfd1e8315b0af219293f9fd470525bed1b52c8.tar.xz gsoc2013-empathy-dedfd1e8315b0af219293f9fd470525bed1b52c8.tar.zst gsoc2013-empathy-dedfd1e8315b0af219293f9fd470525bed1b52c8.zip |
Set/get location on telepathy
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-tp-contact-factory.c | 49 | ||||
-rw-r--r-- | libempathy/empathy-tp-contact-factory.h | 3 |
2 files changed, 50 insertions, 2 deletions
diff --git a/libempathy/empathy-tp-contact-factory.c b/libempathy/empathy-tp-contact-factory.c index 7735b0f1a..3c43f5254 100644 --- a/libempathy/empathy-tp-contact-factory.c +++ b/libempathy/empathy-tp-contact-factory.c @@ -122,6 +122,17 @@ tp_contact_factory_set_aliases_cb (TpConnection *connection, } static void +tp_contact_factory_set_location_cb (TpProxy *proxy, + const GError *error, + gpointer user_data, + GObject *weak_object) +{ + if (error) { + DEBUG ("Error setting location: %s", error->message); + } +} + +static void tp_contact_factory_set_avatar_cb (TpConnection *connection, const gchar *token, const GError *error, @@ -410,6 +421,20 @@ tp_contact_factory_capabilities_changed_cb (TpConnection *connection, } static void +tp_contact_factory_location_updated_cb (TpProxy *proxy, + guint handle, + GHashTable *location, + gpointer user_data, + GObject *weak_object) +{ + EmpathyTpContactFactory *tp_factory = EMPATHY_TP_CONTACT_FACTORY (weak_object); + EmpathyContact *contact; + + contact = tp_contact_factory_find_by_handle (tp_factory, handle); + empathy_contact_set_location (contact, location); +} + +static void get_requestable_channel_classes_cb (TpProxy *connection, const GValue *value, const GError *error, @@ -943,6 +968,24 @@ empathy_tp_contact_factory_set_avatar (EmpathyTpContactFactory *tp_factory, } } +void +empathy_tp_contact_factory_set_location (EmpathyTpContactFactory *tp_factory, + GHashTable *location) +{ + EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory); + + g_return_if_fail (EMPATHY_IS_TP_CONTACT_FACTORY (tp_factory)); + + DEBUG ("Setting location"); + + emp_cli_connection_interface_location_call_set_location (TP_PROXY (priv->connection), + -1, + location, + tp_contact_factory_set_location_cb, + NULL, NULL, + G_OBJECT (tp_factory)); +} + static void tp_contact_factory_get_property (GObject *object, guint param_id, @@ -1047,7 +1090,11 @@ tp_contact_factory_constructor (GType type, NULL, NULL, tp_factory, NULL); - + emp_cli_connection_interface_location_connect_to_location_updated (TP_PROXY (priv->connection), + tp_contact_factory_location_updated_cb, + NULL, NULL, + G_OBJECT (tp_factory), + NULL); /* FIXME: This should be moved to TpConnection */ tp_cli_connection_interface_avatars_call_get_avatar_requirements (priv->connection, diff --git a/libempathy/empathy-tp-contact-factory.h b/libempathy/empathy-tp-contact-factory.h index 91ff2f9e7..ed11bf7e4 100644 --- a/libempathy/empathy-tp-contact-factory.h +++ b/libempathy/empathy-tp-contact-factory.h @@ -108,7 +108,8 @@ void empathy_tp_contact_factory_set_avatar (EmpathyTpC const gchar *data, gsize size, const gchar *mime_type); - +void empathy_tp_contact_factory_set_location (EmpathyTpContactFactory *tp_factory, + GHashTable *location); G_END_DECLS #endif /* __EMPATHY_TP_CONTACT_FACTORY_H__ */ |