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

nnimap 0.124 -> 0.125 patches



Index: nnimap/ChangeLog
diff -c nnimap/ChangeLog:1.258 nnimap/ChangeLog:1.262
*** nnimap/ChangeLog:1.258	Sat Jul 17 13:55:04 1999
--- nnimap/ChangeLog	Sun Jul 18 12:28:32 1999
***************
*** 1,3 ****
--- 1,34 ----
+ 1999-07-18  Simon Josefsson  <jas@pdc.kth.se>
+ 
+ 	* nnimap 0.125 released.
+ 
+ 	* nnimap.el (nnimap-news-groups): New variable.
+ 	(nnimap-request-type): Use it.
+ 	(nnimap-directory): Change default. Doc fix.
+ 	(nnimap-nov-file-name): Ditto.
+ 	(nnimap-nov-is-evil): Doc fix.
+ 	(nnimap-progress-chars): New variable.
+ 	(nnimap-progress-how-often): Ditto.
+ 	(nnimap-retrieve-headers-progress): No percentile progress.
+ 	(nnimap-retrieve-headers-store-uids): Removed.
+ 	(nnimap-retrieve-headers-get-uids): Renamed to
+ 	`nnimap-retrieve-which-headers'. Don't search for uids. Handle
+ 	numeric fetch-old.
+ 	(nnimap-group-overview-filename): Empty servers are called
+ 	"unnamed".
+ 	(nnimap-retrieve-headers-from-file): Return low/high article number.
+ 	(nnimap-retrieve-headers-from-server): New function.
+ 	(nnimap-retrieve-headers): Cache nov lines.
+ 
+ 1999-07-18  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+ 
+ 	* nnimap.el: Post-mail backend.
+ 
+ 1999-07-18  Simon Josefsson  <jas@pdc.kth.se>
+ 
+ 	* nnimap.el (nnimap-request-post): Create group if
+ 	necessery. Handle errors.
+ 
  1999-07-17  Simon Josefsson  <jas@pdc.kth.se>
  
  	* nnimap 0.124 released.
Index: nnimap/imap.el
diff -c nnimap/imap.el:1.159 nnimap/imap.el:1.160
*** nnimap/imap.el:1.159	Sat Jul 17 13:41:29 1999
--- nnimap/imap.el	Sat Jul 17 14:17:19 1999
***************
*** 2121,2131 ****
    (buffer-disable-undo (get-buffer-create imap-debug))
    (mapc (lambda (f) (trace-function-background f imap-debug)) 
          '(
- imap-encode-string
  imap-read-passwd
  imap-kerberos4s-p
  imap-kerberos4-open
  imap-ssl-p
  imap-ssl-open-1
  imap-ssl-open
  imap-network-p
--- 2121,2132 ----
    (buffer-disable-undo (get-buffer-create imap-debug))
    (mapc (lambda (f) (trace-function-background f imap-debug)) 
          '(
  imap-read-passwd
+ imap-error-text
  imap-kerberos4s-p
  imap-kerberos4-open
  imap-ssl-p
+ imap-ssl-open-2
  imap-ssl-open-1
  imap-ssl-open
  imap-network-p
***************
*** 2138,2144 ****
  imap-login-p
  imap-login-auth
  imap-anonymous-p
! imap-anonymous-open
  imap-open-1
  imap-open
  imap-opened
--- 2139,2145 ----
  imap-login-p
  imap-login-auth
  imap-anonymous-p
! imap-anonymous-auth
  imap-open-1
  imap-open
  imap-opened
***************
*** 2150,2159 ****
--- 2151,2166 ----
  imap-mailbox-put
  imap-mailbox-get
  imap-mailbox-map
+ imap-current-mailbox
+ imap-current-mailbox-p
  imap-mailbox-select
+ imap-mailbox-examine
  imap-mailbox-unselect
+ imap-mailbox-expunge
  imap-mailbox-close
  imap-mailbox-create
+ imap-mailbox-delete
+ imap-mailbox-rename
  imap-mailbox-lsub
  imap-mailbox-list
  imap-mailbox-subscribe
***************
*** 2162,2176 ****
--- 2169,2190 ----
  imap-mailbox-acl-get
  imap-mailbox-acl-set
  imap-mailbox-acl-delete
+ imap-list-to-message-set
+ imap-fetch
  imap-message-put
  imap-message-get
  imap-message-map
  imap-search
+ imap-message-flag-permanent-p
  imap-message-flags-set
  imap-message-flags-del
  imap-message-flags-add
+ imap-message-appenduid
+ imap-message-copyuid
  imap-message-copy
  imap-message-append
+ imap-body-lines
+ imap-envelope-from
  imap-send-command-1
  imap-send-command
  imap-wait-for-tag
***************
*** 2187,2192 ****
--- 2201,2207 ----
  imap-parse-acl
  imap-parse-flag-list
  imap-parse-envelope
+ imap-parse-body-extension
  imap-parse-body
  	  )))
  	
Index: nnimap/nnimap.el
diff -c nnimap/nnimap.el:1.209 nnimap/nnimap.el:1.212
*** nnimap/nnimap.el:1.209	Sat Jul 17 13:40:08 1999
--- nnimap/nnimap.el	Sun Jul 18 12:25:12 1999
***************
*** 37,49 ****
  ;;
  ;; Todo, minor things:
  ;;
  ;;   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 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
--- 37,49 ----
  ;;
  ;; Todo, minor things:
  ;;
+ ;;   o Support NOV nnmail-extra-headers.
  ;;   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 What do I do with gnus-newsgroup-*?
  ;;   o Tell Gnus about new groups (how can we tell?)
  ;;   o Add asynchronous support
  ;;   o Respooling (fix Gnus?) (unnecessery?)
  ;;   o Add support for the following: (if applicable)
  ;;       request-list-newsgroups, request-regenerate
***************
*** 66,78 ****
  (require 'mm-util)
  (require 'gnus)
  (require 'gnus-range)
  
  (nnoo-declare nnimap)
  
! (gnus-declare-backend "nnimap" 'mail 'address 'prompt-address
  		      'physical-address)
  
! (defconst nnimap-version "nnimap 0.124")
  
  (defvoo nnimap-address nil
    "Address of physical IMAP server.  If nil, use the virtual server's name.")
--- 66,80 ----
  (require 'mm-util)
  (require 'gnus)
  (require 'gnus-range)
+ (require 'gnus-start)
+ (require 'gnus-int)
  
  (nnoo-declare nnimap)
  
! (gnus-declare-backend "nnimap" 'post-mail 'address 'prompt-address
  		      'physical-address)
  
! (defconst nnimap-version "nnimap 0.125")
  
  (defvoo nnimap-address nil
    "Address of physical IMAP server.  If nil, use the virtual server's name.")
***************
*** 155,172 ****
  
  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
--- 157,178 ----
  
  Possible choices: kerberos4, cram-md5, login, anonymous.")
  
! (defvoo nnimap-directory (nnheader-concat gnus-directory "overview/")
!   "Directory to keep NOV cache files for nnimap groups. See also
! `nnimap-nov-file-name'.")
  
! (defvoo nnimap-nov-file-name "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 `nnmail-use-long-file-names'
! is nil")
! 
! (defvoo nnimap-nov-is-evil nil
!   "If non-nil, nnimap will never generate or use a local nov database
! for this backend.  Using nov databases will speed up header fetching
! considerably. Unlike other backends, you do not need to take special
! care if you flip this variable.")
  
  (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
***************
*** 194,199 ****
--- 200,222 ----
  There are two wildcards * and %. * matches everything, % matches
  everything in the current hierarchy.")
  
+ (defvoo nnimap-news-groups nil
+   "IMAP support a news-like mode, also known as bulletin board mode,
+ where replies is sent via IMAP instead of SMTP.
+ 
+ This variable should contain a regexp matching groups where you wish
+ replies to be stored to the mailbox directly.
+ 
+ Example:
+   '(\"^[^I][^N][^B][^O][^X].*$\")
+ 
+ This will match all groups not beginning with \"INBOX\".
+ 
+ Note that there is nothing technically different between mail-like and
+ news-like mailboxes. If you wish to have a group with todo items or
+ similar which you wouldn't want to set up a mailing list for, you can
+ use this to make replies go directly to the group.")
+ 
  (defvoo nnimap-server-address nil
    "Obsolete. Use `nnimap-address'.")
  
***************
*** 221,228 ****
  (defvar nnimap-current-move-group nil)
  (defvar nnimap-current-move-article nil)
  (defvar nnimap-length)
  (defvar nnimap-counter)
- (defvar nnimap-uids)
  
  ;; Various server variables.
  
--- 244,252 ----
  (defvar nnimap-current-move-group nil)
  (defvar nnimap-current-move-article nil)
  (defvar nnimap-length)
+ (defvar nnimap-progress-chars '(?| ?/ ?- ?\\))
+ (defvar nnimap-progress-how-often 20)
  (defvar nnimap-counter)
  
  ;; Various server variables.
  
***************
*** 311,320 ****
  
  (defun nnimap-retrieve-headers-progress ()
    (and (numberp nnmail-large-newsgroup)
         (> nnimap-length nnmail-large-newsgroup)
!        (zerop (% (incf nnimap-counter) 20))
!        (nnheader-message 6 "nnimap: Receiving headers... %d%%"
! 			 (/ (* nnimap-counter 100) nnimap-length)))
    (with-current-buffer nntp-server-buffer
      (nnheader-insert-nov
       (with-current-buffer nnimap-server-buffer
--- 335,348 ----
  
  (defun nnimap-retrieve-headers-progress ()
    (and (numberp nnmail-large-newsgroup)
+        (zerop (% (incf nnimap-counter) nnimap-progress-how-often))
         (> nnimap-length nnmail-large-newsgroup)
!        (nnheader-message 6 "nnimap: Retrieving headers... %c"
! 			 (nth (/ (% nnimap-counter 
! 				    (* (length nnimap-progress-chars) 
! 				       nnimap-progress-how-often))
! 				 nnimap-progress-how-often)
! 			      nnimap-progress-chars)))
    (with-current-buffer nntp-server-buffer
      (nnheader-insert-nov
       (with-current-buffer nnimap-server-buffer
***************
*** 348,414 ****
  	       nil ;; xref
  	       nil))))) ;; extra-headers
  
! (defun nnimap-retrieve-headers-store-uids ()
!   (setq nnimap-uids (cons imap-current-message nnimap-uids)))
! 
! (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)
  	(mm-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
!       (erase-buffer))
!     (let ((uids (nnimap-retrieve-headers-get-uids articles fetch-old))
! 	  (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
!       (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)
! 	   (nnheader-message 6 "nnimap: Receiving headers...done"))
        'nov)))
  
  (defun nnimap-open-connection (server)
--- 376,476 ----
  	       nil ;; xref
  	       nil))))) ;; extra-headers
  
! (defun nnimap-retrieve-which-headers (articles fetch-old)
!   ;; get a range of articles to fetch based on articles and fetch-old
    (with-current-buffer nnimap-server-buffer
!     (if (numberp (car-safe articles))
! 	(append (gnus-uncompress-sequence
! 		 (and fetch-old
! 		      (cons (if (numberp fetch-old)
! 				(max 1 (- (car articles) fetch-old))
! 			      1)
! 			    (1- (car articles)))))
! 		articles)
        (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 (nnheader-translate-file-chars 
! 	       (concat nnimap-nov-file-name (if (equal server "")
! 						"unnamed"
! 					      server) "." group) t)))
      (if (or nnmail-use-long-file-names
! 	    (file-exists-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 (group server)
    (with-current-buffer nntp-server-buffer
      (let ((nov (nnimap-group-overview-filename group server)))
        (when (file-exists-p nov)
  	(mm-insert-file-contents nov)
! 	(set-buffer-modified-p nil)
! 	(let ((min (progn (goto-char (point-min))
! 			  (when (not (eobp))
! 			    (read (current-buffer)))))
! 	      (max (progn (goto-char (point-max))
! 			  (forward-line -1)
! 			  (when (not (bobp))
! 			    (read (current-buffer))))))
! 	  (if (and (numberp min) (numberp max))
! 	      (cons min max)
! 	    ;; junk, remove it, it's saved later
! 	    (erase-buffer)
! 	    nil))))))
! 
! (defun nnimap-retrieve-headers-from-server (articles group server)
!   (let ((imap-fetch-data-hook '(nnimap-retrieve-headers-progress))
! 	(nnimap-length (gnus-range-length articles))
! 	(nnimap-counter 0))
!     (imap-fetch (nnimap-range-to-string articles)
! 		(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)
!     (and (numberp nnmail-large-newsgroup)
! 	 (> nnimap-length nnmail-large-newsgroup)
! 	 (nnheader-message 6 "nnimap: Retrieving headers...done"))))
  
  (deffoo nnimap-retrieve-headers (articles &optional group server fetch-old)
    (when (nnimap-possibly-change-group group server)
      (with-current-buffer nntp-server-buffer
!       (erase-buffer)
!       (when (setq articles (nnimap-retrieve-which-headers articles fetch-old))
! 	(if (or gnus-nov-is-evil nnimap-nov-is-evil)
! 	    (nnimap-retrieve-headers-from-server
! 	     (gnus-compress-sequence articles) group server)
! 	  (let (cached (low (car articles)) (high (car (last articles))))
! 	    (if (setq cached (nnimap-retrieve-headers-from-file group server))
! 		(progn
! 		  ;; fetch articles before cache block
! 		  (goto-char (point-min))
! 		  (if (< low (car cached))
! 		      (nnimap-retrieve-headers-from-server
! 		       (cons low (1- (car cached))) group server))
! 		  ;; fetch articles after cache block
! 		  (goto-char (point-max))
! 		  (if (> high (cdr cached))
! 		      (nnimap-retrieve-headers-from-server
! 		       (cons (1+ (cdr cached)) high) group server)))
! 	      ;; nothing cached, fetch whole range from server
! 	      (nnimap-retrieve-headers-from-server (cons low high) group
! 						   server))
! 	    (when (buffer-modified-p)
! 	      (gnus-make-directory
! 	       (file-name-directory
! 		(nnimap-group-overview-filename group server)))
! 	      (nnmail-write-region
! 	       1 (point-max) (nnimap-group-overview-filename group server)
! 	       nil 'nomesg))
! 	    (nnheader-nov-delete-outside-range low high))))
        'nov)))
  
  (defun nnimap-open-connection (server)
***************
*** 605,613 ****
      t))
  
  (deffoo nnimap-request-post (&optional server)
!   (dolist  (mbx (message-tokenize-header (message-fetch-field "Newsgroups")))
!     (nnimap-request-accept-article mbx (nth 1 gnus-command-method)))
!   t)
  
  ;; Optional backend functions
  
--- 667,688 ----
      t))
  
  (deffoo nnimap-request-post (&optional server)
!   (let ((success t))
!     (dolist  (mbx (message-tokenize-header
! 		   (message-fetch-field "Newsgroups")) success)
!       (let ((to-newsgroup (gnus-group-prefixed-name mbx gnus-command-method)))
! 	(or (gnus-active to-newsgroup)
! 	    (gnus-activate-group to-newsgroup)
! 	    (if (gnus-y-or-n-p (format "No such group: %s.  Create it? "
! 				       to-newsgroup))
! 		(or (and (gnus-request-create-group
! 			  to-newsgroup gnus-command-method)
! 			 (gnus-activate-group to-newsgroup nil nil
! 					      gnus-command-method))
! 		    (error "Couldn't create group %s" to-newsgroup)))
! 	    (error "No such group: %s" to-newsgroup))
! 	(unless (nnimap-request-accept-article mbx (nth 1 gnus-command-method))
! 	  (setq success nil))))))
  
  ;; Optional backend functions
  
***************
*** 679,685 ****
  	info))))
  
  (deffoo nnimap-request-type (group &optional article)
!   'mail)
  
  (deffoo nnimap-request-set-mark (group actions &optional server)
    (when (nnimap-possibly-change-group group server)
--- 754,762 ----
  	info))))
  
  (deffoo nnimap-request-type (group &optional article)
!   (if (and nnimap-news-groups (string-match nnimap-news-groups group))
!       'news
!     'mail))
  
  (deffoo nnimap-request-set-mark (group actions &optional server)
    (when (nnimap-possibly-change-group group server)
***************
*** 1132,1141 ****
  nnimap-possibly-change-group
  ;nnimap-replace-whitespace
  nnimap-retrieve-headers-progress
! ;nnimap-retrieve-headers-store-uids
! nnimap-retrieve-headers-get-uids
  nnimap-group-overview-filename
  nnimap-retrieve-headers-from-file
  nnimap-retrieve-headers
  nnimap-open-connection
  nnimap-open-server
--- 1209,1218 ----
  nnimap-possibly-change-group
  ;nnimap-replace-whitespace
  nnimap-retrieve-headers-progress
! nnimap-retrieve-headers-get-range
  nnimap-group-overview-filename
  nnimap-retrieve-headers-from-file
+ nnimap-retrieve-headers-from-server
  nnimap-retrieve-headers
  nnimap-open-connection
  nnimap-open-server