Hello bats,

on Wed, 03. Mar 2004 at 22:27:44 +0100 Carsten Th�nges wrote:

>> ----->8 template for "Forward to" filter action 8<-------------
> [...]
>> %PY("
>> from string import replace
>> from re import sub
>   ^^^^^^^^^^^^^^^^^^
> a) import re

>> text = tb.macro(r'%%TEXT')

>> text = replace(text, '\nDelivered-To: GMX delivery to xxxxxxxxxxxxxxx)', '')
>> text = re.sub('[EMAIL PROTECTED]', '<protected>', text)
>          ^^^ or b) �text = sub(...�
>> print text
>> ")%-
>> ----->8--------------------------------------------------------
> I get an error with your code. But it works with either
> modification a) or b).

Thanks for your answer, but are you sure that you tested it with a
Sorting Filter (and not "plain" QT)?

It does not even work with a simple %PY("print 5") for the forward/new
message template here.. (message will be created, but with empty body.

I'm now using %QINCLUDE("!protext") for the forward template, which is
this:
----->8--------------------------------------------------------
%IF:'%FOLDERNAME'<>'SPAM':'%FROM="!! only from SPAM folder"%TO=""':#%-
%Subj=%OFullSubj%-
%From='[EMAIL PROTECTED]'%-

%PY("
from re import sub, search
from string import strip
text = '''%TEXT'''

text = sub('(?i)(Delivered-To: xxxxxxxxxxxxxxx'\
            '|((X-POPFile-Link|X-Text-Classification|X-GMX-Antispam|X-GMX-Antivirus): 
))[^\n]*\n', '', text)
text = sub('(?i)(To|Message-ID|References|In-Reply-To): [^\n]*\n', r'\1: <snip>\n', 
text)
text = sub('(?i)((xxxxxxxx|xxxxxx)\s*)?[^\s]*xxxxxx[^\s;]*', '<snip>', text)

text = text.strip()

if not search(r'(\n\n)', text):
   text = text + '\n\n' + 'Non-text-portions stripped..'

")%-
%PYX("text")%-
#%-
----->8--------------------------------------------------------

That works, but sometimes (has probably to do with opening sorting
office/QT manager) the filter does not work anymore: it changes read
status and colour group, but does not put the messages to Outbox.
Then I cannot close TB, it simply hangs, but without high CPU load.
This seems connected to the problem that Pyxie-plugin output does not
get redirected in general.

I'm also using avast! macros and MyMacros.


-- 
shinE!
http://www.thequod.de ICQ#152282665
GnuPG/PGP key: http://thequod.de/danielhahler.asc

Using The Bat! v2.04.7 on Windows XP 5.1 Build 2600 Service Pack 1
with POPFile 0.20.1 and avast Mar2004 (4.1.357).


________________________________________________________

http://www.silverstones.com/thebat/TBUDLInfo.html

Reply via email to