[Telepathy-commits] [telepathy-salut/master] ImManager: report request failure for nonexistant users

Will Thompson will.thompson at collabora.co.uk
Thu Oct 23 07:30:39 PDT 2008


---
 src/salut-im-manager.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/salut-im-manager.c b/src/salut-im-manager.c
index 16f244e..121ee31 100644
--- a/src/salut-im-manager.c
+++ b/src/salut-im-manager.c
@@ -419,13 +419,20 @@ salut_im_manager_new_channel (SalutImManager *mgr,
 
   g_assert (g_hash_table_lookup (priv->channels, GUINT_TO_POINTER (handle))
       == NULL);
-  DEBUG ("Requested channel for handle: %u", handle);
+
+  name = tp_handle_inspect (handle_repo, handle);
+  DEBUG ("Requested channel for handle: %u (%s)", handle, name);
 
   contact = salut_contact_manager_get_contact (priv->contact_manager, handle);
   if (contact == NULL)
-    return NULL;
+    {
+      gchar *message = g_strdup_printf ("%s is not online", name);
+      salut_channel_manager_emit_request_failed (mgr, request, TP_ERRORS,
+          TP_ERROR_NOT_AVAILABLE, message);
+      g_free (message);
+      return NULL;
+    }
 
-  name = tp_handle_inspect (handle_repo, handle);
   path = g_strdup_printf ("%s/IMChannel/%u",
       base_connection->object_path, handle);
   chan = g_object_new (SALUT_TYPE_IM_CHANNEL,
-- 
1.5.6.5




More information about the Telepathy-commits mailing list