Function: nnimap-request-move-article

nnimap-request-move-article is a byte-compiled function defined in nnimap.el.gz.

Signature

(nnimap-request-move-article ARTICLE GROUP SERVER ACCEPT-FORM &optional LAST INTERNAL-MOVE-GROUP)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nnimap.el.gz
(deffoo nnimap-request-move-article (article group server accept-form
					     &optional _last
					     internal-move-group)
  (with-temp-buffer
    (mm-disable-multibyte)
    (when (funcall (if internal-move-group
		       'nnimap-request-head
		     'nnimap-request-article)
		   article group server (current-buffer))
      ;; If the move is internal (on the same server), just do it the
      ;; easy way.
      (let ((message-id (message-field-value "message-id")))
	(if internal-move-group
            (with-current-buffer (nnimap-buffer)
              (let* ((can-move (and (nnimap-capability "MOVE")
				    (equal (nnimap-quirk "MOVE") "MOVE")))
		     (command (if can-move
				  "UID MOVE %d %S"
				"UID COPY %d %S"))
		     (result (nnimap-command
			      command article
                              (nnimap-group-to-imap internal-move-group))))
                (when (and (car result) (not can-move))
                  (nnimap-delete-article article))
                (cons internal-move-group
                      (or (nnimap-find-uid-response
			   "COPYUID"
			   ;; Server gives different responses for MOVE and COPY.
			   (if can-move (caddr result) (cadr result)))
                          (nnimap-find-article-by-message-id
                           internal-move-group server message-id
                           nnimap-request-articles-find-limit)))))
	  ;; Move the article to a different method.
	  (when-let* ((result (eval accept-form t)))
	    (nnimap-change-group group server)
	    (nnimap-delete-article article)
	    result))))))