/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: Andrew Bennetts
  • Date: 2008-04-02 00:14:00 UTC
  • mfrom: (3324 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3756.
  • Revision ID: andrew.bennetts@canonical.com-20080402001400-r1pqse38i03dl97w
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
306
306
        return commandline
307
307
 
308
308
 
 
309
class EmacsMailMode(ExternalMailClient):
 
310
    """Call emacsclient in mail-mode.
 
311
    
 
312
    This only work for emacs >= 22.1.
 
313
    """
 
314
    _client_commands = ['emacsclient']
 
315
 
 
316
    def _get_compose_commandline(self, to, subject, attach_path):
 
317
        commandline = ["--eval"]
 
318
        # Ensure we can at least have an empty mail-mode buffer
 
319
        _to = "nil"
 
320
        _subject = "nil"
 
321
 
 
322
        if to is not None:
 
323
            _to = ("\"%s\"" % self._encode_safe(to))
 
324
        if subject is not None:
 
325
            _subject = ("\"%s\"" % self._encode_safe(subject))
 
326
        mmform = "(mail nil %s %s)" % (_to ,_subject)
 
327
 
 
328
        # call mail-mode, move the point to body and insert a new blank line
 
329
        # we *must* force this point movement for the case when To is not passed
 
330
        # with --mail-to. Without this, the patch could be inserted at the wrong place
 
331
        commandline.append(mmform)
 
332
        commandline.append("(mail-text)")
 
333
        commandline.append("(newline)")
 
334
 
 
335
        # ... and put a MIME attachment (if any)
 
336
        if attach_path is not None:
 
337
            ifform = "(attach \"%s\")" % self._encode_path(attach_path,'attachment')
 
338
            commandline.append(ifform)
 
339
        return commandline
 
340
 
 
341
 
309
342
class MAPIClient(ExternalMailClient):
310
343
    """Default Windows mail client launched using MAPI."""
311
344
 
346
379
            return Editor(self.config).compose(prompt, to, subject,
347
380
                          attachment, mimie_subtype, extension)
348
381
 
349
 
    def compose_merge_request(self, to, subject, directive):
 
382
    def compose_merge_request(self, to, subject, directive, basename=None):
350
383
        """See MailClient.compose_merge_request"""
351
384
        try:
352
385
            return self._mail_client().compose_merge_request(to, subject,
353
 
                                                             directive)
 
386
                    directive, basename=basename)
354
387
        except errors.MailClientNotFound:
355
388
            return Editor(self.config).compose_merge_request(to, subject,
356
 
                          directive)
 
389
                          directive, basename=basename)