[Telepathy-commits] [telepathy-doc/master] 2008-11-14 Murray Cumming <murrayc at murrayc.com>
Murray Cumming
murrayc at murrayc.com
Fri Nov 14 07:47:09 PST 2008
* docs/examples/list_contacts/main.c: Get other contact features,
to show aliases and presence.
---
ChangeLog | 5 +++++
docs/examples/list_contacts/main.c | 18 +++++++++++++-----
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f2b8da5..76904de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2008-11-14 Murray Cumming <murrayc at murrayc.com>
+ * docs/examples/list_contacts/main.c: Get other contact features,
+ to show aliases and presence.
+
+2008-11-14 Murray Cumming <murrayc at murrayc.com>
+
* docs/examples/list_contacts/main.c: Examine the actual contacts
handles as before rather than the handle for the list of contacts.
This now works.
diff --git a/docs/examples/list_contacts/main.c b/docs/examples/list_contacts/main.c
index 346f1c4..eb1a1e7 100644
--- a/docs/examples/list_contacts/main.c
+++ b/docs/examples/list_contacts/main.c
@@ -39,11 +39,14 @@ void disconnect ()
void show_contact_information (TpContact *contact)
{
- const gchar *identifier = tp_contact_get_identifier (contact);
- g_printf ("Contact: Identifier=%s\n", identifier);
+ g_printf ("Contact: Identifier=%s\n",
+ tp_contact_get_identifier (contact));
- const gchar *alias = tp_contact_get_alias (contact);
- g_printf (" Alias=%s\n", alias);
+ g_printf (" Alias=%s\n",
+ tp_contact_get_alias (contact));
+
+ g_printf (" Presence Status=%s\n",
+ tp_contact_get_presence_status (contact));
}
void on_connection_get_contacts_by_handle (TpConnection *connection,
@@ -204,9 +207,14 @@ void list_connection_contacts ()
guint n_handles = members_array->len;
TpHandle* handles = (TpHandle*)g_array_free (members_array, FALSE);
members_array = NULL;
+
+ /* The extra optional information that we are interested in: */
+ TpContactFeature features[] = {TP_CONTACT_FEATURE_ALIAS,
+ TP_CONTACT_FEATURE_AVATAR_TOKEN, TP_CONTACT_FEATURE_PRESENCE};
+
tp_connection_get_contacts_by_handle (connection,
n_handles, handles,
- 0 /* n_features */, NULL, /*features */
+ sizeof (features) / sizeof(TpContactFeature), features,
&on_connection_get_contacts_by_handle,
NULL, /* user_data */
NULL, /* destroy */
--
1.5.6.5
More information about the Telepathy-commits
mailing list