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

nnimap 0.119 -> 0.120 patches



Index: nnimap/ChangeLog
diff -c nnimap/ChangeLog:1.239 nnimap/ChangeLog:1.247
*** nnimap/ChangeLog:1.239	Thu Jun 24 17:28:36 1999
--- nnimap/ChangeLog	Mon Jul  5 05:58:20 1999
***************
*** 1,5 ****
--- 1,39 ----
+ 1999-07-05  Simon Josefsson  <jas@pdc.kth.se>
+ 
+ 	* nnimap 0.120 released.
+ 
+ 	* nnimap.el (nnimap-group-overview-filename): New function.
+ 	(nnimap-retrieve-headers-from-file): New function.
+ 	(nnimap-retrieve-headers-get-uids): Find active UIDs.
+ 	(nnimap-request-list): Quote mailboxes containing SPC.
+ 	(nnimap-nov-is-evil): New variable.
+ 
+ 	* imap.el: Send mailboxes as strings instead of atoms.
+ 
+ 1999-06-26  Simon Josefsson  <jas@pdc.kth.se>
+ 
+ 	* imap.el (imap-mailbox-select): Failed select unselects current
+ 	mailbox.
+ 	(imap-current-mailbox): New function.
+ 
+ 	* utf7.el (utf7-fragment-decode): Don't use
+ 	base64-decode-internal.
+ 	(utf7-encode): 
+ 	(utf7-decode): Bind default-enable-multibyte-characters.
+ 	(utf7-disable-multibyte): Removed.
+ 
+ 1999-06-26  Jon K Hellan <hellan@item.ntnu.no>
+ 
+ 	* utf7.el: Update.
+ 
  1999-06-25  Simon Josefsson  <jas@pdc.kth.se>
  
+ 	* nnimap.el (nnimap-date-days-ago): No Gnus 5.6 compatibility.
+ 	
+ 	* nnimap.el (nnimap-request-update-info-internal): Don't update
+ 	when no info.
+ 	(nnimap-request-article-part): Message when done fetching.
+ 
  	* nnimap 0.119 released.
  
  	* nnimap.texi: Update.
***************
*** 29,35 ****
  
  	* md5.el: Removed.
  
! 1999-06-24  Jon K Hellan <jk@parus.itea.ntnu.no>
  
  	* utf7.el: New file.
  
--- 63,69 ----
  
  	* md5.el: Removed.
  
! 1999-06-24  Jon K Hellan <hellan@item.ntnu.no>
  
  	* utf7.el: New file.
  
Index: nnimap/imap.el
diff -c nnimap/imap.el:1.150 nnimap/imap.el:1.154
*** nnimap/imap.el:1.150	Thu Jun 24 11:18:32 1999
--- nnimap/imap.el	Mon Jul  5 02:22:40 1999
***************
*** 698,703 ****
--- 698,707 ----
         imap-mailbox-data)
        result)))
  
+ (defun imap-current-mailbox (&optional buffer)
+   (with-current-buffer (or buffer (current-buffer))
+     imap-current-mailbox))
+ 
  (defun imap-current-mailbox-p (mailbox &optional examine buffer)
    (with-current-buffer (or buffer (current-buffer))
      (and (string= mailbox imap-current-mailbox)
***************
*** 712,733 ****
    (with-current-buffer (or buffer (current-buffer))
      (if (imap-current-mailbox-p mailbox examine)
  	imap-current-mailbox
!       (let ((old-mailbox imap-current-mailbox)
! 	    (old-data imap-message-data))
! 	(unless imap-mailbox-data
! 	  (setq imap-mailbox-data (make-vector imap-mailbox-prime 0)))
! 	(setq imap-current-mailbox mailbox)
! 	(if (imap-ok-p (imap-send-command-wait
! 			(concat (if examine "EXAMINE" "SELECT") " " 
! 				(imap-utf7-encode mailbox))))
! 	    (progn
! 	      (setq imap-message-data (make-vector imap-message-prime 0)
! 		    imap-state (if examine 'examine 'selected))
! 	      imap-current-mailbox)
! 	  ;; Failed SELECT unselects the current group
! 	  (setq imap-current-mailbox old-mailbox
! 		imap-message-data old-data)
! 	  nil)))))
  
  (defun imap-mailbox-examine (mailbox &optional buffer)
    "Examine MAILBOX on server in BUFFER"
--- 716,733 ----
    (with-current-buffer (or buffer (current-buffer))
      (if (imap-current-mailbox-p mailbox examine)
  	imap-current-mailbox
!       (unless imap-mailbox-data
! 	(setq imap-mailbox-data (make-vector imap-mailbox-prime 0)))
!       (setq imap-current-mailbox mailbox)
!       (if (imap-ok-p (imap-send-command-wait
! 		      (concat (if examine "EXAMINE" "SELECT") " \"" 
! 			      (imap-utf7-encode mailbox) "\"")))
! 	  (progn
! 	    (setq imap-message-data (make-vector imap-message-prime 0)
! 		  imap-state (if examine 'examine 'selected))
! 	    imap-current-mailbox)
! 	;; Failed SELECT/EXAMINE unselects current mailbox
! 	(setq imap-current-mailbox nil)))))
  
  (defun imap-mailbox-examine (mailbox &optional buffer)
    "Examine MAILBOX on server in BUFFER"
***************
*** 740,747 ****
  	      (and (imap-capability 'UNSELECT)
  		   (imap-ok-p (imap-send-command-wait "UNSELECT")))
  	      (and (imap-ok-p 
! 		    (imap-send-command-wait (concat "EXAMINE "
! 						    imap-current-mailbox)))
  		   (imap-ok-p (imap-send-command-wait "CLOSE"))))
        (setq imap-current-mailbox nil
  	    imap-message-data nil
--- 740,748 ----
  	      (and (imap-capability 'UNSELECT)
  		   (imap-ok-p (imap-send-command-wait "UNSELECT")))
  	      (and (imap-ok-p 
! 		    (imap-send-command-wait (concat "EXAMINE \""
! 						    imap-current-mailbox
! 						    "\"")))
  		   (imap-ok-p (imap-send-command-wait "CLOSE"))))
        (setq imap-current-mailbox nil
  	    imap-message-data nil
***************
*** 771,792 ****
  buffer is assumed."
    (with-current-buffer (or buffer (current-buffer))
      (imap-ok-p 
!      (imap-send-command-wait (list "CREATE " (imap-utf7-encode mailbox))))))
  
  (defun imap-mailbox-delete (mailbox &optional buffer)
    "Delete MAILBOX on server in BUFFER. If BUFFER is nil the current
  buffer is assumed."
    (with-current-buffer (or buffer (current-buffer))
      (imap-ok-p
!      (imap-send-command-wait (list "DELETE " (imap-utf7-encode mailbox))))))
  
  (defun imap-mailbox-rename (oldname newname &optional buffer)
    "Rename mailbox OLDNAME to NEWNAME on server in BUFFER. If BUFFER is
  nil the current buffer is assumed."
    (with-current-buffer (or buffer (current-buffer))
      (imap-ok-p
!      (imap-send-command-wait (list "RENAME " (imap-utf7-encode oldname)
! 				   " " (imap-utf7-encode newname))))))
  
  (defun imap-mailbox-lsub (&optional buffer reference)
    "Clear the mailbox data and fill it with subscribed mailboxes on
--- 772,795 ----
  buffer is assumed."
    (with-current-buffer (or buffer (current-buffer))
      (imap-ok-p 
!      (imap-send-command-wait (list "CREATE \"" (imap-utf7-encode mailbox)
! 				   "\"")))))
  
  (defun imap-mailbox-delete (mailbox &optional buffer)
    "Delete MAILBOX on server in BUFFER. If BUFFER is nil the current
  buffer is assumed."
    (with-current-buffer (or buffer (current-buffer))
      (imap-ok-p
!      (imap-send-command-wait (list "DELETE \"" (imap-utf7-encode mailbox)
! 				   "\"")))))
  
  (defun imap-mailbox-rename (oldname newname &optional buffer)
    "Rename mailbox OLDNAME to NEWNAME on server in BUFFER. If BUFFER is
  nil the current buffer is assumed."
    (with-current-buffer (or buffer (current-buffer))
      (imap-ok-p
!      (imap-send-command-wait (list "RENAME \"" (imap-utf7-encode oldname)
! 				   "\" \"" (imap-utf7-encode newname) "\"")))))
  
  (defun imap-mailbox-lsub (&optional buffer reference)
    "Clear the mailbox data and fill it with subscribed mailboxes on
***************
*** 823,837 ****
    "Send the SUBSCRIBE command on the mailbox to server in
  BUFFER. Returns non-nil if successful."
    (with-current-buffer (or buffer (current-buffer))
!     (imap-ok-p (imap-send-command-wait (concat "SUBSCRIBE " 
! 					       (imap-utf7-encode mailbox))))))
  
  (defun imap-mailbox-unsubscribe (mailbox &optional buffer)
    "Send the SUBSCRIBE command on the mailbox to server in
  BUFFER. Returns non-nil if successful."
    (with-current-buffer (or buffer (current-buffer))
      (imap-ok-p (imap-send-command-wait (concat "UNSUBSCRIBE " 
! 					       (imap-utf7-encode mailbox))))))
  
  (defun imap-mailbox-status (mailbox items &optional buffer)
    "Get status items ITEM in MAILBOX from server in BUFFER. ITEMS can
--- 826,842 ----
    "Send the SUBSCRIBE command on the mailbox to server in
  BUFFER. Returns non-nil if successful."
    (with-current-buffer (or buffer (current-buffer))
!     (imap-ok-p (imap-send-command-wait (concat "SUBSCRIBE \"" 
! 					       (imap-utf7-encode mailbox)
! 					       "\"")))))
  
  (defun imap-mailbox-unsubscribe (mailbox &optional buffer)
    "Send the SUBSCRIBE command on the mailbox to server in
  BUFFER. Returns non-nil if successful."
    (with-current-buffer (or buffer (current-buffer))
      (imap-ok-p (imap-send-command-wait (concat "UNSUBSCRIBE " 
! 					       (imap-utf7-encode mailbox)
! 					       "\"")))))
  
  (defun imap-mailbox-status (mailbox items &optional buffer)
    "Get status items ITEM in MAILBOX from server in BUFFER. ITEMS can
***************
*** 841,849 ****
  if ITEMS is a symbol only it's value is returned."
    (with-current-buffer (or buffer (current-buffer))
      (when (imap-ok-p 
! 	   (imap-send-command-wait (list "STATUS "
  					 (imap-utf7-encode mailbox)
! 					 " "
  					 (format "%s"
  						 (if (listp items)
  						     items 
--- 846,854 ----
  if ITEMS is a symbol only it's value is returned."
    (with-current-buffer (or buffer (current-buffer))
      (when (imap-ok-p 
! 	   (imap-send-command-wait (list "STATUS \""
  					 (imap-utf7-encode mailbox)
! 					 "\" "
  					 (format "%s"
  						 (if (listp items)
  						     items 
***************
*** 858,866 ****
    "Get ACL on mailbox from server in BUFFER."
    (with-current-buffer (or buffer (current-buffer))
      (when (imap-ok-p
! 	   (imap-send-command-wait (list "GETACL "
  					 (imap-utf7-encode
! 					  (or mailbox imap-current-mailbox)))))
        (imap-mailbox-get 'acl (or mailbox imap-current-mailbox)))))
  
  (defun imap-mailbox-acl-set (identifier rights &optional mailbox buffer)
--- 863,872 ----
    "Get ACL on mailbox from server in BUFFER."
    (with-current-buffer (or buffer (current-buffer))
      (when (imap-ok-p
! 	   (imap-send-command-wait (list "GETACL \""
  					 (imap-utf7-encode
! 					  (or mailbox imap-current-mailbox))
! 					 "\"")))
        (imap-mailbox-get 'acl (or mailbox imap-current-mailbox)))))
  
  (defun imap-mailbox-acl-set (identifier rights &optional mailbox buffer)
***************
*** 868,877 ****
  BUFFER."
    (with-current-buffer (or buffer (current-buffer))
      (imap-ok-p
!      (imap-send-command-wait (list "SETACL "
  				   (imap-utf7-encode
  				    (or mailbox imap-current-mailbox))
! 				   " "
  				   identifier
  				   " "
  				   rights)))))
--- 874,883 ----
  BUFFER."
    (with-current-buffer (or buffer (current-buffer))
      (imap-ok-p
!      (imap-send-command-wait (list "SETACL \""
  				   (imap-utf7-encode
  				    (or mailbox imap-current-mailbox))
! 				   "\" "
  				   identifier
  				   " "
  				   rights)))))
***************
*** 881,890 ****
  server in BUFFER."
    (with-current-buffer (or buffer (current-buffer))
      (imap-ok-p
!      (imap-send-command-wait (list "DELETEACL "
  				   (imap-utf7-encode
  				    (or mailbox imap-current-mailbox))
! 				   " "
  				   identifier)))))
  
  
--- 887,896 ----
  server in BUFFER."
    (with-current-buffer (or buffer (current-buffer))
      (imap-ok-p
!      (imap-send-command-wait (list "DELETEACL \""
  				   (imap-utf7-encode
  				    (or mailbox imap-current-mailbox))
! 				   "\" "
  				   identifier)))))
  
  
***************
*** 1064,1070 ****
  first element, rest of list contain the saved articles' UIDs."
    (when articles
      (with-current-buffer (or buffer (current-buffer))
!       (if (let ((cmd (concat "UID COPY " articles " " mailbox))
  		(imap-current-target-mailbox mailbox))
  	    (if (imap-ok-p (imap-send-command-wait cmd))
  		t
--- 1070,1076 ----
  first element, rest of list contain the saved articles' UIDs."
    (when articles
      (with-current-buffer (or buffer (current-buffer))
!       (if (let ((cmd (concat "UID COPY " articles " \"" mailbox "\""))
  		(imap-current-target-mailbox mailbox))
  	    (if (imap-ok-p (imap-send-command-wait cmd))
  		t
***************
*** 1083,1089 ****
      (let ((imap-current-target-mailbox mailbox))
        (imap-ok-p 
         (imap-send-command-wait 
! 	(list "APPEND " (imap-utf7-encode mailbox) " "  article))))
      (imap-message-appenduid mailbox)))
    
  (defun imap-body-lines (body)
--- 1089,1095 ----
      (let ((imap-current-target-mailbox mailbox))
        (imap-ok-p 
         (imap-send-command-wait 
! 	(list "APPEND \"" (imap-utf7-encode mailbox) "\" "  article))))
      (imap-message-appenduid mailbox)))
    
  (defun imap-body-lines (body)
***************
*** 2129,2131 ****
--- 2135,2139 ----
  	  )))
  	
  (provide 'imap)
+ 
+ ;;; imap.el ends here
Index: nnimap/nnimap.el
diff -c nnimap/nnimap.el:1.190 nnimap/nnimap.el:1.196
*** nnimap/nnimap.el:1.190	Thu Jun 24 17:15:55 1999
--- nnimap/nnimap.el	Mon Jul  5 05:05:13 1999
***************
*** 1,7 ****
  ;;; nnimap.el --- imap backend for Gnus
  ;; Copyright (C) 1998,1999 Free Software Foundation, Inc.
  
! ;; Author: Simon Josefsson <jas@pdc.kth.se>, 
  ;;         Jim Radford <radford@robby.caltech.edu>
  ;; Keywords: mail
  
--- 1,7 ----
  ;;; nnimap.el --- imap backend for Gnus
  ;; Copyright (C) 1998,1999 Free Software Foundation, Inc.
  
! ;; Author: Simon Josefsson <jas@pdc.kth.se>
  ;;         Jim Radford <radford@robby.caltech.edu>
  ;; Keywords: mail
  
***************
*** 24,75 ****
  
  ;;; Commentary:
  
! ;;; This file provides IMAP support for the Emacs news/mailreader Gnus.
! ;;; To enable this backend you put the following in your .gnus:
  
- ;;;  (require  'nnimap)
- ;;;  (setq gnus-secondary-select-methods 
- ;;;      '((nnimap 
- ;;;          "yoyo"
- ;;;          (nnimap-address "robby.caltech.edu"))))
- 
- ;;; And inside Gnus, list all available groups with A A (search for 
- ;;; 'nnimap') and subscribe to the mailboxes you are interested in with U. 
- ;;; If you know the name of the mailbox, you can also use 'U'
- ;;; (gnus-group-unsubscribe-group) to subscribe to it (no mailbox
- ;;; completion here, sorry).
- 
- ;;; Note that Gnus can't deal with groups starting with '.' (a dot),
- ;;; this means that you will have to use ~/iMail/ instead of ./iMail
- ;;; (or similair).
- 
- ;;; Todo (roughly in order of priority):
- 
- ;;;   o What about Gnus's article editing, can we support it?
- ;;;   o Verify that we don't use IMAP4rev1 specific things (RFC2060 App B)
- ;;;   o Dont uid fetch 1,* in nnimap-retrive-groups (slow)
- ;;;   o Split up big fetches (1,* header especially) in smaller chunks
- ;;;   o Use \Draft to support the draft group??
- ;;;   o What do I do with gnus-newsgroup-*?
- ;;;   o Tell Gnus about new groups (how can we tell?)
- ;;;   o Add asynchronous support with two server connections (use BODY.PEEK)
- ;;;   o Bulletin board stuff.
- ;;;   o Respooling (fix Gnus?)
- ;;;   o Subscribe to newly created mailboxes (how? nnimap-request-newgroups?)
- ;;;   o Add support for the following: (if applicable)
- ;;;       request-list-newsgroups, request-regenerate
- ;;;       list-active-group,
- ;;;       request-associate-buffer, request-restore-buffer,
- ;;;   o Do The Right Thing when UIDVALIDITY changes
- ;;;   o Split to other backends, different split rules for different
- ;;;     servers/inboxes
- ;;;   o Fix Gnus to handle SPC and leading '.' in group names
- ;;;   o Support RFC2221 (Login referrals)
- ;;;   o IMAP2BIS compatibility? (RFC2061)
- ;;;   o ACAP stuff (perhaps a different project, would be nice to ACAPify 
- ;;;     .newsrc.eld)
- ;;;   o MIME
- 
  (eval-and-compile
    (require 'imap))
  
--- 24,55 ----
  
  ;;; Commentary:
  
! ;; Todo (roughly in order of priority):
! ;;
! ;;   o What about Gnus's article editing, can we support it?
! ;;   o Verify that we don't use IMAP4rev1 specific things (RFC2060 App B)
! ;;   o Dont uid fetch 1,* in nnimap-retrive-groups (slow)
! ;;   o Split up big fetches (1,* header especially) in smaller chunks
! ;;   o Use \Draft to support the draft group??
! ;;   o What do I do with gnus-newsgroup-*?
! ;;   o Tell Gnus about new groups (how can we tell?)
! ;;   o Add asynchronous support
! ;;   o Bulletin board stuff.
! ;;   o Respooling (fix Gnus?) (unnecessery?)
! ;;   o Add support for the following: (if applicable)
! ;;       request-list-newsgroups, request-regenerate
! ;;       list-active-group,
! ;;       request-associate-buffer, request-restore-buffer,
! ;;   o Do The Right Thing when UIDVALIDITY changes
! ;;   o Split to other backends, different split rules for different
! ;;     servers/inboxes
! ;;   o Fix Gnus to handle leading '.' in group names
! ;;   o Support RFC2221 (Login referrals)
! ;;   o IMAP2BIS compatibility? (RFC2061)
! ;;   o ACAP stuff (perhaps a different project, would be nice to ACAPify 
! ;;     .newsrc.eld)
! ;;   o MIME
  
  (eval-and-compile
    (require 'imap))
  
***************
*** 80,89 ****
  
  (nnoo-declare nnimap)
  
! (gnus-declare-backend "nnimap" 'mail 'address 'prompt-address 
  		      'physical-address)
  
! (defconst nnimap-version "nnimap 0.119")
  
  (defvoo nnimap-address nil
    "Address of physical IMAP server.  If nil, use the virtual server's name.")
--- 60,69 ----
  
  (nnoo-declare nnimap)
  
! (gnus-declare-backend "nnimap" 'mail 'address 'prompt-address
  		      'physical-address)
  
! (defconst nnimap-version "nnimap 0.120")
  
  (defvoo nnimap-address nil
    "Address of physical IMAP server.  If nil, use the virtual server's name.")
***************
*** 166,180 ****
  
  Possible choices: kerberos4, cram-md5, login, anonymous.")
  
! (defvoo nnimap-directory message-directory
!   "Data directory for the nnimap backend.")
  
! (defvoo nnimap-nov-file "overview."
    "NOV cache base filename. The group name will be appended. A typical
! complete file name would be ~/Mail/overview.nnimap+pdc:INBOX.spam, or
! ~/Mail/overview/nnimap/pdc/INBOX/spam if `gnus-use-long-file-name' is
  nil")
  
  (defvoo nnimap-expunge-on-close 'always ; 'ask, 'never
    "When a IMAP group with articles marked for deletion is closed, this
  variable determine if nnimap should actually remove the articles or
--- 146,163 ----
  
  Possible choices: kerberos4, cram-md5, login, anonymous.")
  
! (defvoo nnimap-directory gnus-directory
!   "Directory to keep NOV cache files for nnimap groups.")
  
! (defvoo nnimap-nov-file-name "overview.nnimap."
    "NOV cache base filename. The group name will be appended. A typical
! complete file name would be ~/News/overview.nnimap.pdc.INBOX.ding, or
! ~/News/overview/nnimap/pdc/INBOX/ding if `gnus-use-long-file-name' is
  nil")
  
+ (defvoo nnimap-nov-is-evil t
+   "Disable usage of NOV caches")
+ 
  (defvoo nnimap-expunge-on-close 'always ; 'ask, 'never
    "When a IMAP group with articles marked for deletion is closed, this
  variable determine if nnimap should actually remove the articles or
***************
*** 353,369 ****
  (defun nnimap-retrieve-headers-get-uids (articles fetch-old)
    (with-current-buffer nnimap-server-buffer
      (if (numberp (car articles))
! 	(if (and fetch-old (not (numberp fetch-old)))
! 	    (let ((imap-fetch-data-hook '(nnimap-retrieve-headers-store-uids))
! 		  nnimap-uids)
  	      (imap-fetch "1:*" "UID")
! 	      (nreverse nnimap-uids))
! 	  articles)
        (mapcar (lambda (msgid)
  		(imap-search 
  		 (format "HEADER Message-Id %s" msgid)))
  	      articles))))
  
  (deffoo nnimap-retrieve-headers (articles &optional group server fetch-old)
    (when (nnimap-possibly-change-group group server)
      (with-current-buffer nntp-server-buffer
--- 336,374 ----
  (defun nnimap-retrieve-headers-get-uids (articles fetch-old)
    (with-current-buffer nnimap-server-buffer
      (if (numberp (car articles))
! 	(let ((imap-fetch-data-hook '(nnimap-retrieve-headers-store-uids))
! 	      nnimap-uids)
! 	  (if (and fetch-old (not (numberp fetch-old)))
  	      (imap-fetch "1:*" "UID")
! 	    (imap-fetch (nnimap-range-to-string
! 			 (gnus-compress-sequence articles t)) "UID"))
! 	  (nreverse nnimap-uids))
        (mapcar (lambda (msgid)
  		(imap-search 
  		 (format "HEADER Message-Id %s" msgid)))
  	      articles))))
  
+ (defun nnimap-group-overview-filename (group server)
+   "Make pathname for GROUP."
+   (let ((dir (file-name-as-directory (expand-file-name nnimap-directory)))
+ 	(file (concat nnimap-nov-file-name server "." 
+ 		      (nnheader-translate-file-chars group))))
+     (if (or nnmail-use-long-file-names
+ 	    (file-directory-p (concat dir file)))
+ 	(concat dir file)
+       (concat dir (mm-encode-coding-string
+ 		   (nnheader-replace-chars-in-string file ?. ?/)
+ 		   nnmail-pathname-coding-system)))))
+ 
+ (defun nnimap-retrieve-headers-from-file (articles group server)
+   (with-current-buffer nntp-server-buffer
+     (erase-buffer)
+     (let ((nov (nnimap-group-overview-filename group server)))
+       (when (file-exists-p nov)
+ 	(nnheader-insert-file-contents nov)
+ 	(nnheader-nov-delete-outside-range (car articles) 
+ 					   (car (last articles)))))))
+ 
  (deffoo nnimap-retrieve-headers (articles &optional group server fetch-old)
    (when (nnimap-possibly-change-group group server)
      (with-current-buffer nntp-server-buffer
***************
*** 372,377 ****
--- 377,384 ----
  	  (imap-fetch-data-hook '(nnimap-retrieve-headers-progress))
  	  (nnimap-length (length articles))
  	  (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 "
***************
*** 379,384 ****
--- 386,392 ----
  		       "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)
  	   (nnheader-message 6 "nnimap: Receiving headers...done"))
***************
*** 487,493 ****
  	(insert (nnimap-demule 
  		 (or (imap-fetch article part prop nil nnimap-server-buffer)
  		     "")))
! 	(nnheader-ms-strip-cr))
        (if (bobp)
  	  (nnheader-report 'nnimap "No such article")
  	(cons group article)))))
--- 495,503 ----
  	(insert (nnimap-demule 
  		 (or (imap-fetch article part prop nil nnimap-server-buffer)
  		     "")))
! 	(nnheader-ms-strip-cr)
! 	(gnus-message 9 "nnimap: Fetching (part of) article %d...done"
! 		      article))
        (if (bobp)
  	  (nnheader-report 'nnimap "No such article")
  	(cons group article)))))
***************
*** 559,568 ****
  		      nnimap-server-buffer (cdr pattern) t (car pattern)))
  	  (or (member "\\NoSelect" 
  		      (imap-mailbox-get 'list-flags mbx nnimap-server-buffer))
! 	      ;; We ignore groups with spaces (Gnus can't handle them)
! 	      (string-match " " mbx)
  	      ;; We lie about high/low article number
! 	      (insert (format "%s 0 1 y\n" mbx)))))
        (gnus-message 5 "nnimap: Generating active list for %s...done" server))
      t))
  
--- 569,580 ----
  		      nnimap-server-buffer (cdr pattern) t (car pattern)))
  	  (or (member "\\NoSelect" 
  		      (imap-mailbox-get 'list-flags mbx nnimap-server-buffer))
! 	      ;; Quote mailboxes if they contain SPC
! 	      ;; xxx relies on internal knowledge of gnus, breaks nntp rfc
  	      ;; We lie about high/low article number
! 	      (if (string-match " " mbx)
! 		  (insert (format "\"%s\" 0 1 y\n" mbx))
! 		(insert (format "%s 0 1 y\n" mbx))))))
        (gnus-message 5 "nnimap: Generating active list for %s...done" server))
      t))
  
***************
*** 589,638 ****
  
  (deffoo nnimap-request-update-info-internal (group info &optional server)
    (when (nnimap-possibly-change-group group server)
!     (with-current-buffer nnimap-server-buffer
!       (gnus-message 5 "nnimap: Updating info for %s..." (gnus-info-group info))
! 
!       (when (nnimap-mark-permanent-p 'read)
! 	(gnus-info-set-read 
! 	 info
! 	 (let (seen unseen)
! 	   ;; read info could contain articles marked unread by other
! 	   ;; imap clients!  we correct this
! 	   (setq seen (gnus-uncompress-range (gnus-info-read info))
! 		 unseen (imap-search "UNSEEN UNDELETED")
! 		 seen (gnus-set-difference seen unseen)
! 	   ;; seen might lack articles marked as read by other
! 	   ;; imap clients! we correct this
! 		 seen (append seen (imap-search "SEEN"))
! 	   ;; remove dupes
! 		 seen (sort seen '<)
! 		 seen (gnus-compress-sequence seen t))
! 	   ;; we can't return '(1) since this isn't a "list of ranges",
! 	   ;; and we can't return '((1)) since gnus-list-of-unread-articles
! 	   ;; is buggy so we return '((1 . 1)).
!  	   (if (and (integerp (car seen))
!  		    (null (cdr seen)))
!  	       (list (cons (car seen) (car seen)))
!  	     seen))))
! 
!       (mapc (lambda (pred)
! 	      (when (and (nnimap-mark-permanent-p (cdr pred))
! 			 (member (nnimap-mark-to-flag (cdr pred))
! 				 (imap-mailbox-get 'flags)))
! 		(gnus-info-set-marks
! 		 info
! 		 (nnimap-update-alist-soft
! 		  (cdr pred)
! 		  (gnus-compress-sequence
! 		   (imap-search (nnimap-mark-to-predicate (cdr pred))))
! 		  (gnus-info-marks info))
! 		 t)))
! 	    gnus-article-mark-lists)
! 
!       (gnus-message 5 "nnimap: Updating info for %s...done"
! 		    (gnus-info-group info))
!       
!       info)))
  
  (deffoo nnimap-request-type (group &optional article)
    'mail)
--- 601,652 ----
  
  (deffoo nnimap-request-update-info-internal (group info &optional server)
    (when (nnimap-possibly-change-group group server)
!     (when info ;; xxx what does this mean? should we create a info?
!       (with-current-buffer nnimap-server-buffer
! 	(gnus-message 5 "nnimap: Updating info for %s..."
! 		      (gnus-info-group info))
! 	
! 	(when (nnimap-mark-permanent-p 'read)
! 	  (gnus-info-set-read 
! 	   info
! 	   (let (seen unseen)
! 	     ;; read info could contain articles marked unread by other
! 	     ;; imap clients!  we correct this
! 	     (setq seen (gnus-uncompress-range (gnus-info-read info))
! 		   unseen (imap-search "UNSEEN UNDELETED")
! 		   seen (gnus-set-difference seen unseen)
! 	     ;; seen might lack articles marked as read by other
! 	     ;; imap clients! we correct this
! 		   seen (append seen (imap-search "SEEN"))
! 	     ;; remove dupes
! 		   seen (sort seen '<)
! 		   seen (gnus-compress-sequence seen t))
! 	     ;; we can't return '(1) since this isn't a "list of ranges",
! 	     ;; and we can't return '((1)) since gnus-list-of-unread-articles
! 	     ;; is buggy so we return '((1 . 1)).
! 	     (if (and (integerp (car seen))
! 		      (null (cdr seen)))
! 		 (list (cons (car seen) (car seen)))
! 	       seen))))
! 
! 	(mapc (lambda (pred)
! 		(when (and (nnimap-mark-permanent-p (cdr pred))
! 			   (member (nnimap-mark-to-flag (cdr pred))
! 				   (imap-mailbox-get 'flags)))
! 		  (gnus-info-set-marks
! 		   info
! 		   (nnimap-update-alist-soft
! 		    (cdr pred)
! 		    (gnus-compress-sequence
! 		     (imap-search (nnimap-mark-to-predicate (cdr pred))))
! 		    (gnus-info-marks info))
! 		   t)))
! 	      gnus-article-mark-lists)
! 	
! 	(gnus-message 5 "nnimap: Updating info for %s...done"
! 		      (gnus-info-group info))
! 	
! 	info))))
  
  (deffoo nnimap-request-type (group &optional article)
    'mail)
***************
*** 767,775 ****
    (let ((date (format-time-string "%d-%b-%Y" 
  				  (nnimap-time-substract
  				   (current-time)
! 				   (if (fboundp 'days-to-time)
! 				       (days-to-time daysago)
! 				     (nnmail-days-to-time daysago))))))
      (if (eq ?0 (string-to-char date))
  	(substring date 1)
        date)))
--- 781,787 ----
    (let ((date (format-time-string "%d-%b-%Y" 
  				  (nnimap-time-substract
  				   (current-time)
! 				   (days-to-time daysago)))))
      (if (eq ?0 (string-to-char date))
  	(substring date 1)
        date)))
Index: nnimap/utf7.el
diff -c nnimap/utf7.el:1.2 nnimap/utf7.el:1.4
*** nnimap/utf7.el:1.2	Thu Jun 24 09:37:11 1999
--- nnimap/utf7.el	Sat Jun 26 07:51:06 1999
***************
*** 2,8 ****
  
  ;; Copyright (C) 1999 by Jon K Hellan <hellan@item.ntnu.no>
  
! ;; Author: Jon K Hellan <jk@parus.itea.ntnu.no>
  ;; Keywords: mail
  
  ;; This file is part of GNU Emacs, but the same permissions apply
--- 2,8 ----
  
  ;; Copyright (C) 1999 by Jon K Hellan <hellan@item.ntnu.no>
  
! ;; Author: Jon K Hellan <hellan@item.ntnu.no>
  ;; Keywords: mail
  
  ;; This file is part of GNU Emacs, but the same permissions apply
***************
*** 53,85 ****
    (concat utf7-direct-encoding-chars "+\\~")
    "Characters ranges which do not need escaping in the IMAP variant of UTF-7")
  
! (defun utf7-encode-region (start end &optional for-imap)
!   "Encode text from START to END in buffer as UTF-7.
  Use IMAP modification if FOR-IMAP is non-nil."
!   (interactive "*r\nP")
!   (save-excursion
!     (save-restriction
!       (narrow-to-region start end)
!       (goto-char start)
!       (let ((esc-char (if for-imap ?& ?+))
! 	    (direct-encoding-chars 
! 	     (if for-imap utf7-imap-direct-encoding-chars
! 	       utf7-direct-encoding-chars)))
! 	(while (not (eobp))
! 	  (skip-chars-forward direct-encoding-chars)
! 	  (unless (eobp)
! 	    (insert esc-char)
! 	    (let ((p (point))
! 		  (fc (following-char))
! 		  (run-length 
! 		   (skip-chars-forward (concat "^" direct-encoding-chars))))
! 	      (if (and (= fc esc-char)
! 		       (= run-length 1)) ; Lone esc-char?
! 		  (delete-backward-char 1) ; Now there's one too many
! 		(utf7-fragment-encode-region p (point) for-imap)
! 		(insert "-")))))))))
  
! (defun utf7-fragment-encode-region (start end &optional for-imap)
    "Encode text from START to END in buffer as UTF-7 escape fragment.
  Use IMAP modification if FOR-IMAP is non-nil."
    (save-restriction
--- 53,84 ----
    (concat utf7-direct-encoding-chars "+\\~")
    "Characters ranges which do not need escaping in the IMAP variant of UTF-7")
  
! (defun utf7-encode-internal (&optional for-imap)
!   "Encode text in (temporary) buffer as UTF-7.
  Use IMAP modification if FOR-IMAP is non-nil."
!   (let ((start (point-min))
! 	(end (point-max)))
!     (narrow-to-region start end)
!     (goto-char start)
!     (let ((esc-char (if for-imap ?& ?+))
! 	  (direct-encoding-chars 
! 	   (if for-imap utf7-imap-direct-encoding-chars
! 	     utf7-direct-encoding-chars)))
!       (while (not (eobp))
! 	(skip-chars-forward direct-encoding-chars)
! 	(unless (eobp)
! 	  (insert esc-char)
! 	  (let ((p (point))
! 		(fc (following-char))
! 		(run-length 
! 		 (skip-chars-forward (concat "^" direct-encoding-chars))))
! 	    (if (and (= fc esc-char)
! 		     (= run-length 1))	; Lone esc-char?
! 		(delete-backward-char 1) ; Now there's one too many
! 	      (utf7-fragment-encode p (point) for-imap))
! 	    (insert "-")))))))
  
! (defun utf7-fragment-encode (start end &optional for-imap)
    "Encode text from START to END in buffer as UTF-7 escape fragment.
  Use IMAP modification if FOR-IMAP is non-nil."
    (save-restriction
***************
*** 98,139 ****
        ;; We strip whitespace at end, because base64 may include garbage.
        (delete-region (point) pm))))
  
! (defun utf7-decode-region (start end &optional for-imap)
!   "Decode UTF-7 text from START to END in buffer.
  Use IMAP modification if FOR-IMAP is non-nil."
!   (interactive "*r\nP")
!   (save-excursion
!     (save-restriction
!       (narrow-to-region start end)
!       (goto-char start)
!       (let* ((esc-pattern (concat "^" (char-to-string (if for-imap ?& ?+))))
! 	     (base64-chars (concat "A-Za-z0-9+" 
! 				   (char-to-string (if for-imap ?, ?/)))))
! 	(while (not (eobp))
! 	  (skip-chars-forward esc-pattern)
! 	  (unless (eobp)
! 	    (forward-char)
! 	    (let ((p (point))
! 		  (run-length (skip-chars-forward base64-chars)))
! 	      (when (and (not (eobp)) (= (following-char) ?-))
! 		(delete-char 1))
! 	      (unless (= run-length 0) ; Encoded lone esc-char?
! 		(save-excursion
! 		  (utf7-fragment-decode-region p (point) for-imap)
! 		  (goto-char p)
! 		  (delete-backward-char 1))))))))))
  
! (defun utf7-fragment-decode-region (start end &optional for-imap)
    "Decode base64 encoded fragment from START to END of UTF-7 text in buffer.
  Use IMAP modification if FOR-IMAP is non-nil."
    (save-restriction
      (narrow-to-region start end)
      (if for-imap
! 	(utf7-imap-fragment-decode-region start end)
        (base64-decode-region start end))
      (funcall (utf7-get-u16char-converter 'from-utf-16))))
  
! (defun utf7-imap-fragment-decode-region (start end)
    "Decode base64 encoded fragment from START to END of UTF-7 text in buffer.
  Use IMAP modification."
    (goto-char start)
--- 97,136 ----
        ;; We strip whitespace at end, because base64 may include garbage.
        (delete-region (point) pm))))
  
! (defun utf7-decode-internal (&optional for-imap)
!   "Decode UTF-7 text in (temporary) buffer.
  Use IMAP modification if FOR-IMAP is non-nil."
!   (let ((start (point-min))
! 	(end (point-max)))
!     (goto-char start)
!     (let* ((esc-pattern (concat "^" (char-to-string (if for-imap ?& ?+))))
! 	   (base64-chars (concat "A-Za-z0-9+" 
! 				 (char-to-string (if for-imap ?, ?/)))))
!       (while (not (eobp))
! 	(skip-chars-forward esc-pattern)
! 	(unless (eobp)
! 	  (forward-char)
! 	  (let ((p (point))
! 		(run-length (skip-chars-forward base64-chars)))
! 	    (when (and (not (eobp)) (= (following-char) ?-))
! 	      (delete-char 1))
! 	    (unless (= run-length 0)	; Encoded lone esc-char?
! 	      (save-excursion
! 		(utf7-fragment-decode p (point) for-imap)
! 		(goto-char p)
! 		(delete-backward-char 1)))))))))
  
! (defun utf7-fragment-decode (start end &optional for-imap)
    "Decode base64 encoded fragment from START to END of UTF-7 text in buffer.
  Use IMAP modification if FOR-IMAP is non-nil."
    (save-restriction
      (narrow-to-region start end)
      (if for-imap
! 	(utf7-imap-fragment-decode start end)
        (base64-decode-region start end))
      (funcall (utf7-get-u16char-converter 'from-utf-16))))
  
! (defun utf7-imap-fragment-decode (start end)
    "Decode base64 encoded fragment from START to END of UTF-7 text in buffer.
  Use IMAP modification."
    (goto-char start)
***************
*** 160,171 ****
  
  (defun utf7-u16-latin1-char-converter ()
    "Convert 16 bit Unicode characters to latin 1 (ISO-8859.1).
! Character are in character pairs in narrowed buffer."
    (goto-char (point-min))
    (while (not (eobp))
      (if (= 0 (following-char))
  	(delete-char 1)
-       ;; This is not quite right. The throw makes the decode not undoable
  	(error "Unable to convert from Unicode"))
      (forward-char)))
  
--- 157,167 ----
  
  (defun utf7-u16-latin1-char-converter ()
    "Convert 16 bit Unicode characters to latin 1 (ISO-8859.1).
! Characters are in character pairs in narrowed buffer."
    (goto-char (point-min))
    (while (not (eobp))
      (if (= 0 (following-char))
  	(delete-char 1)
  	(error "Unable to convert from Unicode"))
      (forward-char)))
  
***************
*** 175,191 ****
  
  (defun utf7-encode (string &optional for-imap)
    "Encode UTF-7 string. Use IMAP modification if FOR-IMAP is non-nil."
!   (with-temp-buffer
!     (insert string)
!     (utf7-encode-region (point-min) (point-max) for-imap)
!     (buffer-string)))
  
  (defun utf7-decode (string &optional for-imap)
    "Decode UTF-7 string. Use IMAP modification if FOR-IMAP is non-nil."
!   (with-temp-buffer
!     (insert string)
!     (utf7-decode-region (point-min) (point-max) for-imap)
!     (buffer-string)))
  
  (provide 'utf7)
  
--- 171,189 ----
  
  (defun utf7-encode (string &optional for-imap)
    "Encode UTF-7 string. Use IMAP modification if FOR-IMAP is non-nil."
!   (let ((default-enable-multibyte-characters nil))
!     (with-temp-buffer
!       (insert string)
!       (utf7-encode-internal for-imap)
!       (buffer-string))))
  
  (defun utf7-decode (string &optional for-imap)
    "Decode UTF-7 string. Use IMAP modification if FOR-IMAP is non-nil."
!   (let ((default-enable-multibyte-characters nil))
!     (with-temp-buffer
!       (insert string)
!       (utf7-decode-internal for-imap)
!       (buffer-string))))
  
  (provide 'utf7)