Rev 3927: (allenap) Direct support for Claws MUA (improves user experience) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Jan 8 15:00:24 GMT 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3927
revision-id: pqm at pqm.ubuntu.com-20090108150019-nai6bai0u7f52p7s
parent: pqm at pqm.ubuntu.com-20090108001325-wcp1mp2u7a4li3na
parent: aaron at aaronbentley.com-20090108142230-ayxkv9nwxywop4dv
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2009-01-08 15:00:19 +0000
message:
  (allenap) Direct support for Claws MUA (improves user experience)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/help_topics/en/configuration.txt configuration.txt-20060314161707-868350809502af01
  bzrlib/mail_client.py          mail_client.py-20070809192806-vuxt3t19srtpjpdn-1
  bzrlib/tests/test_mail_client.py test_mail_client.py-20070809192806-vuxt3t19srtpjpdn-2
    ------------------------------------------------------------
    revno: 3921.2.9
    revision-id: aaron at aaronbentley.com-20090108142230-ayxkv9nwxywop4dv
    parent: aaron at aaronbentley.com-20090107060216-dk3zssva7shcdat4
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: mail-client-claws
    timestamp: Thu 2009-01-08 09:22:30 -0500
    message:
      Update test to pass under LANG=C
    modified:
      bzrlib/tests/test_mail_client.py test_mail_client.py-20070809192806-vuxt3t19srtpjpdn-2
    ------------------------------------------------------------
    revno: 3921.2.8
    revision-id: aaron at aaronbentley.com-20090107060216-dk3zssva7shcdat4
    parent: gavin.panella at canonical.com-20090106154845-hqeyknem8igvqtz9
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: mail-client-claws
    timestamp: Wed 2009-01-07 01:02:16 -0500
    message:
      Update docs
    modified:
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/help_topics/en/configuration.txt configuration.txt-20060314161707-868350809502af01
    ------------------------------------------------------------
    revno: 3921.2.7
    revision-id: gavin.panella at canonical.com-20090106154845-hqeyknem8igvqtz9
    parent: gavin.panella at canonical.com-20090106103547-hbucmeqtitexrqtp
    committer: Gavin Panella <gavin.panella at canonical.com>
    branch nick: mail-client-claws
    timestamp: Tue 2009-01-06 15:48:45 +0000
    message:
      Use a non-ascii character in test_commandline_is_8bit.
    modified:
      bzrlib/tests/test_mail_client.py test_mail_client.py-20070809192806-vuxt3t19srtpjpdn-2
    ------------------------------------------------------------
    revno: 3921.2.6
    revision-id: gavin.panella at canonical.com-20090106103547-hbucmeqtitexrqtp
    parent: gavin.panella at canonical.com-20090105171321-qxlmnhvzjgp2lr31
    committer: Gavin Panella <gavin.panella at canonical.com>
    branch nick: mail-client-claws
    timestamp: Tue 2009-01-06 10:35:47 +0000
    message:
      Update NEWS.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 3921.2.5
    revision-id: gavin.panella at canonical.com-20090105171321-qxlmnhvzjgp2lr31
    parent: gavin.panella at canonical.com-20090105171246-eq10vn8lrv80a2ao
    committer: Gavin Panella <gavin.panella at canonical.com>
    branch nick: mail-client-claws
    timestamp: Mon 2009-01-05 17:13:21 +0000
    message:
      Remove unused import.
    modified:
      bzrlib/tests/test_mail_client.py test_mail_client.py-20070809192806-vuxt3t19srtpjpdn-2
    ------------------------------------------------------------
    revno: 3921.2.4
    revision-id: gavin.panella at canonical.com-20090105171246-eq10vn8lrv80a2ao
    parent: gavin at gromper.net-20090105160455-53hza92cww634sv1
    committer: Gavin Panella <gavin.panella at canonical.com>
    branch nick: mail-client-claws
    timestamp: Mon 2009-01-05 17:12:46 +0000
    message:
      Use the --attach option, and don't specify a From: header.
    modified:
      bzrlib/mail_client.py          mail_client.py-20070809192806-vuxt3t19srtpjpdn-1
      bzrlib/tests/test_mail_client.py test_mail_client.py-20070809192806-vuxt3t19srtpjpdn-2
    ------------------------------------------------------------
    revno: 3921.2.3
    revision-id: gavin at gromper.net-20090105160455-53hza92cww634sv1
    parent: gavin at gromper.net-20090105160445-ivaal1987va1bwiu
    committer: Gavin Panella <gavin at gromper.net>
    branch nick: mail-client-claws
    timestamp: Mon 2009-01-05 16:04:55 +0000
    message:
      Tests for the Claws mail client.
    modified:
      bzrlib/tests/test_mail_client.py test_mail_client.py-20070809192806-vuxt3t19srtpjpdn-2
    ------------------------------------------------------------
    revno: 3921.2.2
    revision-id: gavin at gromper.net-20090105160445-ivaal1987va1bwiu
    parent: gavin at gromper.net-20090105153742-04sa36f4srgxo9wh
    committer: Gavin Panella <gavin at gromper.net>
    branch nick: mail-client-claws
    timestamp: Mon 2009-01-05 16:04:45 +0000
    message:
      Don't blow up if the config object is not supplied.
    modified:
      bzrlib/mail_client.py          mail_client.py-20070809192806-vuxt3t19srtpjpdn-1
    ------------------------------------------------------------
    revno: 3921.2.1
    revision-id: gavin at gromper.net-20090105153742-04sa36f4srgxo9wh
    parent: pqm at pqm.ubuntu.com-20081229142916-z08eu2alga2acrh6
    committer: Gavin Panella <gavin at gromper.net>
    branch nick: mail-client-claws
    timestamp: Mon 2009-01-05 15:37:42 +0000
    message:
      Support Claws.
    modified:
      bzrlib/mail_client.py          mail_client.py-20070809192806-vuxt3t19srtpjpdn-1
=== modified file 'NEWS'
--- a/NEWS	2009-01-08 00:13:25 +0000
+++ b/NEWS	2009-01-08 15:00:19 +0000
@@ -34,6 +34,12 @@
     * ``bzr revision-info`` now supports a -d option to specify an
       alternative branch. (Michael Hudson)
 
+    * Support the Claws mail client directly, rather than via
+      xdg-email. This prevents the display of an unnecessary modal
+      dialog in Claws, informing the user that a file has been
+      attached to the message, and works around bug #291847 in
+      xdg-utils which corrupts the destination address.
+
   BUG FIXES:
   
     * Fix a problem with CIFS client/server lag on windows colliding with

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2009-01-01 19:26:48 +0000
+++ b/bzrlib/builtins.py	2009-01-08 15:00:19 +0000
@@ -4260,9 +4260,9 @@
     
     To use a specific mail program, set the mail_client configuration option.
     (For Thunderbird 1.5, this works around some bugs.)  Supported values for
-    specific clients are "evolution", "kmail", "mutt", and "thunderbird";
-    generic options are "default", "editor", "emacsclient", "mapi", and
-    "xdg-email".  Plugins may also add supported clients.
+    specific clients are "claws", "evolution", "kmail", "mutt", and
+    "thunderbird"; generic options are "default", "editor", "emacsclient",
+    "mapi", and "xdg-email".  Plugins may also add supported clients.
 
     If mail is being sent, a to address is required.  This can be supplied
     either on the commandline, by setting the submit_to configuration

=== modified file 'bzrlib/help_topics/en/configuration.txt'
--- a/bzrlib/help_topics/en/configuration.txt	2008-04-16 02:23:01 +0000
+++ b/bzrlib/help_topics/en/configuration.txt	2009-01-07 06:02:16 +0000
@@ -333,6 +333,7 @@
 
 Supported values for specific clients:
 
+:claws: Use Claws.  This skips a dialog for attaching files.
 :evolution: Use Evolution.
 :kmail: Use KMail.
 :mutt: Use Mutt.

=== modified file 'bzrlib/mail_client.py'
--- a/bzrlib/mail_client.py	2008-09-08 12:59:00 +0000
+++ b/bzrlib/mail_client.py	2009-01-05 17:12:46 +0000
@@ -19,6 +19,7 @@
 import subprocess
 import sys
 import tempfile
+import urllib
 
 import bzrlib
 from bzrlib import (
@@ -302,6 +303,32 @@
                               help=KMail.__doc__)
 
 
+class Claws(ExternalMailClient):
+    """Claws mail client."""
+
+    _client_commands = ['claws-mail']
+
+    def _get_compose_commandline(self, to, subject, attach_path):
+        """See ExternalMailClient._get_compose_commandline"""
+        compose_url = ['mailto:']
+        if to is not None:
+            compose_url.append(self._encode_safe(to))
+        compose_url.append('?')
+        if subject is not None:
+            # Don't use urllib.quote_plus because Claws doesn't seem
+            # to recognise spaces encoded as "+".
+            compose_url.append(
+                'subject=%s' % urllib.quote(self._encode_safe(subject)))
+        # Collect command-line options.
+        message_options = ['--compose', ''.join(compose_url)]
+        if attach_path is not None:
+            message_options.extend(
+                ['--attach', self._encode_path(attach_path, 'attachment')])
+        return message_options
+mail_client_registry.register('claws', Claws,
+                              help=Claws.__doc__)
+
+
 class XDGEmail(ExternalMailClient):
     """xdg-email attempts to invoke the user's preferred mail client"""
 

=== modified file 'bzrlib/tests/test_mail_client.py'
--- a/bzrlib/tests/test_mail_client.py	2008-04-13 11:48:00 +0000
+++ b/bzrlib/tests/test_mail_client.py	2009-01-08 14:22:30 +0000
@@ -14,11 +14,14 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
+import urllib
+
 from bzrlib import (
     errors,
     mail_client,
     tests,
     urlutils,
+    osutils,
     )
 
 class TestMutt(tests.TestCase):
@@ -180,6 +183,38 @@
                 'Command-line item %r is unicode!' % item)
 
 
+class TestClaws(tests.TestCase):
+
+    def test_commandline(self):
+        claws = mail_client.Claws(None)
+        commandline = claws._get_compose_commandline(
+            None, None, 'file%')
+        self.assertEqual(
+            ['--compose', 'mailto:?', '--attach', 'file%'], commandline)
+        commandline = claws._get_compose_commandline(
+            'jrandom at example.org', 'Hi there!', None)
+        self.assertEqual(
+            ['--compose',
+             'mailto:jrandom at example.org?subject=Hi%20there%21'],
+            commandline)
+
+    def test_commandline_is_8bit(self):
+        claws = mail_client.Claws(None)
+        cmdline = claws._get_compose_commandline(
+            u'jrandom at example.org', u'\xb5cosm of fun!', u'file%')
+        subject_string = urllib.quote(
+            u'\xb5cosm of fun!'.encode(osutils.get_user_encoding(), 'replace'))
+        self.assertEqual(
+            ['--compose',
+             'mailto:jrandom at example.org?subject=%s' % subject_string,
+             '--attach',
+             'file%'],
+            cmdline)
+        for item in cmdline:
+            self.assertFalse(isinstance(item, unicode),
+                'Command-line item %r is unicode!' % item)
+
+
 class TestEditor(tests.TestCase):
 
     def test_get_merge_prompt_unicode(self):




More information about the bazaar-commits mailing list