[Users] Flagging non-default accounts during compose?

Pierre Fortin pf at pfortin.com
Sat Jul 20 03:58:29 CEST 2013

Hi Holger,

THANKS!!  A great start...  :)

Here's my generic version, so far:
# flag compose window if not on default account
import os,gtk
##FIXME Need a way to bail when a non-default account is set in folder Properties
## address = ""    # not necessary unless accountrc structure changes
## default = False #  "
for line in open(os.path.join(os.environ["HOME"],".claws-mail","accountrc")).readlines():
    if line.startswith("[Account:"):  # next account; reset variables
        address = ""
        default = False
    elif line.startswith("is_default="):  # default account?
        tag,isdefault = line.strip().split('=')
        default = not isdefault == '0'  # in case other than '1' is used in future
    elif line.startswith("address="):  # 
            tag,address = line.strip().split('=')
    if default and address:  # bail when we have both
# a default account always exists, so...
if default and address not in clawsmail.compose_window.get_from():
    clawsmail.compose_window.text.modify_base(gtk.STATE_NORMAL, gtk.gdk.color_parse("#FFF0AA"))

However, this is biting me:
  	Gets executed whenever a compose window is opened, no matter
  	if that opening happened as a result of composing a new
  	message, replying or forwarding a message.

When replying in a folder (CM list in this case) which has a non-default
account address, the background is yellow...  Is there a way to get at
something like folder.Properties.Compose.DefaultTo...?  This would allow
me to add right after the import:
  if not folder.Properties.Compose.DefaultTo == "":


On Sat, 20 Jul 2013 01:43:48 +0200 Holger Berndt wrote:

>Hello Pierre,
>On Di, 16.07.2013 12:53, Pierre Fortin wrote:
>>Is there a way to change the background of the compose window for all
>>but the default account to some color (say yellow) as a warning? 
>That's possible with the Python plugin and the following snippet in the
>auto compose_any script:
>if "<pf at pfortin.com>" not in clawsmail.compose_window.get_from():
>        clawsmail.compose_window.text.modify_base(gtk.STATE_NORMAL,
> gtk.gdk.color_parse("#FFF0AA"))
>It will only be applied when the compose window is opened. If you
>actively change the account in the window later on, no change will
>Users mailing list
>Users at lists.claws-mail.org

More information about the Users mailing list