From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/67855 Path: news.gmane.org!not-for-mail From: Sven Joachim Newsgroups: gmane.discuss,gmane.emacs.gnus.general Subject: Re: Fixing Gmane's mangled MIDs Date: Mon, 08 Dec 2008 21:59:34 +0100 Message-ID: <87zlj6wfgp.fsf@turtle.gmx.de> References: <87d4go7hmd.fsf@jidanni.org> <87myf8gsdj.fsf@turtle.gmx.de> <87fxkyxyqt.fsf@marauder.physik.uni-ulm.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1228770023 2639 80.91.229.12 (8 Dec 2008 21:00:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 8 Dec 2008 21:00:23 +0000 (UTC) Cc: gmane-discuss@hawk.netfonds.no To: ding@gnus.org Original-X-From: gmane-discuss-bounces@hawk.netfonds.no Mon Dec 08 22:01:25 2008 Return-path: Envelope-to: gd-gmane-discuss@m.gmane.org Original-Received: from hawk.netfonds.no ([80.91.224.246]) by lo.gmane.org with esmtp (Exim 4.50) id 1L9nEK-0001g1-SI for gd-gmane-discuss@m.gmane.org; Mon, 08 Dec 2008 22:01:24 +0100 Original-Received: from localhost ([127.0.0.1] helo=hawk.netfonds.no) by hawk.netfonds.no with esmtp (Exim 3.36 #1 (Debian)) id 1L9nDA-00068u-00; Mon, 08 Dec 2008 22:00:12 +0100 Original-Received: from mail.gmx.net ([213.165.64.20]) by hawk.netfonds.no with smtp (Exim 3.36 #1 (Debian)) id 1L9nD9-00068p-00 for ; Mon, 08 Dec 2008 22:00:11 +0100 Original-Received: (qmail invoked by alias); 08 Dec 2008 20:59:39 -0000 Original-Received: from p548661CD.dip.t-dialin.net (EHLO turtle.gmx.de) [84.134.97.205] by mail.gmx.net (mp035) with SMTP; 08 Dec 2008 21:59:39 +0100 X-Authenticated: #28250155 X-Provags-ID: V01U2FsdGVkX1+3kr9xFpK33pNGRBg1GHKuSO82NFIEPdDvjV+OBS DrOjrysZyApRBI Original-Received: by turtle.gmx.de (Postfix, from userid 1000) id 41A71354AF; Mon, 8 Dec 2008 21:59:34 +0100 (CET) Mail-Followup-To: ding@gnus.org In-Reply-To: <87fxkyxyqt.fsf@marauder.physik.uni-ulm.de> (Reiner Steib's message of "Mon, 08 Dec 2008 20:17:46 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-Y-GMX-Trusted: 0 X-FuHaFi: 0.43 X-BeenThere: gmane-discuss@hawk.netfonds.no X-Mailman-Version: 2.1.5 Precedence: list List-Id: gmane-discuss.hawk.netfonds.no List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: gmane-discuss-bounces@hawk.netfonds.no Errors-To: gmane-discuss-bounces@hawk.netfonds.no Xref: news.gmane.org gmane.discuss:12059 gmane.emacs.gnus.general:67855 Archived-At: On 2008-12-08 20:17 +0100, Reiner Steib wrote: > On Sun, Dec 07 2008, Sven Joachim wrote: > >> On 2008-12-07 06:50 +0100, Lars Magne Ingebrigtsen wrote: >>> When the same message comes from two mailing lists, and there's not >>> enough information in them to identify them as such (to crosspost the >>> message between the list), the Message-ID has to be renamed. Remove the >>> bit after __ to find the original ID. >> >> Here is some Emacs lisp code that does this automatically when replying >> in Gnus: >> >> (defun sj-unmangle-gmane-message-id () >> "Undo the Message-ID mangling that Gmane does on some postings." >> (save-excursion >> (save-restriction >> (message-narrow-to-headers) >> (goto-char (point-min)) >> (while >> (re-search-forward "\\(<.*\\)" (point-max) t) Aaargh, did I really write that?! Emacs must have swallowed characters in copy-and-paste, I swear that the line in my file looks (re-search-forward "\\(<.*\\)" (point-max) t) which makes a bit more sense and may sometimes even work (it did for me). >> (replace-match "\\1"))))) > > I would have expected a search for an expression like > "__[0-9.]+\\$gmane\\$org@" or similar. What am I missing? At least the '.' and '$' characters that also occur in the mangled Message-IDs, although this is fixed in your patch below. > I'd guess the unmangling should be done when `message-id' (fixing > References should not be necessary, I think) is put into > `message-reply-headers' (in `message-cite-original-1', > `message-reply', `message-followup'?). > > Here's a very rough, untested patch: > > Index: message.el > =================================================================== > RCS file: /usr/local/cvsroot/gnus/lisp/message.el,v > retrieving revision 7.277 > diff -u -u -r7.277 message.el > --- message.el 6 Dec 2008 17:30:03 -0000 7.277 > +++ message.el 8 Dec 2008 19:12:15 -0000 > @@ -3665,6 +3667,23 @@ > (push (buffer-name buffer) buffers)))) > (nreverse buffers))) > > +(defcustom message-gmane-mangled-mid-regexp > + ;; FIXME: Don't use gnus-... > + (concat "\\(<" gnus-button-valid-localpart-regexp "\\)" > + "__[0-9a-z.$]+\\$gmane\\$org" ;; bogus part > + ;; message-valid-fqdn-regexp probably would be too strict here > + "\\(@[a-z0-9][-.a-z0-9]+>\\)") > + "FIXME" > + :version "23.1" ;; No Gnus > + :group 'message-headers > + :type '(choice (const :tag "Don't unmangle MIDs" nil) > + regexp)) > + > +(defun message-fix-gmane-mids (mids) > + ;; FIXME: Don't use gnus-... > + (gnus-replace-in-string mids message-gmane-mangled-mid-regexp > + "\\1\\2")) > + > (defun message-cite-original-1 (strip-signature) > "Cite an original message. > If STRIP-SIGNATURE is non-nil, strips off the signature from the > @@ -3694,7 +3713,11 @@ > (or (message-fetch-field "subject") "none") > (or (message-fetch-field "from") "nobody") > (message-fetch-field "date") > - (message-fetch-field "message-id" t) > + (funcall > + (if (stringp message-gmane-mangled-mid-regexp) > + 'message-fix-gmane-mids > + 'identity) > + (message-fetch-field "message-id" t)) > (message-fetch-field "references") > 0 0 "")))) > (mml-quote-region start end) > @@ -6622,7 +6658,11 @@ > (save-excursion > (setq follow-to > (funcall message-wide-reply-to-function))))) > - (setq message-id (message-fetch-field "message-id" t) > + (setq message-id (funcall > + (if (stringp message-gmane-mangled-mid-regexp) > + 'message-fix-gmane-mids > + 'identity) > + (message-fetch-field "message-id" t)) > references (message-fetch-field "references") > date (message-fetch-field "date") > from (or (message-fetch-field "from") "nobody") > @@ -6683,7 +6723,11 @@ > date (message-fetch-field "date") > subject (or (message-fetch-field "subject") "none") > references (message-fetch-field "references") > - message-id (message-fetch-field "message-id" t) > + message-id (funcall > + (if (stringp message-gmane-mangled-mid-regexp) > + 'message-fix-gmane-mids > + 'identity) > + (message-fetch-field "message-id" t)) > followup-to (message-fetch-field "followup-to") > newsgroups (message-fetch-field "newsgroups") > posted-to (message-fetch-field "posted-to") > > Bye, Reiner. I'll try this in the next days. > [ Omitted gmane.dicuss from Mail-Followup-To as this is only relevant > for Gnus. ] Cc'ed it anyway as people may read the thread there and even try the nonsense I posted; at least I wanted to correct the regexp. Sven