Function: nnimap-find-article-by-message-id
nnimap-find-article-by-message-id is a byte-compiled function defined
in nnimap.el.gz.
Signature
(nnimap-find-article-by-message-id GROUP SERVER MESSAGE-ID &optional LIMIT)
Documentation
Search for message with MESSAGE-ID in GROUP from SERVER.
If LIMIT, first try to limit the search to the N last articles.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/nnimap.el.gz
(defun nnimap-find-article-by-message-id (group server message-id
&optional limit)
"Search for message with MESSAGE-ID in GROUP from SERVER.
If LIMIT, first try to limit the search to the N last articles."
(with-current-buffer (nnimap-buffer)
(erase-buffer)
(let* ((change-group-result (nnimap-change-group group server nil t))
(number-of-article
(and (listp change-group-result)
(catch 'found
(dolist (result (cdr change-group-result))
(when (equal "EXISTS" (cadr result))
(throw 'found (car result)))))))
(sequence
(nnimap-send-command
"UID SEARCH%s HEADER Message-Id %S"
(if (and limit number-of-article)
;; The -1 is because IMAP message
;; numbers are one-based rather than
;; zero-based.
(format " %s:*" (- (string-to-number number-of-article)
limit -1))
"")
message-id)))
(when (nnimap-wait-for-response sequence)
(let ((article (car (last (cdr (assoc "SEARCH"
(nnimap-parse-response)))))))
(if article
(string-to-number article)
(when (and limit number-of-article)
(nnimap-find-article-by-message-id group server message-id))))))))