Commits

Anonymous committed 1e95484

2004-01-16 Simon Josefsson <jas@extundo.com>

* Makefile (REQUIRES): Add ecrypto.

*: Sync with Gnus CVS, ChangeLog entries below until 2003-10-31.

2004-01-05 Simon Josefsson <jas@extundo.com>

* sieve-manage.el: Use the password package.
(sieve-manage-read-passwd): Remove.
(sieve-manage-interactive-login): Use password. Re-add
condition-case around loop.

2002-08-07 Simon Josefsson <jas@extundo.com>

* sieve-manage.el (require): Use SASL, not RFC2104/MD5.
(sieve-manage-authenticators):
(sieve-manage-authenticator-alist): Add some SASL mechs.
(sieve-sasl-auth): New function.
(sieve-manage-cram-md5-auth):
(sieve-manage-plain-auth): Rewrite using SASL library.
(sieve-manage-digest-md5-p, sieve-manage-digest-md5-auth)
(sieve-manage-scram-md5-p, sieve-manage-scram-md5-auth)
(sieve-manage-ntlm-p, sieve-manage-ntlm-auth)
(sieve-manage-login-p, sieve-manage-login-auth): Add wrappers.

2003-06-24 Jesper Harder <harder@ifa.au.dk>

* sieve.texi (Sieve Mode): Formatting fix.

2003-05-17 Adrian Aichner <adrian@xemacs.org>

* sieve.texi (Managing Sieve): Ruthless typo fixing.

2003-05-02 Dave Love <fx@gnu.org>

* sieve.el (sieve-manage-mode-menu): Define before use.

2003-04-29 Simon Josefsson <jas@extundo.com>

* sieve-mode.el (c-mode): Autoload it (fix xemacs compile
warnings).

2003-01-26 Simon Josefsson <jas@extundo.com>

* sieve.texi (Installation): Extension .sv is also used.

2003-01-25 Simon Josefsson <jas@extundo.com>

* sieve-manage.el (sieve-manage-is-okno): Parse literal strings.

* sieve.el (sieve-upload): Fix error printing.

2003-01-12 Simon Josefsson <jas@extundo.com>

* sieve.el (sieve-upload-and-bury): New. Suggested by
kai.grossjohann@uni-duisburg.de (Kai Großjohann).

* sieve-mode.el (sieve-mode-map): Bind s-u-a-b to C-c C-c.
Suggested by kai.grossjohann@uni-duisburg.de (Kai Großjohann).

  • Participants
  • Parent commits 51460b9

Comments (0)

Files changed (6)

+2004-01-16  Simon Josefsson  <jas@extundo.com>
+
+	* Makefile (REQUIRES): Add ecrypto.
+
+	*: Sync with Gnus CVS, ChangeLog entries below until 2003-10-31.
+
+2004-01-05  Simon Josefsson  <jas@extundo.com>
+
+	* sieve-manage.el: Use the password package.
+	(sieve-manage-read-passwd): Remove.
+	(sieve-manage-interactive-login): Use password.  Re-add
+	condition-case around loop.
+
+2002-08-07  Simon Josefsson  <jas@extundo.com>
+
+	* sieve-manage.el (require): Use SASL, not RFC2104/MD5.
+	(sieve-manage-authenticators):
+	(sieve-manage-authenticator-alist): Add some SASL mechs.
+	(sieve-sasl-auth): New function.
+	(sieve-manage-cram-md5-auth):
+	(sieve-manage-plain-auth): Rewrite using SASL library.
+	(sieve-manage-digest-md5-p, sieve-manage-digest-md5-auth)
+	(sieve-manage-scram-md5-p, sieve-manage-scram-md5-auth)
+	(sieve-manage-ntlm-p, sieve-manage-ntlm-auth)
+	(sieve-manage-login-p, sieve-manage-login-auth): Add wrappers.
+
+2003-06-24  Jesper Harder  <harder@ifa.au.dk>
+
+	* sieve.texi (Sieve Mode): Formatting fix.
+
+2003-05-17  Adrian Aichner  <adrian@xemacs.org>
+
+	* sieve.texi (Managing Sieve): Ruthless typo fixing.
+
+2003-05-02  Dave Love  <fx@gnu.org>
+
+	* sieve.el (sieve-manage-mode-menu): Define before use.
+
+2003-04-29  Simon Josefsson  <jas@extundo.com>
+
+	* sieve-mode.el (c-mode): Autoload it (fix xemacs compile
+	warnings).
+
+2003-01-26  Simon Josefsson  <jas@extundo.com>
+
+	* sieve.texi (Installation): Extension .sv is also used.
+
+2003-01-25  Simon Josefsson  <jas@extundo.com>
+
+	* sieve-manage.el (sieve-manage-is-okno): Parse literal strings.
+
+	* sieve.el (sieve-upload): Fix error printing.
+
+2003-01-12  Simon Josefsson  <jas@extundo.com>
+
+	* sieve.el (sieve-upload-and-bury): New.  Suggested by
+	kai.grossjohann@uni-duisburg.de (Kai Gro�johann).
+
+	* sieve-mode.el (sieve-mode-map): Bind s-u-a-b to C-c C-c.
+	Suggested by kai.grossjohann@uni-duisburg.de (Kai Gro�johann).
+
 2003-10-31  Norbert Koch  <viteno@xemacs.org>
 
 	* Makefile (VERSION): XEmacs package 1.14 released.
 MAINTAINER = Simon Josefsson <simon@josefsson.org>
 PACKAGE = sieve
 PKG_TYPE = regular
-REQUIRES = xemacs-base mail-lib cc-mode sasl
+REQUIRES = xemacs-base mail-lib cc-mode sasl ecrypto
 CATEGORY = standard
 
 ELCS = sieve.elc sieve-mode.elc sieve-manage.elc

File sieve-manage.el

 ;;; sieve-manage.el --- Implementation of the managesive protocol in elisp
-;; Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 
 
 ;;; Code:
 
+(require 'password)
 (eval-when-compile
   (require 'sasl)
   (require 'starttls))
   (when (fboundp 'set-buffer-multibyte)
     (set-buffer-multibyte nil)))
 
-(defun sieve-manage-read-passwd (prompt &rest args)
-  "Read a password using PROMPT.
-If ARGS, PROMPT is used as an argument to `format'."
-  (let ((prompt (if args
-		    (apply 'format prompt args)
-		  prompt)))
-    (funcall (if (or (fboundp 'read-passwd)
-		     (and (load "subr" t)
-			  (fboundp 'read-passwd))
-		     (and (load "passwd" t)
-			  (fboundp 'read-passwd)))
-		 'read-passwd
-	       (autoload 'ange-ftp-read-passwd "ange-ftp")
-	       'ange-ftp-read-passwd)
-	     prompt)))
-
-
 ;; Uses the dynamically bound `reason' variable.
 (defvar reason)
 (defun sieve-manage-interactive-login (buffer loginfunc)
   (with-current-buffer buffer
     (make-variable-buffer-local 'sieve-manage-username)
     (make-variable-buffer-local 'sieve-manage-password)
-    (let (user passwd ret reason)
-      ;;      (condition-case ()
-      (while (or (not user) (not passwd))
-	(setq user (or sieve-manage-username
-		       (read-from-minibuffer
-			(concat "Managesieve username for "
-				sieve-manage-server ": ")
-			(or user sieve-manage-default-user))))
-	(setq passwd (or sieve-manage-password
-			 (sieve-manage-read-passwd
-			  (concat "Managesieve password for " user "@"
-				  sieve-manage-server ": "))))
-	(when (and user passwd)
-	  (if (funcall loginfunc user passwd)
-	      (progn
-		(setq ret t
-		      sieve-manage-username user)
-		(if (and (not sieve-manage-password)
-			 (y-or-n-p "Store password for this session? "))
-		    (setq sieve-manage-password passwd)))
-	    (if reason
-		(message "Login failed (reason given: %s)..." reason)
-	      (message "Login failed..."))
-	    (setq reason nil)
-	    (setq passwd nil)
-	    (sit-for 1))))
-      ;;	(quit (with-current-buffer buffer
-      ;;		(setq user nil
-      ;;		      passwd nil)))
-      ;;	(error (with-current-buffer buffer
-      ;;		 (setq user nil
-      ;;		       passwd nil))))
+    (let (user passwd ret reason passwd-key)
+      (condition-case ()
+	  (while (or (not user) (not passwd))
+	    (setq user (or sieve-manage-username
+			   (read-from-minibuffer
+			    (concat "Managesieve username for "
+				    sieve-manage-server ": ")
+			    (or user sieve-manage-default-user)))
+		  passwd-key (concat "managesieve:" user "@" sieve-manage-server
+				     ":" sieve-manage-port)
+		  passwd (or sieve-manage-password
+			     (password-read (concat "Managesieve password for "
+						    user "@" sieve-manage-server
+						    ": ")
+					    passwd-key)))
+	    (when (y-or-n-p "Store password for this session? ")
+	      (password-cache-add passwd-key (copy-sequence passwd)))
+	    (when (and user passwd)
+	      (if (funcall loginfunc user passwd)
+		  (setq ret t
+			sieve-manage-username user)
+		(if reason
+		    (message "Login failed (reason given: %s)..." reason)
+		  (message "Login failed..."))
+		(password-cache-remove passwd-key)
+		(setq sieve-manage-password nil)
+		(setq passwd nil)
+		(setq reason nil)
+		(sit-for 1))))
+	(quit (with-current-buffer buffer
+		(password-cache-remove passwd-key)
+		(setq user nil
+		      passwd nil
+		      sieve-manage-password nil)))
+	(error (with-current-buffer buffer
+		 (password-cache-remove passwd-key)
+		 (setq user nil
+		       passwd nil
+		       sieve-manage-password nil))))
       ret)))
 
 (defun sieve-manage-erase (&optional p buffer)
 	       (sieve-manage-erase)
 	       (when (sieve-manage-ok-p rsp)
 		 (when (string-match "^SASL \"\\([^\"]+\\)\"" (cadr rsp))
-		   (sasl-step-set-data 
+		   (sasl-step-set-data
 		    step (base64-decode-string (match-string 1 (cadr rsp)))))
 		 (if (and (setq step (sasl-next-step client step))
 			  (setq data (sasl-step-data step)))
 	       (setq step (sasl-next-step client step))
 	       (sieve-manage-send
 		(if (sasl-step-data step)
-		    (concat "\"" 
-			    (base64-encode-string (sasl-step-data step) 
+		    (concat "\""
+			    (base64-encode-string (sasl-step-data step)
 						  'no-line-break)
 			    "\"")
 		  "")))))))
   (when (looking-at (concat
 		     "^\\(OK\\|NO\\)\\( (\\([^)]+\\))\\)?\\( \\(.*\\)\\)?"
 		     sieve-manage-server-eol))
-    (list (match-string 1) (match-string 3) (match-string 5))))
+    (let ((status (match-string 1))
+	  (resp-code (match-string 3))
+	  (response (match-string 5)))
+      (when response
+	(goto-char (match-beginning 5))
+	(setq response (sieve-manage-is-string)))
+      (list status resp-code response))))
 
 (defun sieve-manage-parse-okno ()
   (let (rsp)

File sieve-mode.el

 ;;; sieve-mode.el --- Sieve code editing commands for Emacs
-;; Copyright (C) 2001 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2003 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 
 
 (autoload 'sieve-manage "sieve")
 (autoload 'sieve-upload "sieve")
+(autoload 'c-mode "cc-mode")
 (require 'easymenu)
 (eval-when-compile
   (require 'font-lock))
 (defvar sieve-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map "\C-c\C-l" 'sieve-upload)
+    (define-key map "\C-c\C-c" 'sieve-upload-and-bury)
     (define-key map "\C-c\C-m" 'sieve-manage)
     map)
   "Key map used in sieve mode.")
 ;;; sieve.el --- Utilities to manage sieve scripts
-;; Copyright (C) 2001 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2003 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <simon@josefsson.org>
 
   (define-key sieve-manage-mode-map [(down-mouse-2)] 'sieve-edit-script)
   (define-key sieve-manage-mode-map [(down-mouse-3)] 'sieve-manage-mode-menu))
 
+(easy-menu-define sieve-manage-mode-menu sieve-manage-mode-map
+  "Sieve Menu."
+  '("Manage Sieve"
+    ["Edit script" sieve-edit-script t]
+    ["Activate script" sieve-activate t]
+    ["Deactivate script" sieve-deactivate t]))
+
 (define-derived-mode sieve-manage-mode fundamental-mode "SIEVE"
   "Mode used for sieve script management."
   (setq mode-name "SIEVE")
 
 (put 'sieve-manage-mode 'mode-class 'special)
 
-(easy-menu-define sieve-manage-mode-menu sieve-manage-mode-map
-  "Sieve Menu."
-  '("Manage Sieve"
-    ["Edit script" sieve-edit-script t]
-    ["Activate script" sieve-activate t]
-    ["Deactivate script" sieve-deactivate t]))
-
 ;; This is necessary to allow correct handling of \\[cvs-mode-diff-map]
 ;; in substitute-command-keys.
 ;(fset 'sieve-manage-mode-map sieve-manage-mode-map)
       (with-current-buffer (get-buffer sieve-buffer)
 	(setq err (sieve-manage-putscript name script sieve-manage-buffer))
 	(if (sieve-manage-ok-p err)
-	    (message (concat "Sieve upload done.  Use `C-c RET' to manage scripts."))
+	    (message (concat
+		      "Sieve upload done.  Use `C-c RET' to manage scripts."))
 	  (message "Sieve upload failed: %s" (nth 2 err)))))))
 
+;;;###autoload
+(defun sieve-upload-and-bury (&optional name)
+  (interactive)
+  (sieve-upload name)
+  (bury-buffer))
+
 (provide 'sieve)
 
 ;; sieve.el ends here
 (autoload 'sieve-mode "sieve-mode")
 @end lisp
 @lisp
-(setq auto-mode-alist (cons '("\\.si\\(v\\|eve\\)\\'" . sieve-mode)
+(setq auto-mode-alist (cons '("\\.s\\(v\\|iv\\|ieve\\)\\'" . sieve-mode)
                             auto-mode-alist))
 @end lisp
 
 (@code{sieve-mode-syntax-table}).
 
 In addition to the editing utility functions, Sieve mode also contains
-bindings to manage Sieve scripts remotely. @pxref{Managing Sieve}.
+bindings to manage Sieve scripts remotely. @xref{Managing Sieve}.
 
 @table @kbd
 
 RET}, which queries the user for a server and if necessary, user
 credentials to use.
 
-When a server has been succesfully contacted, the Manage Sieve buffer
+When a server has been successfully contacted, the Manage Sieve buffer
 looks something like:
 
 @example