sieve-manage.el (sieve-manage-open): Use sieve-manage-default-port.
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.
@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.
+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.
;;
;; 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:
;;
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)
(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."
(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)