From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/67854 Path: news.gmane.org!not-for-mail From: Reiner Steib Newsgroups: gmane.discuss,gmane.emacs.gnus.general Subject: Fixing Gmane's mangled MIDs (was: Stop messing with Message-IDs, you're ruining threading) Date: Mon, 08 Dec 2008 20:17:46 +0100 Message-ID: <87fxkyxyqt.fsf@marauder.physik.uni-ulm.de> References: <87d4go7hmd.fsf@jidanni.org> <87myf8gsdj.fsf@turtle.gmx.de> Reply-To: Reiner Steib NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1228763888 11797 80.91.229.12 (8 Dec 2008 19:18:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 8 Dec 2008 19:18:08 +0000 (UTC) Cc: gmane-discuss@hawk.netfonds.no To: Sven Joachim , ding@gnus.org Original-X-From: gmane-discuss-bounces@hawk.netfonds.no Mon Dec 08 20:19:07 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 1L9ldL-0006D1-23 for gd-gmane-discuss@m.gmane.org; Mon, 08 Dec 2008 20:19:07 +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 1L9lcA-0005WV-00; Mon, 08 Dec 2008 20:17:54 +0100 Original-Received: from mail.uni-ulm.de ([134.60.1.11]) by hawk.netfonds.no with esmtp (Exim 3.36 #1 (Debian)) id 1L9lc8-0005WQ-00 for ; Mon, 08 Dec 2008 20:17:52 +0100 Original-Received: from bridgekeeper.physik.uni-ulm.de (bridgekeeper.physik.uni-ulm.de [134.60.10.175]) by mail.uni-ulm.de (8.14.2/8.14.2) with ESMTP id mB8JHnlt013594; Mon, 8 Dec 2008 20:17:49 +0100 (MET) Original-Received: from localhost (localhost [127.0.0.1]) by bridgekeeper.physik.uni-ulm.de (Postfix) with ESMTP id 3C0BE1C8DF; Mon, 8 Dec 2008 20:17:49 +0100 (CET) X-Face: 1; h7XMU[7l}$T@J.D}5z*w8Tg'}B5ArAWc8>2X~otB; kOjKs8X%|hTC#dG:%Vpx")x7S/`v :VXU#fZW$X$zdhEU.RfVQ@<-m9IuN{Hm"fW{,5]6kR'M*vEs+{5Cj!L(JTRzA$(},?5J=sm; %Od, User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.1 (gnu/linux) X-DCC-CTc-dcc2-Metrics: poseidon 1031; Body=3 Fuz1=3 Fuz2=3 X-Virus-Scanned: by amavisd-new 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:12056 gmane.emacs.gnus.general:67854 Archived-At: --=-=-= 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) > (replace-match "\\1"))))) I would have expected a search for an expression like "__[0-9.]+\\$gmane\\$org@" or similar. What am I missing? > ;; Fix up References header > (add-hook 'message-header-setup-hook > 'sj-unmangle-gmane-message-id) > > ;; Fix up In-Reply-To header > (add-hook 'message-send-mail-hook > 'sj-unmangle-gmane-message-id) > > Note that your own Gcc'ed copy will still have the mangled Message-ID in > the In-Reply-To header, because message.el inserts that very late. I > can live with that, but if somebody has a better idea, please let me > know. 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: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=rs-message-unmangle-Gmane.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. [ Omitted gmane.dicuss from Mail-Followup-To as this is only relevant for Gnus. ] -- ,,, (o o) ---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/ --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Gmane-discuss mailing list Gmane-discuss@hawk.netfonds.no http://hawk.netfonds.no/cgi-bin/mailman/listinfo/gmane-discuss --=-=-=--