[Telepathy-commits] [telepathy-glib/master] ContactsConnection: add support for setting our own presence

Simon McVittie simon.mcvittie at collabora.co.uk
Thu Jan 29 05:27:02 PST 2009


---
 tests/lib/contacts-conn.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/tests/lib/contacts-conn.c b/tests/lib/contacts-conn.c
index 37e59ce..b990e54 100644
--- a/tests/lib/contacts-conn.c
+++ b/tests/lib/contacts-conn.c
@@ -242,9 +242,22 @@ my_set_own_status (GObject *object,
                    const TpPresenceStatus *status,
                    GError **error)
 {
-  g_set_error (error, TP_ERRORS, TP_ERROR_NOT_IMPLEMENTED,
-      "Not implemented");
-  return FALSE;
+  TpBaseConnection *base_conn = TP_BASE_CONNECTION (object);
+  ContactsConnectionPresenceStatusIndex index = status->index;
+  const gchar *message = "";
+
+  if (status->optional_arguments != NULL)
+    {
+      message = g_hash_table_lookup (status->optional_arguments, "message");
+
+      if (message == NULL)
+        message = "";
+    }
+
+  contacts_connection_change_presences (CONTACTS_CONNECTION (object),
+      1, &(base_conn->self_handle), &index, &message);
+
+  return TRUE;
 }
 
 static void
-- 
1.5.6.5




More information about the telepathy-commits mailing list