;;; sieve-manage.el --- Implementation of the managesieve protocol in elisp
-;; Copyright (C) 2001-2013 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2015 Free Software Foundation, Inc.
;; Author: Simon Josefsson <simon@josefsson.org>
;; Albert Krewinkel <tarleb@moltkeplatz.de>
;;; Code:
-;; For Emacs <22.2 and XEmacs.
-(eval-and-compile
- (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
-
(if (locate-library "password-cache")
(require 'password-cache)
(require 'password))
plain
login)
"Priority of authenticators to consider when authenticating to server."
+ ;; FIXME Improve this. It's not `set'.
+ ;; It's like (repeat (choice (const ...))), where each choice can
+ ;; only appear once.
+ :type '(repeat symbol)
:group 'sieve-manage)
(defcustom sieve-manage-authenticator-alist
NAME names the authenticator. CHECK is a function returning non-nil if
the server support the authenticator and AUTHENTICATE is a function
for doing the actual authentication."
+ :type '(repeat (list (symbol :tag "Name") (function :tag "Check function")
+ (function :tag "Authentication function")))
:group 'sieve-manage)
(defcustom sieve-manage-default-port "sieve"
(defvar sieve-manage-capability nil)
;; Internal utility functions
+(autoload 'mm-enable-multibyte "mm-util")
+
(defun sieve-manage-make-process-buffer ()
(with-current-buffer
(generate-new-buffer (format " *sieve %s:%s*"
:success "^OK.*\n"
:return-list t
:starttls-function
- '(lambda (capabilities)
- (when (string-match "\\bSTARTTLS\\b" capabilities)
- "STARTTLS\r\n")))
+ (lambda (capabilities)
+ (when (string-match "\\bSTARTTLS\\b" capabilities)
+ "STARTTLS\r\n")))
(setq sieve-manage-process proc)
(setq sieve-manage-capability
- (sieve-manage-parse-capability (getf props :capabilities)))
+ (sieve-manage-parse-capability (plist-get props :capabilities)))
;; Ignore new capabilities issues after successful STARTTLS
(when (and (memq stream '(nil network starttls))
- (eq (getf props :type) 'tls))
+ (eq (plist-get props :type) 'tls))
(sieve-manage-drop-next-answer))
(current-buffer))))
(defun sieve-manage-parse-capability (str)
"Parse managesieve capability string `STR'.
Set variable `sieve-manage-capability' to "
- (let ((capas (remove-if #'null
- (mapcar #'split-string-and-unquote
- (split-string str "\n")))))
+ (let ((capas (delq nil
+ (mapcar #'split-string-and-unquote
+ (split-string str "\n")))))
(when (string= "OK" (caar (last capas)))
(setq sieve-manage-state 'nonauth))
capas))