[RFC/Q] How to create a mail-client plugin? Do we need a registry?

John Arbash Meinel john at arbash-meinel.com
Mon Aug 18 21:53:23 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Neil Martinsen-Burrell wrote:
> As has been mentioned before on this list, the best way to control Mail.app on
> Mac OS X to use it as a client for `bzr send` is to use Applescript.  It should
> be possible to use a separate file containing an Applescript that takes to,
> from, text, attachment, etc. as arguments and opens up the message in Mail.app.
>  A more pythonic way is to use the python module appscript [1].  This provides
> an object oriented python binding to Applescript commands.
> 
> In order to avoid introducing an external dependency on Bazaar (at least for Mac
> OS X where people set email_client = 'Mail.app') it would be nice to distribute
> a plugin that uses appscript to provide a mail_client that works under OS X. 
> But, I can't see how it would be possible to do a new mail_client from a plugin.
> 
> In particular, cmd_send dispatches based on bzrlib.config.get_mail_client(),
> which uses a literal dictionary to map configuration values to particular
> MailClient subclasses.  I can't see how to add an additional mapping for a new
> key to this dictionary from my plugin without having to monkey-patch
> bzrlib.config.  Am I missing something about a way to do this, or is it
> currently not possible?
> 
> A possible solution is some sort of registry system for mail_clients.  There
> seem to be plenty of similar registries in bzrlib (e.g. version-info formats) so
> would this be an appropriate use for another one?
> 
> -Neil
> 
> 
> 

At a minimum, I'm pretty surprised that the mail client dictionary is inside a
function. That is pretty opposed to how we have written the rest of the
library. As you say, most of it is Registry based, or at least a semi-public
dictionary that you can poke new entries in. So I would fully support moving
that dict out and into a Registry.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIqeFDJdeBCYSNAAMRApV8AJ4pB+sq7BaneQbfwS+umJDFvUO2XQCeKnpo
oM8NY4/V9TVsnFY/qpE4fNQ=
=nNV+
-----END PGP SIGNATURE-----



More information about the bazaar mailing list