procmail
[Top] [All Lists]

Editing incoming data - a technique check

2001-12-25 09:44:24
Setup:  OS = RedHat linux 7.1
        procmail-3.21-0.71

In this case the incoming data is actually nntpserver output, pulled
in by `suck'. 

I'm adding the mbox From line and want to rewrite the Xref line if it
is present.  I'm not entirely sure the Xref line is always present bu
wasn't sure how to work a test into the procmail rules.

Not really rewrite Xref but capture it and put it under a different
header.

I'm trying the recipe below.  It is the sole recipe in this
procmailrc.

Looks like this might write a blank X-Save-Xref in the event a message
lacked an Xref header, which is OK, but I wondered if there are other
things that will happen here, that I haven't accounted for.  Or maybe
a better way to get the same result.

The desired result is to write an mbox `From' line and rewirte Xref into
a different header if it exists, while converting usenet messages to
mbox messags.

[NOTE: The DELIVERY variable is set elsewhere and changes depending on
which newsgroup the action is taking place from]
 :0 
{
  :0 wf
 * ^Xref:..\/.*

  :0 wf 
  | formail -I "X-Save-Xref: ${MATCH}" \

   :0 :
   1.$DELIVERY.in
}

I hoped by using two different filters, that in the worst case.  An
extraneous X-Save-Xref: would get added, if a message had no Xref
header. But in any case the `From' line would be added to *ALL*
messages. 

The recipe this will replace looked like:

 :0 
{
  :0 wf 
  | formail

   :0 :
   1.$DELIVERY.in
}

Which has been working successfully, but doesn't attempt to do
anything with Xref.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>