~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: Neil Martinsen-Burrell
  • Date: 2008-08-19 03:12:55 UTC
  • mto: (3644.1.2 bzr.dev)
  • mto: This revision was merged to the branch mainline in revision 3646.
  • Revision ID: nmb@wartburg.edu-20080819031255-bs3kjjz8aresvu92
Use a registry for mail clients.

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
    win32utils,
86
86
    )
87
87
from bzrlib.util.configobj import configobj
 
88
from bzrlib.mail_client import mail_client_registry
88
89
""")
89
90
 
90
91
 
148
149
        """Get a mail client to use"""
149
150
        selected_client = self.get_user_option('mail_client')
150
151
        try:
151
 
            mail_client_class = {
152
 
                None: mail_client.DefaultMail,
153
 
                # Specific clients
154
 
                'emacsclient': mail_client.EmacsMail,
155
 
                'evolution': mail_client.Evolution,
156
 
                'kmail': mail_client.KMail,
157
 
                'mutt': mail_client.Mutt,
158
 
                'thunderbird': mail_client.Thunderbird,
159
 
                # Generic options
160
 
                'default': mail_client.DefaultMail,
161
 
                'editor': mail_client.Editor,
162
 
                'mapi': mail_client.MAPIClient,
163
 
                'xdg-email': mail_client.XDGEmail,
164
 
            }[selected_client]
 
152
            mail_client_class = mail_client_registry.get(selected_client)
165
153
        except KeyError:
166
154
            raise errors.UnknownMailClient(selected_client)
167
155
        return mail_client_class(self)