[Users] How to colour incoming messages?

kardan kardan at riseup.net
Sat Jul 6 20:13:09 CEST 2013


Am Sat, 6 Jul 2013 17:36:09 +0200
schrieb kardan <kardan at riseup.net>:

> On Sat, 6 Jul 2013 23:39:28 +1000
> Adam Nielsen <a.nielsen at shikadi.net> wrote:
> 
> > The rules move mail I have *read* into specific archive folders.
> > So I want all the rules enabled, but I don't want them to run until
> > after I have read the message and I want it moved out of my inbox.
> > 
> > Is there another way to achieve this without using filters?
> 
> Basically what you want is that your rules only apply to read mails.
> 
> So you could add this to the rules manually
> (Criteria->Flag->unread->not set) which could be painful depending on
> your ruleset. I would use some hacky script like 
> $ cat .claws-mail/matcherrc|perl -e \
>   "while(<STDIN>){s/move/~unread move/;print}"
> 
> Of course it is wise to check if this should really apply to all your
> rules before. If you like your output, put it
> into .claws-mail/matcherrc
> 
> Without checking, just do
>   sed -i.bck "s/move/~unread move/" .claws-mail/matcherrc
> 
> Note: claws creates backups of the filters in matcherrc.bak. Yours
> will be in matcherrc.bck then.

Sorry, the above lines did not work. I tried the following with my
own matcherrc without syntax errors:

export MATCHFILE=.claws-mail/matcherrc
cat $MATCHFILE|perl -e\ "while(<STDIN>){ \
 s/(move|forward|color)/\& ~unread \1/ unless (/unread/); \
 print}" > $MATCHFILE.bck

If it looks fine do: cp $MATCHFILE{.bck,}

Claws needs to be restarted as the rules are parsed at startup.
Also it's a good idea to keep a backup outside of .claws-mail. :]

If there are multiple conditions it's not that easy as it is
not possible mix | and & so only two rules need match I think.

Kardan



More information about the Users mailing list