[RFC/Q] How to create a mail-client plugin? Do we need a registry?
Neil Martinsen-Burrell
nmb at wartburg.edu
Mon Aug 18 02:27:59 BST 2008
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
More information about the bazaar
mailing list