summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2014-03-21 16:13:22 +0000
committerPatrick Totzke <patricktotzke@gmail.com>2014-03-21 16:16:19 +0000
commit9eae8da069d09454296df90917867008ec4fc81b (patch)
tree976dfde632d4cd64f40623b8c1fe36dcc13c93b6 /alot
parent8cc38a0f605b482f9de51685d477a644ee1a2573 (diff)
non-mailto arguments to `compose` are recipients
Diffstat (limited to 'alot')
-rw-r--r--alot/commands/globals.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/alot/commands/globals.py b/alot/commands/globals.py
index 813cdb94..51107899 100644
--- a/alot/commands/globals.py
+++ b/alot/commands/globals.py
@@ -644,19 +644,19 @@ class HelpCommand(Command):
'help': 'do not add signature'}),
(['--spawn'], {'action': BooleanAction, 'default': None,
'help': 'spawn editor in new terminal'}),
- (['mailto'], {'nargs': '*', 'default': None, 'help': ''}),
+ (['rest'], {'nargs': '*', 'default': None, 'help': ''}),
])
class ComposeCommand(Command):
"""compose a new email"""
def __init__(self, envelope=None, headers={}, template=None,
sender=u'', subject=u'', to=[], cc=[], bcc=[], attach=None,
- omit_signature=False, spawn=None, mailto=None, **kwargs):
+ omit_signature=False, spawn=None, rest=None, **kwargs):
"""
:param envelope: use existing envelope
:type envelope: :class:`~alot.db.envelope.Envelope`
:param headers: forced header values
- :type header: dict (str->str)
+ :type headers: dict (str->str)
:param template: name of template to parse into the envelope after
creation. This should be the name of a file in your
template_dir
@@ -677,6 +677,10 @@ class ComposeCommand(Command):
:type omit_signature: bool
:param spawn: force spawning of editor in a new terminal
:type spawn: bool
+ :param rest: remaining parameters. These can start with
+ 'mailto' in which case it is interpreted sa mailto string.
+ Otherwise it will be interpreted as recipients (to) header
+ :type rest: list(str)
"""
Command.__init__(self, **kwargs)
@@ -692,13 +696,17 @@ class ComposeCommand(Command):
self.attach = attach
self.omit_signature = omit_signature
self.force_spawn = spawn
- self.mailto = ' '.join(mailto)
+ self.rest = ' '.join(rest)
@inlineCallbacks
def apply(self, ui):
if self.envelope is None:
- if self.mailto: # is the empty list if not used
- self.envelope = mailto_to_envelope(self.mailto)
+ if self.rest:
+ if self.rest.startswith('mailto'):
+ self.envelope = mailto_to_envelope(self.rest)
+ else:
+ self.envelope = Envelope()
+ self.envelope.add('To', self.rest)
else:
self.envelope = Envelope()
if self.template is not None: