[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: nnimap and searching articles by message-id
From: |
Reiner Steib |
Subject: |
Re: nnimap and searching articles by message-id |
Date: |
Sat, 19 Sep 2009 11:12:33 +0200 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/22.1 (gnu/linux) |
On Sat, Sep 19 2009, Peter wrote:
> It turns out that the IMAP server I am using
Which IMAP server software is it?
> requires the message-id be stripped of the enclosing angle brackets
> when searching for messages like so:
>
> UID SEARCH HEADER Message-Id "xxxx.yyyy@foobar.com"
>
> Not sure who is not compliant here: Gnus/nnimap or the IMAP server?
Cc-ing the developer list. Maybe someone there knows.
> I found that gnus-summary-refer-article and gnus-article-refer-article
> could be modified to suppress the angle brackets. That doesn't seem to
> be the right solution however as I would think the fix needs to be made in
> nnimap.el instead. Can anybody suggest a proper way to resolve the
> problem while allowing for article referencing by message-id when
> reading news through nntp and email through imap?
Here's a preliminary, untested patch. Does it work for you?
--8<---------------cut here---------------start------------->8---
--- nnimap.el 30 Jan 2009 18:32:29 +0100 7.59
+++ nnimap.el 19 Sep 2009 11:09:02 +0200
@@ -252,6 +252,15 @@
:type 'boolean
:group 'nnimap)
+(defcustom nnimap-search-mid-strip-angles t ;; nil
+ "Strip angles around Message-ID search.
+
+Some non-compliant (???) IMAP servers require to strip the angles
+around Message-ID when doing an UID SEARCH."
+ :version "23.2" ;; No Gnus 0.12
+ :group 'nnimap
+ :type '(choice boolean))
+
(defvoo nnimap-need-unselect-to-notice-new-mail t
"Unselect mailboxes before looking for new mail in them.
Some servers seem to need this under some circumstances.")
@@ -654,7 +663,10 @@
articles)))))
(mapcar (lambda (msgid)
(imap-search
- (format "HEADER Message-Id \"%s\"" msgid)))
+ (format "HEADER Message-Id \"%s\""
+ (if nnimap-search-mid-strip-angles
+ (gnus-replace-in-string msgid "[<>]" "")
+ msgid))))
articles))))
(defun nnimap-group-overview-filename (group server)
--8<---------------cut here---------------end--------------->8---
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/