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

nnimap 0.107 -> 0.108 patches



Index: nnimap/ChangeLog
diff -c nnimap/ChangeLog:1.211 nnimap/ChangeLog:1.216
*** nnimap/ChangeLog:1.211	Mon May 24 06:33:12 1999
--- nnimap/ChangeLog	Wed May 26 14:12:23 1999
***************
*** 1,3 ****
--- 1,21 ----
+ 1999-05-26  Simon Josefsson  <jas@pdc.kth.se>
+ 
+ 	* nnimap 0.108 released.
+ 
+ 	* imap.el (imap-parse-header-list): New function.
+ 	(imap-parse-fetch-body-section): New function.
+ 	(imap-parse-fetch): Use it.
+ 
+ 	* nnimap.el (nnimap-retrieve-headers-progress): Use new syntax.
+ 
+ 	* imap.el (imap-parse-astring): Handle atoms better.
+ 
+ 	* nnimap.el (nnimap-split-to-groups): Rules can be a function.
+ 
+ 	* nnimap.el (nnimap-replace-tabs): Removed.
+ 	(nnimap-replace-whitespace): New function.
+ 	(nnimap-retrieve-headers-progress): Use it.
+ 
  1999-05-24  Simon Josefsson  <jas@pdc.kth.se>
  
  	* nnimap 0.107 released.
Index: nnimap/imap.el
diff -c nnimap/imap.el:1.136 nnimap/imap.el:1.138
*** nnimap/imap.el:1.136	Mon May 24 06:33:28 1999
--- nnimap/imap.el	Wed May 26 14:01:40 1999
***************
*** 1278,1284 ****
  
  (defsubst imap-parse-astring ()
    (or (imap-parse-string)
!       (buffer-substring (point) (re-search-forward " \r\n" nil t))))
  
  ;;   address         = "(" addr-name SP addr-adl SP addr-mailbox SP
  ;;                      addr-host ")"
--- 1278,1288 ----
  
  (defsubst imap-parse-astring ()
    (or (imap-parse-string)
!       (buffer-substring (point) 
! 			(if (re-search-forward "[(){ \r\n%*\"\\]" nil t)
! 			    (goto-char (1- (match-end 0)))
! 			  (end-of-line)
! 			  (point)))))
  
  ;;   address         = "(" addr-name SP addr-adl SP addr-mailbox SP
  ;;                      addr-host ")"
***************
*** 1619,1624 ****
--- 1623,1646 ----
  ;;  
  ;;  header_list     ::= "(" 1#header_fld_name ")"
  
+ (defsubst imap-parse-header-list ()
+   (when (eq (char-after) ?\()
+     (let (strlist str)
+       (while (not (eq (char-after) ?\)))
+ 	(imap-forward)
+ 	(push (imap-parse-astring) strlist))
+       (imap-forward)
+       (nreverse strlist))))
+ 
+ (defsubst imap-parse-fetch-body-section ()
+   (let ((section 
+ 	 (buffer-substring (point) (1- (re-search-forward "[] ]" nil t)))))
+     (if (eq (char-before) ? )
+ 	(prog1
+ 	    (mapconcat 'identity (cons section (imap-parse-header-list)) " ")
+ 	  (search-forward "]" nil t))
+       section)))
+ 
  (defun imap-parse-fetch (response)
    (when (eq (char-after) ?\()
      (let (uid flags envelope internaldate rfc822 rfc822header rfc822text 
***************
*** 1646,1653 ****
  		((eq token 'BODY)
  		 (if (eq (char-before) ?\[)
  		     (push (list
! 			    (upcase (buffer-substring 
! 				     (point) (1- (search-forward "]" nil t))))
  			    (and (eq (char-after) ?<)
  				 (buffer-substring (1+ (point))
  						   (search-forward ">" nil t)))
--- 1668,1674 ----
  		((eq token 'BODY)
  		 (if (eq (char-before) ?\[)
  		     (push (list
! 			    (upcase (imap-parse-fetch-body-section))
  			    (and (eq (char-after) ?<)
  				 (buffer-substring (1+ (point))
  						   (search-forward ">" nil t)))
Index: nnimap/nnimap.el
diff -c nnimap/nnimap.el:1.164 nnimap/nnimap.el:1.169
*** nnimap/nnimap.el:1.164	Mon May 24 06:33:42 1999
--- nnimap/nnimap.el	Wed May 26 14:22:30 1999
***************
*** 99,105 ****
  (gnus-declare-backend "nnimap" 'mail 'address 'prompt-address 
  		      'physical-address)
  
! (defconst nnimap-version "nnimap 0.107")
  
  (defvoo nnimap-address nil
    "Address of physical IMAP server.  If nil, use the virtual server's name.")
--- 99,105 ----
  (gnus-declare-backend "nnimap" 'mail 'address 'prompt-address 
  		      'physical-address)
  
! (defconst nnimap-version "nnimap 0.108")
  
  (defvoo nnimap-address nil
    "Address of physical IMAP server.  If nil, use the virtual server's name.")
***************
*** 292,300 ****
    (setq nnimap-current-server (or server nnimap-current-server)
  	nnimap-server-buffer (nnimap-get-server-buffer nnimap-current-server)))
  
! (defsubst nnimap-replace-tabs (string)
!   "Translate TAB characters into SPACE characters in STRING."
!   (nsubstitute ?  ?\t string))
  
  (defun nnimap-retrieve-headers-progress ()
    (and (numberp nnmail-large-newsgroup)
--- 292,303 ----
    (setq nnimap-current-server (or server nnimap-current-server)
  	nnimap-server-buffer (nnimap-get-server-buffer nnimap-current-server)))
  
! (defun nnimap-replace-whitespace (string)
!   "Return STRING with all whitespace replaced with space."
!   (when string
!     (while (string-match "[\r\n\t]+" string)
!       (setq string (replace-match " " t t string)))
!     string))
  
  (defun nnimap-retrieve-headers-progress ()
    (and (numberp nnmail-large-newsgroup)
***************
*** 305,321 ****
    (with-current-buffer nntp-server-buffer
      (nnheader-insert-nov
       (vector imap-current-message
! 	     (nnimap-replace-tabs 
  	      (imap-message-envelope-subject imap-current-message))
! 	     (nnimap-replace-tabs
  	      (imap-envelope-from
  	       (car-safe (imap-message-envelope-from
  			  imap-current-message))))
! 	     (nnimap-replace-tabs 
  	      (imap-message-envelope-date imap-current-message))
! 	     (nnimap-replace-tabs
  	      (imap-message-envelope-message-id imap-current-message))
! 	     (let ((str (nth 2 (assoc "HEADER.FIELDS (REFERENCES IN-REPLY-TO)"
  				      (imap-message-get
  				       imap-current-message 'BODYDETAIL))))
  		   out)
--- 308,324 ----
    (with-current-buffer nntp-server-buffer
      (nnheader-insert-nov
       (vector imap-current-message
! 	     (nnimap-replace-whitespace
  	      (imap-message-envelope-subject imap-current-message))
! 	     (nnimap-replace-whitespace
  	      (imap-envelope-from
  	       (car-safe (imap-message-envelope-from
  			  imap-current-message))))
! 	     (nnimap-replace-whitespace 
  	      (imap-message-envelope-date imap-current-message))
! 	     (nnimap-replace-whitespace
  	      (imap-message-envelope-message-id imap-current-message))
! 	     (let ((str (nth 2 (assoc "HEADER.FIELDS REFERENCES IN-REPLY-TO"
  				      (imap-message-get
  				       imap-current-message 'BODYDETAIL))))
  		   out)
***************
*** 566,599 ****
  	(apply 'concat (nreverse expanded))
        newtext)))
  
- ;; tries to match all rules in nnimap-split-rule against content of 
- ;; nntp-server-buffer, returns a list of groups that matched.
  (defun nnimap-split-to-groups (rules)
!   (let (to-groups regrepp)
!     (with-current-buffer nntp-server-buffer
!       ;; Fold continuation lines.
!       (goto-char (point-min))
!       (while (re-search-forward "\\(\r?\n[ \t]+\\)+" nil t)
! 	(replace-match " " t t))
!       (catch 'split-done
! 	(dolist (rule rules to-groups)
! 	  (let ((group (car rule))
! 		(regexp (cadr rule)))
! 	    (goto-char (point-min))
! 	    (when (and (if (stringp regexp)
! 			   (progn
! 			     (setq regrepp (string-match "\\\\[0-9&]" group))
! 			     (re-search-forward regexp nil t))
! 			 (funcall regexp group))
! 		       ;; Don't enter the article into the same group twice.
! 		       (not (assoc group to-groups)))
! 	      (push (if regrepp
! 			(nnimap-expand-newtext group)
! 		      group)
! 		    to-groups)
! 	      (or nnimap-split-crosspost
! 		  (throw 'split-done to-groups)))))))))
! 
  (defun nnimap-split-find-rule (server inbox)
    nnimap-split-rule)
  
--- 569,604 ----
  	(apply 'concat (nreverse expanded))
        newtext)))
  
  (defun nnimap-split-to-groups (rules)
!   ;; tries to match all rules in nnimap-split-rule against content of 
!   ;; nntp-server-buffer, returns a list of groups that matched.
!   (with-current-buffer nntp-server-buffer
!     ;; Fold continuation lines.
!     (goto-char (point-min))
!     (while (re-search-forward "\\(\r?\n[ \t]+\\)+" nil t)
!       (replace-match " " t t))
!     (if (functionp rules)
! 	(funcall rules)
!       (let (to-groups regrepp)
! 	(catch 'split-done
! 	  (dolist (rule rules to-groups)
! 	    (let ((group (car rule))
! 		  (regexp (cadr rule)))
! 	      (goto-char (point-min))
! 	      (when (and (if (stringp regexp)
! 			     (progn
! 			       (setq regrepp (string-match "\\\\[0-9&]" group))
! 			       (re-search-forward regexp nil t))
! 			   (funcall regexp group))
! 			 ;; Don't enter the article into the same group twice.
! 			 (not (assoc group to-groups)))
! 		(push (if regrepp
! 			  (nnimap-expand-newtext group)
! 			group)
! 		      to-groups)
! 		(or nnimap-split-crosspost
! 		    (throw 'split-done to-groups))))))))))
!   
  (defun nnimap-split-find-rule (server inbox)
    nnimap-split-rule)