~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/mail_client.py

  • Committer: Andrew Bennetts
  • Date: 2009-01-27 05:04:43 UTC
  • mfrom: (3960 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3981.
  • Revision ID: andrew.bennetts@canonical.com-20090127050443-3yw5hhk10ss23hzu
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import subprocess
20
20
import sys
21
21
import tempfile
 
22
import urllib
22
23
 
23
24
import bzrlib
24
25
from bzrlib import (
302
303
                              help=KMail.__doc__)
303
304
 
304
305
 
 
306
class Claws(ExternalMailClient):
 
307
    """Claws mail client."""
 
308
 
 
309
    _client_commands = ['claws-mail']
 
310
 
 
311
    def _get_compose_commandline(self, to, subject, attach_path):
 
312
        """See ExternalMailClient._get_compose_commandline"""
 
313
        compose_url = ['mailto:']
 
314
        if to is not None:
 
315
            compose_url.append(self._encode_safe(to))
 
316
        compose_url.append('?')
 
317
        if subject is not None:
 
318
            # Don't use urllib.quote_plus because Claws doesn't seem
 
319
            # to recognise spaces encoded as "+".
 
320
            compose_url.append(
 
321
                'subject=%s' % urllib.quote(self._encode_safe(subject)))
 
322
        # Collect command-line options.
 
323
        message_options = ['--compose', ''.join(compose_url)]
 
324
        if attach_path is not None:
 
325
            message_options.extend(
 
326
                ['--attach', self._encode_path(attach_path, 'attachment')])
 
327
        return message_options
 
328
mail_client_registry.register('claws', Claws,
 
329
                              help=Claws.__doc__)
 
330
 
 
331
 
305
332
class XDGEmail(ExternalMailClient):
306
333
    """xdg-email attempts to invoke the user's preferred mail client"""
307
334