Mercurial > emacs
changeset 110793:6ab940f572a9
sieve-manage.el: Add authenticate function.
sieve-manage.el (sieve-manage-open): Use sieve-manage-default-port.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Wed, 06 Oct 2010 14:02:39 +0000 |
parents | 647b7ac5007c |
children | bacdf2d96735 |
files | doc/misc/ChangeLog doc/misc/sieve.texi lisp/gnus/ChangeLog lisp/gnus/sieve-manage.el lisp/gnus/sieve.el |
diffstat | 5 files changed, 34 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/misc/ChangeLog Wed Oct 06 13:21:07 2010 +0000 +++ b/doc/misc/ChangeLog Wed Oct 06 14:02:39 2010 +0000 @@ -1,5 +1,7 @@ 2010-10-06 Julien Danjou <julien@danjou.info> + * sieve.texi (Manage Sieve API): Document sieve-manage-authenticate. + * message.texi (PGP Compatibility): Remove reference to gpg-2comp, broken link.
--- a/doc/misc/sieve.texi Wed Oct 06 13:21:07 2010 +0000 +++ b/doc/misc/sieve.texi Wed Oct 06 14:02:39 2010 +0000 @@ -292,6 +292,10 @@ @findex sieve-manage-close Close a server connection. +@item sieve-manage-authenticate +@findex sieve-manage-authenticate +Authenticate to the server. + @item sieve-manage-capability @findex sieve-manage-capability Return a list of capabilities the server supports.
--- a/lisp/gnus/ChangeLog Wed Oct 06 13:21:07 2010 +0000 +++ b/lisp/gnus/ChangeLog Wed Oct 06 14:02:39 2010 +0000 @@ -1,3 +1,13 @@ +2010-10-06 Julien Danjou <julien@danjou.info> + + * sieve-manage.el: Update example in `Commentary'. + + * sieve.el (sieve-open-server): Use sieve-manage-authenticate. + + * sieve-manage.el (sieve-manage-open): Use sieve-manage-default-port, + not 2000. + (sieve-manage-authenticate): Re-add function. + 2010-10-06 Lars Magne Ingebrigtsen <larsi@gnus.org> * shr.el (shr-insert): Get 'space transition right.
--- a/lisp/gnus/sieve-manage.el Wed Oct 06 13:21:07 2010 +0000 +++ b/lisp/gnus/sieve-manage.el Wed Oct 06 14:02:39 2010 +0000 @@ -50,9 +50,11 @@ ;; ;; and that's it. Example of a managesieve session in *scratch*: ;; +;; (with-current-buffer (sieve-manage-open "mail.example.com") +;; (sieve-manage-authenticate) +;; (sieve-manage-listscripts)) ;; -;; (sieve-manage-listscripts my-buf) -;; ("vacation" "testscript" ("splitmail") "badscript") +;; => ((active . "main") "vacation") ;; ;; References: ;; @@ -387,7 +389,7 @@ 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)))) + (setq buffer (or buffer (format " *sieve* %s:%d" server (or port sieve-manage-default-port)))) (with-current-buffer (get-buffer-create buffer) (mapc 'make-local-variable sieve-manage-local-variables) (sieve-manage-disable-multibyte) @@ -444,6 +446,17 @@ (sieve-manage-erase) buffer))) +(defun sieve-manage-authenticate (&optional buffer) + "Authenticate on server in BUFFER. +Return `sieve-manage-state' value." + (with-current-buffer (or buffer (current-buffer)) + (if (eq sieve-manage-state 'nonauth) + (when (funcall (nth 2 (assq sieve-manage-auth + sieve-manage-authenticator-alist)) + (current-buffer)) + (setq sieve-manage-state 'auth)) + sieve-manage-state))) + (defun sieve-manage-opened (&optional buffer) "Return non-nil if connection to managesieve server in BUFFER is open. If BUFFER is nil then the current buffer is used."
--- a/lisp/gnus/sieve.el Wed Oct 06 13:21:07 2010 +0000 +++ b/lisp/gnus/sieve.el Wed Oct 06 14:02:39 2010 +0000 @@ -320,17 +320,12 @@ (insert "\n")))) (defun sieve-open-server (server &optional port) + "Open SERVER (on PORT) and authenticate." (with-current-buffer ;; open server (set (make-local-variable 'sieve-manage-buffer) (sieve-manage-open server)) - ;; authenticate - (if (eq sieve-manage-state 'nonauth) - (if (funcall (nth 2 (assq sieve-manage-auth - sieve-manage-authenticator-alist)) - (current-buffer)) - (setq sieve-manage-state 'auth)) - (eq sieve-manage-state 'auth)))) + (sieve-manage-authenticate))) (defun sieve-refresh-scriptlist () (interactive)