[gnus git] branch master updated: m0-5-106-gf36869c =3= Account for the fact that nnimap-change-group can return t ; Add recent argument to nnimap-find-article-by-message-id ; Document result value of nnimap-change-group
Dave Abrahams <[email protected]>
| Newsgroups | gmane.emacs.gnus.cvs |
|---|---|
| Message-ID | <[email protected]> |
via f36869c21744af08b25be653bdbaa81617f43ef8 (commit)
via b3f5f69040ed69dea5264c43f6c32e329107c62f (commit)
via 2fb0b7ac1adacec45fd50f7aa7de5ea57fda4d19 (commit)
from 8e1b4e53da728a59be2dc56f9ee349c5b93d6121 (commit)
- Log -----------------------------------------------------------------
commit f36869c21744af08b25be653bdbaa81617f43ef8
Author: Dave Abrahams <[email protected]>
Date: Fri Aug 31 21:47:35 2012 -0700
Account for the fact that nnimap-change-group can return t
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 900b18a..a28d86a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -22,8 +22,8 @@
* gnus-registry.el (gnus-try-warping-via-registry): Don't act as though
you've found the article when you haven't.
- * nnimap.el (nnimap-find-article-by-message-id): Revert 2012-06-19
- change: "Add recent argument" by Julien Danjou
+ * nnimap.el (nnimap-find-article-by-message-id): Account for the fact that
+ nnimap-change-group can return t
2012-08-31 Stefan Monnier <[email protected]>
diff --git a/lisp/nnimap.el b/lisp/nnimap.el
index 4952c4e..53bc2dd 100644
--- a/lisp/nnimap.el
+++ b/lisp/nnimap.el
@@ -985,11 +985,13 @@ textual parts.")
If LIMIT, first try to limit the search to the N last articles."
(with-current-buffer (nnimap-buffer)
(erase-buffer)
- (let* ((number-of-article
+ (let* ((change-group-result (nnimap-change-group group server nil t))
+ (number-of-article
+ (and (listp change-group-result)
(catch 'found
- (dolist (result (cdr (nnimap-change-group group server nil t)))
+ (dolist (result (cdr change-group-result))
(when (equal "EXISTS" (cadr result))
- (throw 'found (car result))))))
+ (throw 'found (car result)))))))
(sequence
(nnimap-send-command "UID SEARCH%s HEADER Message-Id %S"
(if (and limit number-of-article)
commit b3f5f69040ed69dea5264c43f6c32e329107c62f
Author: Julien Danjou <[email protected]>
Date: Thu Jun 14 10:09:04 2012 +0200
Add recent argument to nnimap-find-article-by-message-id
Signed-off-by: Julien Danjou <[email protected]>
Conflicts:
lisp/ChangeLog
lisp/nnimap.el
diff --git a/lisp/nnimap.el b/lisp/nnimap.el
index 9b460f3..4952c4e 100644
--- a/lisp/nnimap.el
+++ b/lisp/nnimap.el
@@ -980,21 +980,31 @@ textual parts.")
(cdr (assoc "SEARCH" (cdr result))))))))))
-(defun nnimap-find-article-by-message-id (group server message-id)
- "Search for message with MESSAGE-ID in GROUP from SERVER."
+(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)
- (nnimap-change-group group server nil t)
- (let ((sequence
- (nnimap-send-command "UID SEARCH HEADER Message-Id %S" message-id))
- article result)
- (setq result (nnimap-wait-for-response sequence))
- (when (and result
- (car (setq result (nnimap-parse-response))))
- ;; Select the last instance of the message in the group.
- (and (setq article
- (car (last (cdr (assoc "SEARCH" (cdr result))))))
- (string-to-number article))))))
+ (let* ((number-of-article
+ (catch 'found
+ (dolist (result (cdr (nnimap-change-group group server nil t)))
+ (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))))))))
(defun nnimap-delete-article (articles)
(with-current-buffer (nnimap-buffer)
commit 2fb0b7ac1adacec45fd50f7aa7de5ea57fda4d19
Author: Dave Abrahams <[email protected]>
Date: Fri Aug 31 20:26:19 2012 -0700
Document result value of nnimap-change-group
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 77baac1..900b18a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -6,6 +6,7 @@
Change (random t) to (random), now that the latter is more random.
2012-08-31 Dave Abrahams <[email protected]>
+ * nnimap.el (nnimap-change-group): Document result value
* auth-source.el (auth-sources): Fix macos keychain access.
diff --git a/lisp/nnimap.el b/lisp/nnimap.el
index 970e6b4..9b460f3 100644
--- a/lisp/nnimap.el
+++ b/lisp/nnimap.el
@@ -1683,10 +1683,14 @@ textual parts.")
nil t))))))
(defun nnimap-change-group (group &optional server no-reconnect read-only)
- "Change group to GROUP.
+ "Change group to GROUP if non-nil.
If SERVER is set, check that server is connected, otherwise retry
-to reconnect, unless NO-RECONNECT is set to t.
-if READ-ONLY is set, send EXAMINE rather than SELECT to the server."
+to reconnect, unless NO-RECONNECT is set to t. Return nil if
+unsuccessful in connecting.
+If GROUP is nil, return t.
+If READ-ONLY is set, send EXAMINE rather than SELECT to the server.
+Return the server's response to the SELECT or EXAMINE command.
+"
(let ((open-result t))
(when (and server
(not (nnimap-server-opened server)))
-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.
Summary of changes:
lisp/ChangeLog | 5 +++--
lisp/nnimap.el | 48 ++++++++++++++++++++++++++++++++----------------
2 files changed, 35 insertions(+), 18 deletions(-)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".
The branch, master has been updated
hooks/post-receive
--
Gnus Project