Bind RET and TAB on images for better UX.
[gnus] / lisp / sieve-manage.el
index 38fece2..0f16444 100644 (file)
@@ -1,7 +1,7 @@
 ;;; sieve-manage.el --- Implementation of the managesive protocol in elisp
 
 ;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-;;   2008  Free Software Foundation, Inc.
+;;   2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 
@@ -191,10 +191,10 @@ Valid states are `closed', `initial', `nonauth', and `auth'.")
 
 ;; Internal utility functions
 
-(defsubst sieve-manage-disable-multibyte ()
+(defmacro sieve-manage-disable-multibyte ()
   "Enable multibyte in the current buffer."
-  (when (fboundp 'set-buffer-multibyte)
-    (set-buffer-multibyte nil)))
+  (unless (featurep 'xemacs)
+    '(set-buffer-multibyte nil)))
 
 (declare-function password-read         "password-cache" (prompt &optional key))
 (declare-function password-cache-add    "password-cache" (key password))
@@ -304,15 +304,14 @@ Returns t if login was successful, nil otherwise."
       (when (memq (process-status process) '(open run))
        process))))
 
-(defun imap-starttls-p (buffer)
-  ;;  (and (imap-capability 'STARTTLS buffer)
+(defun sieve-manage-starttls-p (buffer)
   (condition-case ()
       (progn
        (require 'starttls)
        (call-process "starttls"))
     (error nil)))
 
-(defun imap-starttls-open (name buffer server port)
+(defun sieve-manage-starttls-open (name buffer server port)
   (let* ((port (or port sieve-manage-default-port))
         (coding-system-for-read sieve-manage-coding-system-for-read)
         (coding-system-for-write sieve-manage-coding-system-for-write)
@@ -336,7 +335,7 @@ Returns t if login was successful, nil otherwise."
 (defun sieve-sasl-auth (buffer mech)
   "Login to server using the SASL MECH method."
   (message "sieve: Authenticating using %s..." mech)
-  (if (sieve-manage-interactive-login 
+  (if (sieve-manage-interactive-login
        buffer
        (lambda (user passwd)
         (let (client step tag data rsp)
@@ -443,12 +442,12 @@ Returns t if login was successful, nil otherwise."
 
 (defun sieve-manage-open (server &optional port stream auth buffer)
   "Open a network connection to a managesieve SERVER (string).
-Optional variable PORT is port number (integer) on remote server.
-Optional variable STREAM is any of `sieve-manage-streams' (a symbol).
-Optional variable AUTH indicates authenticator to use, see
-`sieve-manage-authenticators' for available authenticators.  If nil, chooses
-the best stream the server is capable of.
-Optional variable BUFFER is buffer (buffer, or string naming buffer)
+Optional argument PORT is port number (integer) on remote server.
+Optional argument STREAM is any of `sieve-manage-streams' (a symbol).
+Optional argument AUTH indicates authenticator to use, see
+`sieve-manage-authenticators' for available authenticators.
+If nil, chooses the best stream the server is capable of.
+Optional argument BUFFER is buffer (buffer, or string naming buffer)
 to work in."
   (setq buffer (or buffer (format " *sieve* %s:%d" server (or port 2000))))
   (with-current-buffer (get-buffer-create buffer)
@@ -637,7 +636,7 @@ password is remembered in the buffer."
                  sieve-manage-capability))
        (push (list str) sieve-manage-capability))
       (forward-line)))
-  (when (re-search-forward (concat "^OK" sieve-manage-server-eol) nil t)
+  (when (re-search-forward (concat "^OK.*" sieve-manage-server-eol) nil t)
     (setq sieve-manage-state 'nonauth)))
 
 (defalias 'sieve-manage-parse-greeting-1 'sieve-manage-parse-capability-1)
@@ -647,7 +646,7 @@ password is remembered in the buffer."
         (prog1
             (match-string 1)
           (goto-char (match-end 0))))
-       ((looking-at (concat "{\\([0-9]+\\)}" sieve-manage-server-eol))
+       ((looking-at (concat "{\\([0-9]+\\+?\\)}" sieve-manage-server-eol))
         (let ((pos (match-end 0))
               (len (string-to-number (match-string 1))))
           (if (< (point-max) (+ pos len))
@@ -702,5 +701,4 @@ password is remembered in the buffer."
 
 (provide 'sieve-manage)
 
-;; arch-tag: 321c4640-1371-4495-9baf-8ccb71dd5bd1
 ;; sieve-manage.el ends here