Gnus development mailing list
 help / color / mirror / Atom feed
* gnus-copy-article-ignored-headers
@ 2004-10-17 17:52 Reiner Steib
  2004-10-17 20:56 ` gnus-copy-article-ignored-headers Reiner Steib
  0 siblings, 1 reply; 2+ messages in thread
From: Reiner Steib @ 2004-10-17 17:52 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 752 bytes --]

Hi,

when copying articles from say nnml to an IMAP server, the Xref:
header isn't removed.  The new variable
`gnus-copy-article-ignored-headers' cares for this, see the attached
patch.  I have committed it.  I anyone can think of possible problems,
please let me know.

I found such a variable useful when I needed to train bogofilter from
my ham/spam collection (on nnml) by copying the collections to
corresponding IMAP folders.  Keeping Xref, X-DCC-.*-Metrics and
X-Bogosity[1] headers would have been wrong because the articles
should be as close to the original as possible.

Bye, Reiner.

[1] Actually X-Bogosity is ignored by bogofilter, IIRC.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: rs-copy-ignore.patch --]
[-- Type: text/x-patch, Size: 1060 bytes --]

--- gnus-art.el	7 Oct 2004 13:54:59 -0000	7.56
+++ gnus-art.el	17 Oct 2004 17:40:22 -0000
@@ -564,6 +564,15 @@
   :type 'hook
   :group 'gnus-article-various)
 
+(defcustom gnus-copy-article-ignored-headers '("Xref")
+  "List of headers to be removed when copying an article.
+Each element is a regular expression."
+  :version "22.0" ;; No Gnus
+  :type '(choice :custom-show nil
+		 regexp
+		 (repeat regexp))
+  :group 'gnus-article-various)
+
 (make-obsolete-variable 'gnus-article-hide-pgp-hook
 			"This variable is obsolete in Gnus 5.10.")
 
--- gnus-sum.el	12 Oct 2004 02:26:52 -0000	7.61
+++ gnus-sum.el	17 Oct 2004 17:40:23 -0000
@@ -9018,6 +9018,10 @@
 	 (save-excursion
 	   (set-buffer copy-buf)
 	   (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
+	     (save-restriction
+	       (nnheader-narrow-to-headers)
+	       (dolist (hdr gnus-copy-article-ignored-headers)
+		 (message-remove-header hdr t)))
 	     (gnus-request-accept-article
 	      to-newsgroup select-method (not articles) t))))
 	;; Crosspost the article.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: gnus-copy-article-ignored-headers
  2004-10-17 17:52 gnus-copy-article-ignored-headers Reiner Steib
@ 2004-10-17 20:56 ` Reiner Steib
  0 siblings, 0 replies; 2+ messages in thread
From: Reiner Steib @ 2004-10-17 20:56 UTC (permalink / raw)


On Sun, Oct 17 2004, Reiner Steib wrote:

+(defcustom gnus-copy-article-ignored-headers '("Xref")
+  "List of headers to be removed when copying an article.
+Each element is a regular expression."

Perhaps `nil' would be a better default value, in case someone wants
to copy articles from nntp to nnimap.  `nil' would also be compatible
with the previous behavior.

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-10-17 20:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-17 17:52 gnus-copy-article-ignored-headers Reiner Steib
2004-10-17 20:56 ` gnus-copy-article-ignored-headers Reiner Steib

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).