IMAP: fix bug with obtaining wrong capabilities from Zimbra server
authorvitaly <vitaly>
Tue, 26 May 2009 14:22:09 +0000 (14:22 +0000)
committervitaly <vitaly>
Tue, 26 May 2009 14:22:09 +0000 (14:22 +0000)
Zimbra IMAP server returns only few basic capabilities
when client asks CAPABILITY before LOGIN. Wanderlust remembers
first capabilities answer and, thus, can't use all
extended features anymore.

Fix it by asking for capabilities also after login.

elmo/elmo-imap4.el

index c6fc344..7b2c66d 100644 (file)
@@ -974,17 +974,25 @@ If CHOP-LENGTH is not specified, message set is not chopped."
   (when (elmo-imap4-session-capable-p session 'logindisabled)
     (signal 'elmo-authenticate-error '(elmo-imap4-clear-login)))
   (let ((elmo-imap4-debug-inhibit-logging t))
-    (or
-     (elmo-imap4-read-ok
-      session
-      (elmo-imap4-send-command
+    (prog1
+       (or
+        (elmo-imap4-read-ok
+         session
+         (elmo-imap4-send-command
+          session
+          (list "login "
+                (elmo-imap4-userid (elmo-network-session-user-internal session))
+                " "
+                (elmo-imap4-password
+                 (elmo-get-passwd (elmo-network-session-password-key session))))))
+        (signal 'elmo-authenticate-error '(elmo-imap4-clear-login)))
+;; Fix for Zimbra
+;; Some servers return reduced capabilities when client asks for them before login
+      (elmo-imap4-session-set-capability-internal
        session
-       (list "login "
-            (elmo-imap4-userid (elmo-network-session-user-internal session))
-            " "
-            (elmo-imap4-password
-             (elmo-get-passwd (elmo-network-session-password-key session))))))
-     (signal 'elmo-authenticate-error '(elmo-imap4-clear-login)))))
+       (elmo-imap4-response-value
+       (elmo-imap4-send-command-wait session "capability")
+       'capability)))))
 
 (defun elmo-imap4-auth-login (session)
   (let ((tag (elmo-imap4-send-command session "authenticate login"))