[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

nnimap 0.122 -> 0.123 patches



Index: nnimap/ChangeLog
diff -u nnimap/ChangeLog:1.251 nnimap/ChangeLog:1.255
--- nnimap/ChangeLog:1.251	Tue Jul  6 06:13:02 1999
+++ nnimap/ChangeLog	Mon Jul 12 06:39:11 1999
@@ -1,3 +1,31 @@
+1999-07-12  Simon Josefsson  <jas@pdc.kth.se>
+
+	* nnimap 0.123 released.
+
+	* nnimap.texi: Update.
+
+	* nnimap.el (nnimap-request-list): Message fix.
+	(nnimap-request-set-mark): Message fix.
+
+	* Makefile (imap): Load ssl.
+	(nnimap): Load ssl.
+
+	* imap.el (require): Require everything instead of autoloads, seem
+	to do funny things sometimes.
+	(imap-imtest-program): New variable.
+	(imap-kerberos4-open): Use it.
+	(imap-ssl-program): New variable.
+	(imap-ssl-arguments): New variable.
+	(imap-ssl-open-2): Renamed from `ssl-open-1'. Bind
+	ssl-program-name and ssl-program-arguments.
+	(imap-ssl-open-1): New function, openssl/ssleay selection.
+	(imap-ssl-open): Cleanup.
+
+	* nnimap.el (nnimap-retrieve-headers): Don't bug out when no
+	requested articles exist.
+	(nnimap-request-list): Don't lie.
+	(nnimap-request-newgroups): Ditto.
+
 1999-07-06  Simon Josefsson  <jas@pdc.kth.se>
 
 	* nnimap 0.122 released.
Index: nnimap/Makefile
diff -u nnimap/Makefile:1.22 nnimap/Makefile:1.23
--- nnimap/Makefile:1.22	Thu Jun 24 09:37:24 1999
+++ nnimap/Makefile	Mon Jul 12 06:11:52 1999
@@ -18,10 +18,10 @@
 	$(ELCC) $(GNUS) -f batch-byte-compile utf7.el
 
 imap.elc: rfc2104.elc ssl.elc utf7.elc imap.el
-	$(ELCC) $(GNUS) -l base64 -l md5 -l rfc2104.elc -l utf7.elc -f batch-byte-compile imap.el
+	$(ELCC) $(GNUS) -l ssl.elc -l base64 -l md5 -l rfc2104.elc -l utf7.elc -f batch-byte-compile imap.el
 
 nnimap.elc: rfc2104.elc imap.elc nnimap.el
-	$(ELCC) $(GNUS) -l base64 -l md5 -l rfc2104.elc -l utf7.elc -l imap.elc -f batch-byte-compile nnimap.el
+	$(ELCC) $(GNUS) -l ssl.elc -l base64 -l md5 -l rfc2104.elc -l utf7.elc -l imap.elc -f batch-byte-compile nnimap.el
 
 nnimap.html: nnimap.texi
 	texi2html -menu -monolithic nnimap.texi
Index: nnimap/imap.el
diff -u nnimap/imap.el:1.156 nnimap/imap.el:1.158
--- nnimap/imap.el:1.156	Tue Jul  6 03:41:59 1999
+++ nnimap/imap.el	Mon Jul 12 06:20:28 1999
@@ -132,7 +132,7 @@
 ;; o Don't use `read' at all (important places fixed)
 ;; o Accept list of articles instead of message set string in most
 ;;   imap-message-* functions.
-;; o A wrapper for Cyrus' new `imtest'
+;; o Cyrus 1.6.x `imtest' support in the imtest wrapper
 ;;
 
 ;;; Code:
@@ -140,17 +140,42 @@
 (eval-and-compile
   (require 'cl)
   (require 'utf7)
-  (autoload 'open-ssl-stream "ssl")
-  (autoload 'base64-decode "base64")
-  (autoload 'rfc2104-hash "rfc2104")
-  (autoload 'md5 "md5")
+  (require 'ssl)
+  (require 'base64)
+  (require 'rfc2104)
+  (require 'md5)
   (unless (fboundp 'open-network-stream)
     (require 'tcp)))
 
 ;; User variables.
 
+(defvar imap-imtest-program "imtest"
+  "Program to use for Kerberos 4 authentication.  It should accept
+IMAP commands on stdin and return responses to stdout.")
+
 (defvar imap-imtest-arguments "-kp"
-  "Privacy / integrity checking arguments passed to `imtest'.")
+  "Arguments for `imap-imtest-program'.")
+
+(defvar imap-ssl-program 'auto
+  "Program to use for SSL connections. It is called like this
+
+`imap-ssl-program' `imap-ssl-arguments' -ssl2 -connect host:port
+
+where -ssl2 can also be -ssl3 to indicate which ssl version to use. It
+should accept IMAP commands on stdin and return responses to stdout.
+
+For SSLeay set this to \"s_client\" and `imap-ssl-arguments' to nil,
+for OpenSSL set this to \"openssl\" and `imap-ssl-arguments' to
+\"s_client\".
+
+If 'auto it tries s_client first and then openssl.")
+
+(defvar imap-ssl-arguments nil
+  "Arguments to pass to `imap-ssl-program'.
+
+For SSLeay set this to nil, for OpenSSL to \"s_client\".
+
+If `imap-ssl-program' is 'auto this variable has no effect.")
 
 (defvar imap-default-user (user-login-name)
   "Default username to use.")
@@ -355,7 +380,8 @@
   (let* ((port (or port imap-default-port))
 	 (coding-system-for-read imap-coding-system-for-read)
 	 (coding-system-for-write imap-coding-system-for-write)
-	 (process (start-process name buffer "imtest" imap-imtest-arguments
+	 (process (start-process name buffer imap-imtest-program
+				 imap-imtest-arguments
 				 server (number-to-string port))))
     (when process
       (with-current-buffer buffer
@@ -387,13 +413,15 @@
 (defun imap-ssl-p (buffer)
   nil)
 
-(defun imap-ssl-open-1 (name buffer server port extra-arg)
+(defun imap-ssl-open-2 (name buffer server port &optional extra-ssl-args)
   (let* ((port (or port imap-default-ssl-port))
 	 (coding-system-for-read imap-coding-system-for-read)
 	 (coding-system-for-write imap-coding-system-for-write)
-	 (ssl-program-arguments (list extra-arg "-connect" 
-				      (format "%s:%d" server port)))
-	 (process (open-ssl-stream name buffer server port)))
+	 (ssl-program-name imap-ssl-program)
+	 (ssl-program-arguments (append imap-ssl-arguments extra-ssl-args
+					(list "-connect" 
+					      (format "%s:%d" server port))))
+	 (process (ignore-errors (open-ssl-stream name buffer server port))))
     (when process
       (with-current-buffer buffer
 	(goto-char (point-min))
@@ -413,13 +441,27 @@
       (when (memq (process-status process) '(open run))
 	process))))
 
+(defun imap-ssl-open-1 (name buffer server port &optional extra-ssl-args)
+  (or (and (eq imap-ssl-program 'auto)
+	   (let ((imap-ssl-program "s_client")
+		 (imap-ssl-arguments nil))
+	     (message "imap: Opening IMAP connection with %s %s..."
+		      imap-ssl-program (car-safe extra-ssl-args))
+	     (imap-ssl-open-2 name buffer server port extra-ssl-args)))
+      (and (eq imap-ssl-program 'auto)
+	   (let ((imap-ssl-program "openssl")
+		 (imap-ssl-arguments '("s_client")))
+	     (message "imap: Opening IMAP connection with %s %s..."
+		      imap-ssl-program (car-safe extra-ssl-args))
+	     (imap-ssl-open-2 name buffer server port extra-ssl-args)))
+      (and (not (eq imap-ssl-program 'auto))
+	   (progn (message "imap: Opening IMAP connection with %s %s..."
+			   imap-ssl-program (car-safe extra-ssl-args))
+		  (imap-ssl-open-2 name buffer server port extra-ssl-args)))))
+	   
 (defun imap-ssl-open (name buffer server port)
-  (message "Opening SSL3 IMAP connection...")
-  (let ((ret (imap-ssl-open-1 name buffer server port "-ssl3")))
-    (if ret
-	ret
-      (message "Opening SSL2 IMAP connection...")
-      (imap-ssl-open-1 name buffer server port "-ssl2"))))
+  (or (imap-ssl-open-1 name buffer server port '("-ssl3"))
+      (imap-ssl-open-1 name buffer server port '("-ssl2"))))
 
 (defun imap-network-p (buffer)
   t)
Index: nnimap/nnimap.el
diff -u nnimap/nnimap.el:1.202 nnimap/nnimap.el:1.206
--- nnimap/nnimap.el:1.202	Tue Jul  6 06:12:40 1999
+++ nnimap/nnimap.el	Mon Jul 12 06:25:46 1999
@@ -26,6 +26,7 @@
 
 ;; Todo, major things:
 ;;
+;;   o Fix Gnus to view correct number of unread/total articles in group buffer
 ;;   o Fix Gnus to handle leading '.' in group names (fixed?)
 ;;   o NOV cache
 ;;   o Finish disconnected mode (moving articles between mailboxes unplugged)
@@ -71,7 +72,7 @@
 (gnus-declare-backend "nnimap" 'mail 'address 'prompt-address
 		      'physical-address)
 
-(defconst nnimap-version "nnimap 0.122")
+(defconst nnimap-version "nnimap 0.123")
 
 (defvoo nnimap-address nil
   "Address of physical IMAP server.  If nil, use the virtual server's name.")
@@ -396,13 +397,14 @@
 	  (nnimap-counter 0))
       ;;(nnimap-retrieve-headers-from-file uids group server)
       ;; xxx only imap-fetch articles we don't have
-      (imap-fetch (nnimap-range-to-string (gnus-compress-sequence uids t))
-		  (concat 
-		   "(UID RFC822.SIZE ENVELOPE BODY "
-		   (if (imap-capability 'IMAP4rev1 nnimap-server-buffer)
-		       "BODY.PEEK[HEADER.FIELDS (References)])"
-		     "RFC822.HEADER.LINES (References))"))
-		  nil nil nnimap-server-buffer)
+      (when uids
+	(imap-fetch (nnimap-range-to-string (gnus-compress-sequence uids t))
+		    (concat 
+		     "(UID RFC822.SIZE ENVELOPE BODY "
+		     (if (imap-capability 'IMAP4rev1 nnimap-server-buffer)
+			 "BODY.PEEK[HEADER.FIELDS (References)])"
+		       "RFC822.HEADER.LINES (References))"))
+		    nil nil nnimap-server-buffer))
       ;; xxx add new nov lines to cache
       (and (numberp nnmail-large-newsgroup)
 	   (> nnimap-length nnmail-large-newsgroup)
@@ -579,7 +581,8 @@
 (deffoo nnimap-request-list (&optional server)
   (when (nnimap-possibly-change-server server)
     (with-current-buffer nntp-server-buffer
-      (gnus-message 5 "nnimap: Generating active list for %s..." server)
+      (gnus-message 5 "nnimap: Generating active list%s..."
+		    (if server (concat " for " server) ""))
       (erase-buffer)
       (dolist (pattern (nnimap-pattern-to-list-arguments 
 			nnimap-list-pattern))
@@ -588,10 +591,13 @@
 	  (or (member "\\NoSelect" 
 		      (imap-mailbox-get 'list-flags mbx nnimap-server-buffer))
 	      ;; Escape SPC in mailboxes xxx relies on gnus internals
-	      ;; We lie about high/low article number
-	      (insert (format "%s 0 1 y\n" 
-			      (nnimap-replace-in-string mbx " " "\\ "))))))
-      (gnus-message 5 "nnimap: Generating active list for %s...done" server))
+	      (let ((info (nnimap-find-minmax-uid mbx 'examine)))
+		(insert (format "%s %d %d y\n" 
+				(nnimap-replace-in-string mbx " " "\\ ")
+				(or (nth 2 info) 0)
+				(max 1 (or (nth 1 info) 1))))))))
+      (gnus-message 5 "nnimap: Generating active list%s...done" 
+		    (if server (concat " for " server) "")))
     t))
 
 (deffoo nnimap-request-post (&optional server)
@@ -609,6 +615,7 @@
 	(or (member "\\NoSelect" 
 		    (imap-mailbox-get 'list-flags group nnimap-server-buffer))
 	    (let ((info (nnimap-find-minmax-uid group 'examine)))
+	      ;; Escape SPC in mailboxes xxx relies on gnus internals
 	      (insert (format "211 %d %d %d %s\n" (or (nth 0 info) 0)
 			      (max 1 (or (nth 1 info) 1))
 			      (or (nth 2 info) 0)
@@ -672,8 +679,7 @@
   (when (nnimap-possibly-change-group group server)
     (with-current-buffer nnimap-server-buffer
       (let (action)
-	(gnus-message 7 "nnimap: Setting marks in %s:%s..."  
-		      (nnoo-current-server 'nnimap) group)
+	(gnus-message 7 "nnimap: Setting marks in %s..." group)
 	(while (setq action (pop actions))
 	  (let ((range (nth 0 action))
 		(what  (nth 1 action))
@@ -703,7 +709,7 @@
 		     (imap-message-flags-set
 		      (nnimap-range-to-string range)
 		      (nnimap-mark-to-flag marks nil t)))))))
-	(gnus-message 7 "nnimap: Setting marks in %s:%s...done" 
+	(gnus-message 7 "nnimap: Setting marks in %s...done" 
 		      (nnoo-current-server 'nnimap) group))))
   nil)
 
@@ -792,9 +798,11 @@
 	  (or (member "\\NoSelect" 
 		      (imap-mailbox-get 'list-flags mbx nnimap-server-buffer))
 	      ;; Escape SPC in mailboxes xxx relies on gnus internals
-	      ;; We lie about high/low article number
-	      (insert (format "%s 0 1 y\n" 
-			      (nnimap-replace-in-string mbx " " "\\ "))))))
+	      (let ((info (nnimap-find-minmax-uid mbx 'examine)))
+		(insert (format "%s %d %d y\n" 
+				(nnimap-replace-in-string mbx " " "\\ ")
+				(or (nth 2 info) 0)
+				(max 1 (or (nth 1 info) 1))))))))
       (gnus-message 5 "nnimap: Listing subscribed mailboxes%s%s...done"
 		    (if (> (length server) 0) " on " "") server))
     t))
@@ -1117,7 +1125,7 @@
 nnimap-possibly-change-group
 ;nnimap-replace-whitespace
 nnimap-retrieve-headers-progress
-nnimap-retrieve-headers-store-uids
+;nnimap-retrieve-headers-store-uids
 nnimap-retrieve-headers-get-uids
 nnimap-group-overview-filename
 nnimap-retrieve-headers-from-file
Index: nnimap/nnimap.texi
diff -u nnimap/nnimap.texi:1.28 nnimap/nnimap.texi:1.29
--- nnimap/nnimap.texi:1.28	Thu Jun 24 17:28:54 1999
+++ nnimap/nnimap.texi	Mon Jul 12 06:35:28 1999
@@ -7,8 +7,8 @@
 @setchapternewpage odd
 @paragraphindent 0
 
-@set VERSION $Revision: 1.1 $
-@set NNIMAP-VERSION 0.119
+@set VERSION $Revision: 1.1 $
+@set NNIMAP-VERSION 0.123
 
 @ifinfo
      This file documents nnimap, an Emacs Lisp package for accessing
@@ -318,7 +318,7 @@
 @item
 @dfn{kerberos4:} Use the `imtest' program.  @xref{config-krb}.
 @item
-@dfn{ssl:} Use the `s_client' program. @xref{config-ssl}.
+@dfn{ssl:} Use SSLeay or OpenSSL. @xref{config-ssl}.
 @item
 @dfn{network:} Plain, TCP/IP network connection.
 @end itemize
@@ -552,20 +552,31 @@
 @cindex using kerberos
 @cindex Authentication, kerberos
 @pindex imtest
+@vindex imap-imtest-program
+@vindex imap-imtest-arguments
 
 For Kerberos authentication and encryption you need to have the external
 program @code{imtest} which comes with Cyrus IMAPD
 (@url{http://andrew2.andrew.cmu.edu/cyrus/}) in your path.
 
+Also see the documentation on variables @code{imap-imtest-program} and
+@code{imap-imtest-arguments} if you need to change the details.
+
 @node config-ssl, debug, config-krb, config
 @section Required programs for ssl
 @cindex ssl
 @cindex using ssl
 @cindex Authentication, kerberos
 @pindex s_client
+@vindex imap-ssl-program
+@vindex imap-ssl-arguments
+
+For SSL encryption you need to have either SSLeay (@code{s_client}),
+@url{http://www.ssleay.org/}, or OpenSSL (@code{openssl}),
+@url{http://www.openssl.org/} installed.
 
-For SSL encryption you need to have the external program @code{s_client},
-which comes with SSLeay (@url{http://www.ssleay.org/},) in your path.
+Also see the documentation on variables @code{imap-ssl-program} and
+@code{imap-ssl-arguments} if you need to change the details.
 
 @node debug, , config-ssl, config
 @section Debugging