diff options
author | Ivan Alejandro <ivanalejandro0@gmail.com> | 2015-05-11 18:04:29 -0300 |
---|---|---|
committer | Ivan Alejandro <ivanalejandro0@gmail.com> | 2015-05-14 12:41:48 -0300 |
commit | d5d9c3794566b999bfd42398072c9f7e3177d1b9 (patch) | |
tree | e8035a20e5f888e53b221b5593ea484d441f4f10 /src/leap/mail/outgoing | |
parent | 154e1aa347bb9ee0a9ed9abd60ed703a81cce017 (diff) |
[feat] adapt to new events api on common
- Related: #6359
Diffstat (limited to 'src/leap/mail/outgoing')
-rw-r--r-- | src/leap/mail/outgoing/service.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/leap/mail/outgoing/service.py b/src/leap/mail/outgoing/service.py index f3c2320..60ba8f5 100644 --- a/src/leap/mail/outgoing/service.py +++ b/src/leap/mail/outgoing/service.py @@ -31,7 +31,7 @@ from twisted.protocols.amp import ssl from twisted.python import log from leap.common.check import leap_assert_type, leap_assert -from leap.common.events import proto, signal +from leap.common.events import emit, catalog from leap.keymanager import KeyManager from leap.keymanager.openpgp import OpenPGPKey from leap.keymanager.errors import KeyNotFound, KeyAddressMismatch @@ -136,7 +136,7 @@ class OutgoingMail: """ dest_addrstr = smtp_sender_result[1][0][0] log.msg('Message sent to %s' % dest_addrstr) - signal(proto.SMTP_SEND_MESSAGE_SUCCESS, dest_addrstr) + emit(catalog.SMTP_SEND_MESSAGE_SUCCESS, dest_addrstr) def sendError(self, failure): """ @@ -146,7 +146,7 @@ class OutgoingMail: :type e: anything """ # XXX: need to get the address from the exception to send signal - # signal(proto.SMTP_SEND_MESSAGE_ERROR, self._user.dest.addrstr) + # emit(catalog.SMTP_SEND_MESSAGE_ERROR, self._user.dest.addrstr) err = failure.value log.err(err) raise err @@ -179,7 +179,7 @@ class OutgoingMail: requireAuthentication=False, requireTransportSecurity=True) factory.domain = __version__ - signal(proto.SMTP_SEND_MESSAGE_START, recipient.dest.addrstr) + emit(catalog.SMTP_SEND_MESSAGE_START, recipient.dest.addrstr) reactor.connectSSL( self._host, self._port, factory, contextFactory=SSLContextFactory(self._cert, self._key)) @@ -241,7 +241,7 @@ class OutgoingMail: return d def signal_encrypt_sign(newmsg): - signal(proto.SMTP_END_ENCRYPT_AND_SIGN, + emit(catalog.SMTP_END_ENCRYPT_AND_SIGN, "%s,%s" % (self._from_address, to_address)) return newmsg, recipient @@ -249,18 +249,18 @@ class OutgoingMail: failure.trap(KeyNotFound, KeyAddressMismatch) log.msg('Will send unencrypted message to %s.' % to_address) - signal(proto.SMTP_START_SIGN, self._from_address) + emit(catalog.SMTP_START_SIGN, self._from_address) d = self._sign(message, from_address) d.addCallback(signal_sign) return d def signal_sign(newmsg): - signal(proto.SMTP_END_SIGN, self._from_address) + emit(catalog.SMTP_END_SIGN, self._from_address) return newmsg, recipient log.msg("Will encrypt the message with %s and sign with %s." % (to_address, from_address)) - signal(proto.SMTP_START_ENCRYPT_AND_SIGN, + emit(catalog.SMTP_START_ENCRYPT_AND_SIGN, "%s,%s" % (self._from_address, to_address)) d = self._maybe_attach_key(origmsg, from_address, to_address) d.addCallback(maybe_encrypt_and_sign) |