Bug 20096

Summary: tp_connection_get_contacts_by_id handles TP_ERROR_INVALID_HANDLE as a fatal error
Product: Telepathy Reporter: Artem Garmash <artemgarmash>
Component: tp-glibAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
URL: http://git.collabora.co.uk/?p=user/smcv/telepathy-glib-smcv.git;a=shortlog;h=refs/heads/contacts
Whiteboard:
i915 platform: i915 features:

Description Artem Garmash 2009-02-13 01:50:38 UTC
RequestHandles returns InvalidHanlde when called with invalid handles according to the spec, but tp_connection_get_contacts_by_id checks for NotAvailable and InvalidArguments as non fatal errors in the contacts_requested_handles callback (http://git.collabora.co.uk/?p=telepathy-glib.git;a=blob;f=telepathy-glib/contact.c;hb=bc76737fa3455fcd0d3c93e9b2aaf1b14ae3a9c9#l2115).

TP_ERROR_INVALID_HANDLE should be added to the check as well.
Comment 1 Simon McVittie 2009-02-13 07:12:38 UTC
Well spotted, I'll prepare a patch.
Comment 2 Simon McVittie 2009-02-13 07:17:49 UTC
Fixed in a branch, awaiting review.

diff --git a/telepathy-glib/contact.c b/telepathy-glib/contact.c
index 7ddfc2e..dd1f346 100644 (file)
--- a/telepathy-glib/contact.c
+++ b/telepathy-glib/contact.c
@@ -894,7 +894,7 @@ contacts_context_fail (ContactsContext *c,
  * valid (it may be empty), and @failed_id_errors will map the IDs
  * that were not valid to a corresponding #GError (if the connection manager
  * complies with the Telepathy spec, it will have domain %TP_ERRORS and code
- * %TP_ERROR_NOT_AVAILABLE).
+ * %TP_ERROR_INVALID_HANDLE).
  *
  * If an unrecoverable error occurs (for instance, if @connection
  * becomes disconnected) the whole operation fails, and no contacts
@@ -2050,7 +2050,8 @@ contacts_requested_one_handle (TpConnection *connection,
       c->next_index++;
     }
   else if (error->domain == TP_ERRORS &&
-      (error->code == TP_ERROR_NOT_AVAILABLE ||
+      (error->code == TP_ERROR_INVALID_HANDLE ||
+       error->code == TP_ERROR_NOT_AVAILABLE ||
        error->code == TP_ERROR_INVALID_ARGUMENT))
     {
       g_hash_table_insert (c->request_errors,
@@ -2113,7 +2114,8 @@ contacts_requested_handles (TpConnection *connection,
         }
     }
   else if (error->domain == TP_ERRORS &&
-      (error->code == TP_ERROR_NOT_AVAILABLE ||
+      (error->code == TP_ERROR_INVALID_HANDLE ||
+       error->code == TP_ERROR_NOT_AVAILABLE ||
        error->code == TP_ERROR_INVALID_ARGUMENT))
     {
       /* One of the strings is bad. We don't know which, so split them. */
Comment 3 Simon McVittie 2009-02-16 09:57:07 UTC
Fixed in 0.7.26, although not mentioned in the NEWS file

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.