[Date Prev][Date Next] [Chronological] [Thread] [Top]

nnimap 0.97 -> 0.98 patches



Index: nnimap/ChangeLog
diff -c nnimap/ChangeLog:1.191 nnimap/ChangeLog:1.195
*** nnimap/ChangeLog:1.191	Fri Mar 26 16:05:20 1999
--- nnimap/ChangeLog	Sat May  1 12:14:31 1999
***************
*** 1,3 ****
--- 1,56 ----
+ 1999-05-01  Simon Josefsson  <jas@pdc.kth.se>
+ 
+ 	* nnimap 0.98 released.
+ 
+ 	* imap.el (imap-mailbox-put): 
+ 	(imap-message-put): Message if null data variable.
+ 	(imap-mailbox-select): Restore old state on failures.
+ 	(imap-arrival-filter): Recognize examine state.
+ 
+ 	* nnimap.el (nnimap-request-group): 
+ 	(nnimap-possibly-change-group): Use gnus-group-prefixed-name
+ 	(gnus-group-normally-qualified): Removed, use
+ 	gnus-group-prefixed-name instead.
+ 
+ 	* imap.el (imap-parse-body): Only optionally parse body-ext-1part.
+ 
+ 	* nnimap.el (nnimap-request-create-group): Rewrite.
+ 
+ 1999-04-22  Simon Josefsson  <jas@pdc.kth.se>
+ 
+ 	* nnimap.el (gnus-group-normally-qualified): Removed, use
+ 	gnus-group-prefixed-name instead.
+ 
+ 1999-04-17  Simon Josefsson  <jas@pdc.kth.se>
+ 
+ 	* nnimap.el (nnimap-current-move-server):
+ 	(nnimap-current-move-group): 
+ 	(nnimap-current-move-article): New internal variables.
+ 	(nnimap-request-move-article): Change server.
+ 
+ 	* imap.el (imap-mailbox-select): Doc fix. Create mailbox data vector.
+ 	(imap-list-to-message-set):
+ 	(imap-message-fetch): New functions.
+ 	(imap-message-copyuid): New function.
+ 	(imap-message-copy): Use it.
+ 	(imap-message-appenduid): New function.
+ 	(imap-message-append): Use it.
+ 	(imap-parse-resp-text-code): Parse COPYUID.
+ 
+ 1999-03-30  Jeff Senn <senn@maya.com>
+ 
+ 	* nnimap.el (nnimap-request-move-article): Stash params.
+ 	(nnimap-request-accept-article): Fast move if params set.
+ 
+ 1999-03-27  Simon Josefsson  <jas@pdc.kth.se>
+ 
+         * nnimap.el (nnimap-request-set-mark): Don't set cache
+ 	flag. Return nil.
+ 
+ 1999-03-31  Simon Josefsson  <jas@pdc.kth.se>
+ 
+ 	* Makefile (ELCC): -no-init-file.
+ 
  1999-03-27  Simon Josefsson  <jas@pdc.kth.se>
  
  	* nnimap 0.97 released.
Index: nnimap/Makefile
diff -c nnimap/Makefile:1.19 nnimap/Makefile:1.20
*** nnimap/Makefile:1.19	Fri Mar 26 15:44:05 1999
--- nnimap/Makefile	Wed Mar 31 16:33:12 1999
***************
*** 1,6 ****
  GNUSDIR=
  EMACS=emacs
! ELCC=$(EMACS) -batch -q -no-site-file
  GNUS=-eval '(if (not (string-match "$(GNUSDIR)" "")) \
                       (setq load-path (cons "$(GNUSDIR)" load-path)))'
  VERSION=`date +%y%m%d-%H%M`
--- 1,6 ----
  GNUSDIR=
  EMACS=emacs
! ELCC=$(EMACS) -batch -q -no-site-file -no-init-file
  GNUS=-eval '(if (not (string-match "$(GNUSDIR)" "")) \
                       (setq load-path (cons "$(GNUSDIR)" load-path)))'
  VERSION=`date +%y%m%d-%H%M`
Index: nnimap/imap.el
diff -c nnimap/imap.el:1.123 nnimap/imap.el:1.124
*** nnimap/imap.el:1.123	Fri Mar 26 14:31:41 1999
--- nnimap/imap.el	Sat May  1 12:05:55 1999
***************
*** 130,137 ****
  ;; 
  ;; o Handle literals in ENVELOPE/BODY fetch responses
  ;; o Parse UIDs as strings? (28 bit limit)
! ;; o Write `imap-read' which escapes characters `read' can't handle (like "#"),
! ;;   and use it instead of `read'.
  ;; o Sleep.
  ;;
  
--- 130,138 ----
  ;; 
  ;; o Handle literals in ENVELOPE/BODY fetch responses
  ;; o Parse UIDs as strings? (28 bit limit)
! ;; o Don't use `read'
! ;; o Accept list of articles instead of message set string in most
! ;;   imap-message-* functions.
  ;; o Sleep.
  ;;
  
***************
*** 656,663 ****
  
  (defun imap-mailbox-put (propname value &optional mailbox buffer)
    (with-current-buffer (or buffer (current-buffer))
!     (put (intern (or mailbox imap-current-mailbox) imap-mailbox-data)
! 	 propname value)
      t))
  
  (defun imap-mailbox-get (propname &optional mailbox buffer)
--- 657,667 ----
  
  (defun imap-mailbox-put (propname value &optional mailbox buffer)
    (with-current-buffer (or buffer (current-buffer))
!     (if imap-mailbox-data
! 	(put (intern (or mailbox imap-current-mailbox) imap-mailbox-data)
! 	     propname value)
!       (message "Imap-mailbox-data is nil. Property %s value %s mailbox %s"
! 	       propname value mailbox))
      t))
  
  (defun imap-mailbox-get (propname &optional mailbox buffer)
***************
*** 677,697 ****
        result)))
  
  (defun imap-mailbox-select (mailbox &optional buffer examine)
    (with-current-buffer (or buffer (current-buffer))
      (unless (and (string= mailbox imap-current-mailbox)
  		 (or (and examine
  			  (eq imap-state 'examine))
  		     (and (not examine)
  			  (eq imap-state 'selected))))
!       (setq imap-current-mailbox mailbox)
!       (if (imap-ok-p (imap-send-command-wait
! 		      (concat (if examine "EXAMINE" "SELECT") " " mailbox)))
! 	  (setq imap-message-data (make-vector imap-message-prime 0)
! 		imap-state (if examine 'examine 'selected))
! 	;; Failed SELECT unselects the current group
! 	(setq imap-current-mailbox nil
! 	      imap-message-data nil
! 	      imap-state 'auth)))
      imap-current-mailbox))
  
  (defun imap-mailbox-unselect (&optional buffer)
--- 681,705 ----
        result)))
  
  (defun imap-mailbox-select (mailbox &optional buffer examine)
+   "Select MAILBOX on server in BUFFER. If EXAMINE is non-nil, do a
+ read-only select."
    (with-current-buffer (or buffer (current-buffer))
      (unless (and (string= mailbox imap-current-mailbox)
  		 (or (and examine
  			  (eq imap-state 'examine))
  		     (and (not examine)
  			  (eq imap-state 'selected))))
!       (let ((old-mailbox imap-current-mailbox)
! 	    (old-data imap-mailbox-data))
! 	(setq imap-current-mailbox mailbox
! 	      imap-mailbox-data (make-vector imap-mailbox-prime 0))
! 	(if (imap-ok-p (imap-send-command-wait
! 			(concat (if examine "EXAMINE" "SELECT") " " mailbox)))
! 	    (setq imap-message-data (make-vector imap-message-prime 0)
! 		  imap-state (if examine 'examine 'selected))
! 	  ;; Failed SELECT unselects the current group
! 	  (setq imap-current-mailbox old-mailbox
! 		imap-mailbox-data old-data))))
      imap-current-mailbox))
  
  (defun imap-mailbox-unselect (&optional buffer)
***************
*** 820,829 ****
  
  ;; Message functions:
  
  (defun imap-message-put (uid propname value &optional buffer)
    (with-current-buffer (or buffer (current-buffer))
!     (put (intern (number-to-string uid) imap-message-data)
! 	 propname value)
      t))
  
  (defun imap-message-get (uid propname &optional buffer)
--- 828,868 ----
  
  ;; Message functions:
  
+ (defun imap-list-to-message-set (list)
+   (mapconcat (lambda (item)
+ 	       (number-to-string item))
+ 	     (if (listp list)
+ 		 list
+ 	       (list list))
+ 	     ","))
+ 
+ (defun imap-message-fetch (uids props &optional buffer)
+   "Fetch properties PROPS from message set UIDS from server in
+ BUFFER. UIDS is a list of articles"
+   (with-current-buffer (or buffer (current-buffer))
+     (let ((uids (if (or (stringp uids) (listp uids)) uids (list uids)))
+ 	  (props (if (or (stringp props) (listp props)) props (list props))))
+       (when (imap-ok-p (imap-send-command-wait 
+ 			(format "UID FETCH %s %s"
+ 				(if (listp uids)
+ 				    (imap-list-to-message-set uids)
+ 				  uids)
+ 				props)))
+ 	(if (or (stringp uids) (stringp props))
+ 	    t
+ 	  (mapcar (lambda (uid)
+ 		    (mapcar (lambda (prop)
+ 			      (imap-message-get uid prop))
+ 			    props))
+ 		  uids))))))
+     
  (defun imap-message-put (uid propname value &optional buffer)
    (with-current-buffer (or buffer (current-buffer))
!     (if imap-message-data
! 	(put (intern (number-to-string uid) imap-message-data)
! 	     propname value)
!       (message "Imap-message-data is nil. Uid %d property %s value %s"
! 	       uid propname value))
      t))
  
  (defun imap-message-get (uid propname &optional buffer)
***************
*** 920,957 ****
  		  (concat "UID STORE " articles
  			  " +FLAGS" (if silent ".SILENT") " (" flags ")"))))))
  
  (defun imap-message-copy (articles mailbox &optional buffer dont-create)
!   "Copy ARTICLES to MAILBOX on server in BUFFER, creating mailbox if
! it doesn't exist. If dont-create is non-nil, it will not create a
! mailbox."
    (when articles
      (with-current-buffer (or buffer (current-buffer))
!       (let ((cmd (list "UID COPY " articles " " mailbox))
! 	    (imap-current-target-mailbox mailbox))
! 	(if (imap-ok-p (imap-send-command-wait cmd))
! 	    t
! 	  (when (and (not dont-create) (imap-mailbox-get 'trycreate mailbox))
! 	    (imap-mailbox-create mailbox)
! 	    (imap-ok-p (imap-send-command-wait cmd))))))))
! 
  (defun imap-message-append (mailbox article &optional buffer flags date-time)
!   "Append ARTICLE buffer to MAILBOX on server in BUFFER. FLAGS and
  DATE-TIME is currently not used. Return a cons holding uidvalidity of
  MAILBOX and UID the newly created article got, or nil on failure."
    (with-current-buffer (or buffer (current-buffer))
!     (if (imap-capability 'UIDPLUS)
! 	(let ((imap-current-target-mailbox mailbox))
! 	  (when (imap-ok-p (imap-send-command-wait
! 			    (list "APPEND " (imap-encode-string mailbox) " "
! 				  article)))
! 	    (imap-mailbox-get 'appenduid mailbox)))
!       (let (res)
! 	(when (setq res (imap-mailbox-status mailbox '(uidvalidity uidnext)))
! 	  (when (imap-ok-p (imap-send-command-wait
! 			    (list "APPEND " (imap-encode-string mailbox) " "
! 				  article)))
! 	    res))))))
! 
  
  ;; Internal functions.
  
--- 959,1024 ----
  		  (concat "UID STORE " articles
  			  " +FLAGS" (if silent ".SILENT") " (" flags ")"))))))
  
+ (defun imap-message-appenduid (mailbox &optional buffer)
+   (with-current-buffer (or buffer (current-buffer))
+     (if (imap-capability 'UIDPLUS)
+ 	(imap-mailbox-get 'appenduid mailbox)
+       (let ((old-mailbox imap-current-mailbox)
+ 	    (state imap-state)
+ 	    (imap-message-data (make-vector 2 0)))
+ 	(imap-mailbox-select mailbox nil 'examine)
+ 	(imap-message-fetch "*" "UID")
+ 	(prog1
+ 	    (list (imap-mailbox-get 'uidvalidity mailbox)
+ 		  (car (imap-message-map (lambda (uid prop) uid) 'UID)))
+ 	  (if old-mailbox
+ 	      (imap-mailbox-select old-mailbox nil (eq state 'examine))
+ 	    (imap-mailbox-unselect)))))))
+ 
+ (defun imap-message-copyuid (mailbox &optional buffer)
+   (with-current-buffer (or buffer (current-buffer))
+     (if (imap-capability 'UIDPLUS)
+ 	(list (nth 0 (imap-mailbox-get 'copyuid mailbox))
+ 	      (string-to-number (nth 2 (imap-mailbox-get 'copyuid mailbox))))
+       (let ((old-mailbox imap-current-mailbox)
+ 	    (state imap-state)
+ 	    (imap-message-data (make-vector 2 0)))
+ 	(imap-mailbox-select mailbox nil 'examine)
+ 	(imap-message-fetch "*" "UID")
+ 	(prog1
+ 	    (list (imap-mailbox-get 'uidvalidity mailbox)
+ 		  (car (imap-message-map (lambda (uid prop) uid) 'UID)))
+ 	  (imap-mailbox-select old-mailbox nil (eq state 'examine)))))))
+ 
  (defun imap-message-copy (articles mailbox &optional buffer dont-create)
!   "Copy ARTICLES (a string message set) to MAILBOX on server in
! BUFFER, creating mailbox if it doesn't exist. If dont-create is
! non-nil, it will not create a mailbox. On success, return a list with
! the UIDVALIDITY of the mailbox the article(s) was copied to as the
! 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
! 	      (when (and (not dont-create)
! 			 (imap-mailbox-get 'trycreate mailbox))
! 		(imap-mailbox-create mailbox)
! 		(imap-ok-p (imap-send-command-wait cmd)))))
! 	  (imap-message-copyuid mailbox)))))
!       
  (defun imap-message-append (mailbox article &optional buffer flags date-time)
!   "Append ARTICLE (a buffer) to MAILBOX on server in BUFFER. FLAGS and
  DATE-TIME is currently not used. Return a cons holding uidvalidity of
  MAILBOX and UID the newly created article got, or nil on failure."
    (with-current-buffer (or buffer (current-buffer))
!     (let ((imap-current-target-mailbox mailbox))
!       (imap-ok-p 
!        (imap-send-command-wait 
! 	(list "APPEND " (imap-encode-string mailbox) " "  article))))
!     (imap-message-appenduid mailbox)))
!   
  
  ;; Internal functions.
  
***************
*** 1069,1075 ****
  		     (imap-parse-greeting))
  		    ((or (eq imap-state 'auth)
  			 (eq imap-state 'nonauth)
! 			 (eq imap-state 'selected))
  		     (imap-parse-response))
  		    (t
  		     (message "Unknown state %s in arrival filter" 
--- 1136,1143 ----
  		     (imap-parse-greeting))
  		    ((or (eq imap-state 'auth)
  			 (eq imap-state 'nonauth)
! 			 (eq imap-state 'selected)
! 			 (eq imap-state 'examine))
  		     (imap-parse-response))
  		    (t
  		     (message "Unknown state %s in arrival filter" 
***************
*** 1366,1371 ****
--- 1434,1459 ----
  ;;
  ;;   resp_code_apnd  = "APPENDUID" SPACE nz_number SPACE uniqueid
  ;;
+ ;;   resp_code_copy  = "COPYUID" SPACE nz_number SPACE set SPACE set
+ ;;
+ ;;   set             = sequence-num / (sequence-num ":" sequence-num) /
+ ;;                        (set "," set)
+ ;;                          ; Identifies a set of messages.  For message
+ ;;                          ; sequence numbers, these are consecutive
+ ;;                          ; numbers from 1 to the number of messages in
+ ;;                          ; the mailbox
+ ;;                          ; Comma delimits individual numbers, colon
+ ;;                          ; delimits between two numbers inclusive.
+ ;;                          ; Example: 2,4:7,9,12:* is 2,4,5,6,7,9,12,13,
+ ;;                          ; 14,15 for a mailbox with 15 messages.
+ ;; 
+ ;;   sequence-num    = nz-number / "*"
+ ;;                          ; * is the largest number in use.  For message
+ ;;                          ; sequence numbers, it is the number of messages
+ ;;                          ; in the mailbox.  For unique identifiers, it is
+ ;;                          ; the unique identifier of the last message in
+ ;;                          ; the mailbox.
+ ;;
  ;;   flag-perm       = flag / "\*"
  ;;
  ;;   flag            = "\Answered" / "\Flagged" / "\Deleted" /
***************
*** 1397,1404 ****
  	   (imap-mailbox-put 'uidvalidity (match-string 1)))
  	  ((search-forward "READ-ONLY" nil t)
  	   (imap-mailbox-put 'read-only t))
- 	  ((search-forward "COPYUID" nil t)
- 	   t)
  	  ((search-forward "NEWNAME " nil t)
  	   (let (oldname newname)
  	     (setq oldname (imap-parse-string))
--- 1485,1490 ----
***************
*** 1408,1417 ****
  	  ((search-forward "TRYCREATE" nil t)
  	   (imap-mailbox-put 'trycreate t imap-current-target-mailbox))
  	  ((looking-at "APPENDUID \\([0-9]+\\) \\([0-9]+\\)")
! 	   (imap-mailbox-put 'appenduid 
  			     (list (match-string 1)
  				   (string-to-number (match-string 2)))
  			     imap-current-target-mailbox))
  	  ((search-forward "ALERT] " nil t)
  	   (message "Imap server %s information: %s" imap-server
  		    (buffer-substring (point) (point-max)))))))
--- 1494,1508 ----
  	  ((search-forward "TRYCREATE" nil t)
  	   (imap-mailbox-put 'trycreate t imap-current-target-mailbox))
  	  ((looking-at "APPENDUID \\([0-9]+\\) \\([0-9]+\\)")
! 	   (imap-mailbox-put 'appenduid
  			     (list (match-string 1)
  				   (string-to-number (match-string 2)))
  			     imap-current-target-mailbox))
+ 	  ((looking-at "COPYUID \\([0-9]+\\) \\([0-9,:]+\\) \\([0-9,:]+\\)")
+ 	   (imap-mailbox-put 'copyuid (list (match-string 1)
+ 					    (match-string 2)
+ 					    (match-string 3))
+ 			     imap-current-target-mailbox))
  	  ((search-forward "ALERT] " nil t)
  	   (message "Imap server %s information: %s" imap-server
  		    (buffer-substring (point) (point-max)))))))
***************
*** 1829,1854 ****
  	(or (eobp) (forward-char))
  	(push (imap-parse-number) body)                   ;; body-fld-octets
  
  	(when (eq (char-after) ?\ )
  	  (or (eobp) (forward-char))
! 	  (let (lines md5)
  	    (cond ((eq (char-after) ?\()                  ;; body-type-msg:
  		   (push (imap-parse-envelope) body)      ;; envelope
  		   (or (eobp) (forward-char))
  		   (push (imap-parse-body) body)          ;; body
  		   (or (eobp) (forward-char))
! 		   (push (imap-parse-number) body)        ;; body-fld-lines
! 		   (or (eobp) (forward-char)))
  		  ((setq lines (imap-parse-number))       ;; body-type-text:
! 		   (push lines body)                      ;; body-fld-lines
! 		   (or (eobp) (forward-char))))
! 	  
! 	    (when (or (imap-parse-nil)
! 		      (setq md5 (imap-parse-nstring)))    ;; body-ext-1part:
! 	      (push md5 body)                             ;; body-fld-md5
! 	      (setq body (append (imap-parse-body-ext)
! 				 body)))))                ;; body-ext-1part..
  
  	(assert (eq (char-after) ?\)))
  	(or (eobp) (forward-char))
  	(nreverse body)))))
--- 1920,1956 ----
  	(or (eobp) (forward-char))
  	(push (imap-parse-number) body)                   ;; body-fld-octets
  
+ 	;; ok, we're done parsing the required parts, what comes now is one
+ 	;; of three things:
+ 	;;
+ 	;; envelope       (then we're parsing body-type-msg)
+ 	;; body-fld-lines (then we're parsing body-type-text)
+ 	;; body-ext-1part (then we're parsing body-type-basic)
+ 	;;
+ 	;; the problem is that the two first are in turn optionally followed
+ 	;; by the third. So we parse the first two here (if there are any)...
+ 
  	(when (eq (char-after) ?\ )
  	  (or (eobp) (forward-char))
! 	  (let (lines)
  	    (cond ((eq (char-after) ?\()                  ;; body-type-msg:
  		   (push (imap-parse-envelope) body)      ;; envelope
  		   (or (eobp) (forward-char))
  		   (push (imap-parse-body) body)          ;; body
  		   (or (eobp) (forward-char))
! 		   (push (imap-parse-number) body))       ;; body-fld-lines
  		  ((setq lines (imap-parse-number))       ;; body-type-text:
! 		   (push lines body))                     ;; body-fld-lines
! 		  (t
! 		   (backward-char)))))                    ;; no match...
  
+ 	;; ...and then parse the third one here...
+ 
+ 	(when (eq (char-after) ?\ )                       ;; body-ext-1part:
+ 	  (or (eobp) (forward-char))
+ 	  (push (imap-parse-nstring) body)                ;; body-fld-md5
+ 	  (setq body (append (imap-parse-body-ext) body)));; body-ext-1part..
+     
  	(assert (eq (char-after) ?\)))
  	(or (eobp) (forward-char))
  	(nreverse body)))))
Index: nnimap/nnimap.el
diff -c nnimap/nnimap.el:1.137 nnimap/nnimap.el:1.139
*** nnimap/nnimap.el:1.137	Fri Mar 26 16:04:46 1999
--- nnimap/nnimap.el	Sat May  1 12:06:33 1999
***************
*** 93,99 ****
  
  (nnoo-declare nnimap)
  
! (defconst nnimap-version "nnimap 0.97")
  
  ;; Splitting variables
  
--- 93,99 ----
  
  (nnoo-declare nnimap)
  
! (defconst nnimap-version "nnimap 0.98")
  
  ;; Splitting variables
  
***************
*** 186,191 ****
--- 186,195 ----
  					  (const :format "" "password")
  					  (string :format "Password: %v")))))))
  
+ (defvar nnimap-current-move-server nil)
+ (defvar nnimap-current-move-group nil)
+ (defvar nnimap-current-move-article nil)
+ 
  ;; Legacy variables:
  
  (require 'nnheader)
***************
*** 529,534 ****
--- 533,540 ----
  		(what  (nth 1 action))
  		(cmdmarks (nth 2 action))
  		marks)
+ 	    ;; cache flags are pointless on the server
+ 	    (setq cmdmarks (delq 'cache cmdmarks))
  	    ;; flag dormant articles as ticked
  	    (if (memq 'dormant cmdmarks)
  		(setq cmdmarks (cons 'tick cmdmarks)))
***************
*** 552,576 ****
  		      (nnimap-range-to-string range)
  		      (nnimap-mark-to-flag marks nil t)))))))
  	(gnus-message 7 "Setting marks in %s:%s...done" 
! 		      (nnoo-current-server 'nnimap) group)))))
  
  (deffoo nnimap-request-move-article (article group server
  					     accept-form &optional last)
!   (save-excursion
!     (let ((buf (get-buffer-create " *nnimap move*"))
! 	  result)
!       (and 
!        (nnimap-request-article article group server)
!        (save-excursion
! 	 (set-buffer buf)
! 	 (buffer-disable-undo (current-buffer))
! 	 (insert-buffer-substring nntp-server-buffer)
! 	 (setq result (eval accept-form))
! 	 (kill-buffer buf)
! 	 result)
!        (nnimap-request-expire-articles (list article) group server t))
!       result)))
! 
  ;;; Gnus functions
  
  (defun gnus-group-nnimap-expunge (group)
--- 558,591 ----
  		      (nnimap-range-to-string range)
  		      (nnimap-mark-to-flag marks nil t)))))))
  	(gnus-message 7 "Setting marks in %s:%s...done" 
! 		      (nnoo-current-server 'nnimap) group))))
!   nil)
! 
! (deffoo nnimap-request-create-group (group &optional server args)
!   (when (nnimap-possibly-change-server server)
!     (or (imap-mailbox-status group 'uidvalidity nnimap-server-buffer)
! 	(imap-mailbox-create group nnimap-server-buffer))))
  
  (deffoo nnimap-request-move-article (article group server
  					     accept-form &optional last)
!   (when (nnimap-possibly-change-server server)
!     (save-excursion
!       (let ((buf (get-buffer-create " *nnimap move*"))
! 	    (nnimap-current-move-article article)
! 	    (nnimap-current-move-group group)
! 	    (nnimap-current-move-server nnimap-current-server)
! 	    result)
! 	(and (nnimap-request-article article group server)
! 	     (save-excursion
! 	       (set-buffer buf)
! 	       (buffer-disable-undo (current-buffer))
! 	       (insert-buffer-substring nntp-server-buffer)
! 	       (setq result (eval accept-form))
! 	       (kill-buffer buf)
! 	       result)
! 	     (nnimap-request-expire-articles (list article) group server t))
! 	result))))
!   
  ;;; Gnus functions
  
  (defun gnus-group-nnimap-expunge (group)
***************
*** 769,776 ****
  ;;; it looks for new news.  Damn.
  (deffoo nnimap-request-group (group &optional server fast)
    (nnimap-request-update-info-internal
!    group
!    (gnus-get-info (gnus-group-normally-qualified 'nnimap server group))
     server)
    (if fast
        (with-current-buffer nntp-server-buffer 
--- 784,792 ----
  ;;; it looks for new news.  Damn.
  (deffoo nnimap-request-group (group &optional server fast)
    (nnimap-request-update-info-internal
!    group (gnus-get-info (gnus-group-prefixed-name 
! 			 group (gnus-server-to-method
! 				(format "nnimap:%s" server))))
     server)
    (if fast
        (with-current-buffer nntp-server-buffer 
***************
*** 791,810 ****
  			   (apply 'max articles) group))))
      (gnus-message 7 "Opening nnimap group %s...done" group)))
  
- ;; Note that there is no need for this in current Gnus (5.6.27), all
- ;; you need to do is use gnus-group-prefixed-name.  I'm not sure when
- ;; this got fixed.  That's what I get for not using the current
- ;; version.
- (defun gnus-group-normally-qualified (backend server group)
-   ;; This is the format for groups in the group-info.
-   ;; native groups are not qualified.  Why?
-   (let ((method (gnus-server-to-method (format "%s:%s" backend server))))
-     (if (gnus-method-equal gnus-select-method method)
-         ;; Native (we of course can't call `gnus-native-p' since it
-         ;; assumes group is the result of this function
-         group
-       (gnus-group-prefixed-name group method))))
-             
  (deffoo nnimap-close-group (group &optional server)
    (when (nnimap-possibly-change-group group server)
      (nnimap-expunge-close-group server)))
--- 807,812 ----
***************
*** 979,990 ****
        (erase-buffer))
      t))
  
- (deffoo nnimap-request-create-group (group &optional server args)
-   (when (nnimap-possibly-change-server server)
-     (nnimap-ok-p (nnimap-send-command-wait
-                   (concat "CREATE " group) 
-                   nnimap-server-buffer))))
- 
  (defun nnimap-time-substract (time1 time2)
    "Return TIME for TIME1 - TIME2."
    (let* ((ms (- (car time1) (car time2)))
--- 981,986 ----
***************
*** 1053,1067 ****
  
  (deffoo nnimap-request-accept-article (group &optional server last)
    (when (nnimap-possibly-change-server server)
!     ;; turn into rfc822 format (\r\n eol's)
!     (with-current-buffer (current-buffer)
!       (goto-char (point-min))
!       (while (re-search-forward "\n" nil t)
! 	(replace-match "\r\n")))
!     (let ((status (imap-message-append group (current-buffer)
  				       nnimap-server-buffer)))
!       (when status
! 	(cons group (nth 1 status))))))
  
  ;; (deffoo nnimap-request-replace-article -- IMAP does not support replacing
  
--- 1049,1070 ----
  
  (deffoo nnimap-request-accept-article (group &optional server last)
    (when (nnimap-possibly-change-server server)
!     (let (uid)
!       (if (string= nnimap-current-server nnimap-current-move-server)
! 	  ;; moving article within same server, speed it up...
! 	  (when (nnimap-possibly-change-group nnimap-current-move-group)
! 	    (setq uid (imap-message-copy 
! 		       (number-to-string nnimap-current-move-article)
! 		       group nnimap-server-buffer)))
! 	;; turn into rfc822 format (\r\n eol's)
! 	(with-current-buffer (current-buffer)
! 	  (goto-char (point-min))
! 	  (while (re-search-forward "\n" nil t)
! 	    (replace-match "\r\n")))
! 	(setq uid (imap-message-append group (current-buffer)
  				       nnimap-server-buffer)))
!       (and uid
! 	   (cons group (nth 1 uid))))))
  
  ;; (deffoo nnimap-request-replace-article -- IMAP does not support replacing
  
***************
*** 1228,1235 ****
    (when (nnimap-possibly-change-server server)
      (with-current-buffer nnimap-server-buffer
        (when group
! 	(let ((groupname (gnus-group-normally-qualified 
! 			  'nnimap nnimap-current-server group)))
  	  (if (and imap-current-mailbox
  		   (not (string= group imap-current-mailbox)))
  	      (nnimap-expunge-close-group))
--- 1231,1238 ----
    (when (nnimap-possibly-change-server server)
      (with-current-buffer nnimap-server-buffer
        (when group
! 	(let ((groupname (gnus-group-prefixed-name 
! 			  group (gnus-find-method-for-group group))))
  	  (if (and imap-current-mailbox
  		   (not (string= group imap-current-mailbox)))
  	      (nnimap-expunge-close-group))
***************
*** 1311,1317 ****
  nnimap-request-body
  nnimap-request-article-part
  nnimap-request-group
- gnus-group-normally-qualified
  nnimap-close-group
  nnimap-request-list-mapper
  nnimap-pattern-to-list-arguments
--- 1314,1319 ----