311
311
def _get_compose_commandline(self, to, subject, attach_path):
312
312
"""See ExternalMailClient._get_compose_commandline"""
313
compose_url = ['mailto:']
315
compose_url.append(self._encode_safe(to))
316
compose_url.append('?')
314
317
if subject is not None:
316
('subject', self._encode_safe(subject)))
318
# Don't use urllib.quote_plus because Claws doesn't seem
319
# to recognise spaces encoded as "+".
321
'subject=%s' % urllib.quote(self._encode_safe(subject)))
322
# Collect command-line options.
323
message_options = ['--compose', ''.join(compose_url)]
317
324
if attach_path is not None:
319
('attach', self._encode_path(attach_path, 'attachment')))
320
if self.config is not None:
321
username = self.config.username()
322
if username is not None:
324
('from', self._encode_safe(username)))
325
# Doesn't use urllib.urlencode because it uses quote_plus, and
326
# Claws doesn't seem to recognise spaces encoded as "+".
327
option_string = '&'.join(
328
'%s=%s' % (urllib.quote(key), urllib.quote(value))
329
for (key, value) in options)
332
return ['--compose', '%s?%s' % (self._encode_safe(to), option_string)]
325
message_options.extend(
326
['--attach', self._encode_path(attach_path, 'attachment')])
327
return message_options
333
328
mail_client_registry.register('claws', Claws,
334
329
help=Claws.__doc__)