/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/mail_client.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-01-08 15:00:19 UTC
  • mfrom: (3921.2.9 mail-client-claws)
  • Revision ID: pqm@pqm.ubuntu.com-20090108150019-nai6bai0u7f52p7s
(allenap) Direct support for Claws MUA (improves user experience)

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