[Users] The reply mark in subject (R: Re:) recognition

Michael Gmelin freebsd at grem.de
Tue Aug 7 23:53:20 CEST 2012



On Tue, 7 Aug 2012 20:26:14 +0200
Slavko <linux at slavino.sk> wrote:

> Ahoj,


> 
> Dňa Tue, 7 Aug 2012 20:22:36 +0200 Michael Gmelin <freebsd at grem.de>
> napísal:
> 
> > That's why I think that if claws does anything about it, it should
> > be configurable and not a set of hardcoded workarounds  - afaik it
> > should
> 
> see my early post :-)
> 
> > be fairly easy to do that using the python scripting plugin (like 10
> > lines of python), given the nature of this, that's probably a better
> > approach.
> 
> please, can you provide this? I am not a programmer…
> 
> regards
> 

Install and activate the Claws Python plugin
(Configuration->Plugins...), open a terminal running bash and run the
following commands (copy and paste is your friend):

mkdir -p ~/.claws-mail/python-scripts/auto
cat > ~/.claws-mail/python-scripts/auto/compose_any << EOF
#!/usr/bin/env python
# save this as ~/.claws-mail/python-scripts/auto/compose_any
# Workaround for R: in reply headers

import re
clawsmail.compose_window.set_subject(re.sub(
  r"^(Re|Fwd|Fw): R:", r"\1:",
  clawsmail.compose_window.get_subject()
))
EOF

This will create a script called

~/.claws-mail/python-scripts/auto/compose_any

(~ is your home directory, compose_any is a file name that contains
python code and that's always called when opening the compose window,
make sure to get this right, since the plugin is not complaining
in case of syntax errors, but just not affecting the output at all)

with the following content:

#!/usr/bin/env python
# save this as ~/.claws-mail/python-scripts/auto/compose_any
# Workaround for R: in reply headers

import re

clawsmail.compose_window.set_subject(re.sub(
  r"^(Re|Fwd|Fw): R:", r"\1:",
  clawsmail.compose_window.get_subject()
))

As an alternative, in case you want to recompile claws yourself and
maintaining a patch to it, you could also change utils.c, since as I
learned, the German versions are already covered by claws mail. This is
done in utils.c around line 3740, where it reads:


  static const gchar * const prefixes[] = {
    "Re\\:",      /* "Re:" */
    "Re\\[[1-9][0-9]*\\]\\:", /* "Re[XXX]:" (non-conforming news mail
  clients) */ "Antw\\:",      /* "Antw:" (Dutch / German Outlook) */
    "Aw\\:",      /* "Aw:"   (German) */
    "Antwort\\:",     /* "Antwort:" (German Lotus Notes) */
    "Res\\:",     /* "Res:" (Spanish/Brazilian Outlook) */
    "Fw\\:",      /* "Fw:" Forward */ 
    "Fwd\\:",     /* "Fwd:" Forward */
    "Enc\\:",     /* "Enc:" Forward (Brazilian Outlook) */
    "Odp\\:",     /* "Odp:" Re (Polish Outlook) */
    "Rif\\:",     /* "Rif:" (Italian Outlook) */
    "Sv\\:",      /* "Sv" (Norwegian) */
    "Vs\\:",      /* "Vs" (Norwegian) */
    "Ad\\:",      /* "Ad" (Norwegian) */
    "\347\255\224\345\244\215\\:",  /* "Re" (Chinese, UTF-8) */  
    "R\303\251f\\. \\:",    /* "R�f. :" (French Lotus Notes) */
    "Re \\:",     /* "Re :" (French Yahoo Mail) */
    /* add more */
  };

It's trivial to add your own prefixes here and recompile.

Cheers,
Michael

-- 
Michael Gmelin



More information about the Users mailing list