[telepathy-gabble/master] search_channel_ready_or_not_cb: raise PermissionDenied if XMPP error is Forbidden and InvalidArgument if it's jid-malformed

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Tue Aug 25 06:04:09 PDT 2009


---
 src/search-manager.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/search-manager.c b/src/search-manager.c
index 6b657f6..9872f49 100644
--- a/src/search-manager.c
+++ b/src/search-manager.c
@@ -414,11 +414,18 @@ search_channel_ready_or_not_cb (GabbleSearchChannel *chan,
       if (domain == GABBLE_XMPP_ERROR)
         {
           domain = TP_ERRORS;
-          /* - Maybe CreateChannel should be specced to raise PermissionDenied?
-           *   Then we could map XMPP_ERROR_FORBIDDEN to that.
-           * - Should XMPP_ERROR_JID_MALFORMED be mapped to InvalidArgument?
-           */
-          code = TP_ERROR_NOT_AVAILABLE;
+
+          switch (code)
+            {
+            case XMPP_ERROR_FORBIDDEN:
+              code = TP_ERROR_PERMISSION_DENIED;
+              break;
+            case XMPP_ERROR_JID_MALFORMED:
+              code = TP_ERROR_INVALID_ARGUMENT;
+              break;
+            default:
+              code = TP_ERROR_NOT_AVAILABLE;
+            }
         }
       else
         {
-- 
1.5.6.5




More information about the telepathy-commits mailing list