[Commits] compose_any NONE 1.1.2.1

wwp subscript at free.fr
Sun Aug 12 09:42:36 CEST 2012


Hello Holger


On Sun, 12 Aug 2012 01:13:24 +0000 holger at claws-mail.org wrote:

> Update of /home/claws-mail/plugins/python/examples/auto
> In directory srv:/tmp/cvs-serv20672/examples/auto
> 
> Added Files:
>       Tag: gtk2
> 	compose_any 
> Log Message:
> 2012-08-12 [holger]	0.10cvs4
> 
> 	* examples/README.examples
> 	* examples/auto/compose_any
> 		Add compose_any script to strip subject reply prefixes.
> 		This has been suggested by Michael Gmelin and Slavko on
> 		Users ML 
> 
> --- NEW FILE: compose_any ---
> import re
> 
> # Strip prefixes in subject
> #
> # When replying to a reply, Claws Mail strips the "Re: " reply
> # marker of the subject line before prefixing with its own.
> # Claws Mail also knows several localized variants from various
> # mailers, such as "Aw: " (German Outlook), "Odp: " (Polish Outlook)
> # and so on.
> #
> # However, it doesn't know all, and as of 3.8.1, adding new ones
> # is not possible via a config option.
> #
> # This function is there to add new markers. It will also strip
> # an already messed up original subject line, provided that all
> # prefixes are defined below.
> # So, for example, replying to a mail with
> #    Subject: R: Re: R: Re: Aw: R: Re: Old topic
> # will result in 
> #    Subject: Re: Old topic
> #
> # This is a slightly adapted version of a script provided
> # by Michael Gmelin and Slavko on Claws Mail's users mailing list.
> def strip_subject_prefixes():
>     # A list of prefixes to strip during reply. Add the ones that are
>     # interesting for you here.
>     prefixes = ["Re", "R", "Odp", "Aw"]
>     
>     # Build up regex to match unwanted prefixes
>     prefix_string = "|".join(prefixes)
>     regex_str = r"^(Re|Fwd|Fw):( (%s):)+" % prefix_string
>     
>     # Get a string with those prefixes stripped
>     new_subject = re.sub(regex_str, r"\1:",	clawsmail.compose_window.get_subject())

Am I wrong or it doesn't cover the half of what's covered in CM
internals?

Quoting src/common/utils.c for information:

		"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) */

But does it matter?


Regards,

-- 
wwp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.claws-mail.org/pipermail/commits/attachments/20120812/db20229c/attachment.pgp>


More information about the Commits mailing list