From 0a03c0a014b1874114eabb855705ca79f09d1982 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Mon, 14 Sep 2015 23:19:58 -0400 Subject: [feat] use async events api in this way, we're using twisted reactor instead of having another thread with zmq's own copy of tornado ioloop. Resolves: #7274 --- src/leap/mail/smtp/gateway.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/leap/mail/smtp/gateway.py') diff --git a/src/leap/mail/smtp/gateway.py b/src/leap/mail/smtp/gateway.py index 7dae907..dd110e0 100644 --- a/src/leap/mail/smtp/gateway.py +++ b/src/leap/mail/smtp/gateway.py @@ -37,7 +37,7 @@ from twisted.python import log from email.Header import Header from leap.common.check import leap_assert_type -from leap.common.events import emit, catalog +from leap.common.events import emit_async, catalog from leap.keymanager.openpgp import OpenPGPKey from leap.keymanager.errors import KeyNotFound from leap.mail.utils import validate_address @@ -204,18 +204,18 @@ class SMTPDelivery(object): # verify if recipient key is available in keyring def found(_): log.msg("Accepting mail for %s..." % user.dest.addrstr) - emit(catalog.SMTP_RECIPIENT_ACCEPTED_ENCRYPTED, user.dest.addrstr) + emit_async(catalog.SMTP_RECIPIENT_ACCEPTED_ENCRYPTED, user.dest.addrstr) def not_found(failure): failure.trap(KeyNotFound) # if key was not found, check config to see if will send anyway if self._encrypted_only: - emit(catalog.SMTP_RECIPIENT_REJECTED, user.dest.addrstr) + emit_async(catalog.SMTP_RECIPIENT_REJECTED, user.dest.addrstr) raise smtp.SMTPBadRcpt(user.dest.addrstr) log.msg("Warning: will send an unencrypted message (because " "encrypted_only' is set to False).") - emit( + emit_async( catalog.SMTP_RECIPIENT_ACCEPTED_UNENCRYPTED, user.dest.addrstr) @@ -309,7 +309,7 @@ class EncryptedMessage(object): """ log.msg("Connection lost unexpectedly!") log.err() - emit(catalog.SMTP_CONNECTION_LOST, self._user.dest.addrstr) + emit_async(catalog.SMTP_CONNECTION_LOST, self._user.dest.addrstr) # unexpected loss of connection; don't save self._lines = [] -- cgit v1.2.3 From 1a1dcbd660536ad6351c6a3746a8d8f8a6a31ef9 Mon Sep 17 00:00:00 2001 From: Folker Bernitt Date: Wed, 16 Sep 2015 10:13:12 +0200 Subject: [style] fix pep8 warnings --- src/leap/mail/smtp/gateway.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/leap/mail/smtp/gateway.py') diff --git a/src/leap/mail/smtp/gateway.py b/src/leap/mail/smtp/gateway.py index dd110e0..c988367 100644 --- a/src/leap/mail/smtp/gateway.py +++ b/src/leap/mail/smtp/gateway.py @@ -204,7 +204,8 @@ class SMTPDelivery(object): # verify if recipient key is available in keyring def found(_): log.msg("Accepting mail for %s..." % user.dest.addrstr) - emit_async(catalog.SMTP_RECIPIENT_ACCEPTED_ENCRYPTED, user.dest.addrstr) + emit_async(catalog.SMTP_RECIPIENT_ACCEPTED_ENCRYPTED, + user.dest.addrstr) def not_found(failure): failure.trap(KeyNotFound) -- cgit v1.2.3 From fcdc227c23e6958aab902c95aeab35285c9993f0 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Tue, 22 Sep 2015 17:38:48 -0400 Subject: [refactor] avoid circular import due to rfc3156 --- src/leap/mail/smtp/gateway.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/leap/mail/smtp/gateway.py') diff --git a/src/leap/mail/smtp/gateway.py b/src/leap/mail/smtp/gateway.py index c988367..45560bf 100644 --- a/src/leap/mail/smtp/gateway.py +++ b/src/leap/mail/smtp/gateway.py @@ -41,10 +41,7 @@ from leap.common.events import emit_async, catalog from leap.keymanager.openpgp import OpenPGPKey from leap.keymanager.errors import KeyNotFound from leap.mail.utils import validate_address - -from leap.mail.smtp.rfc3156 import ( - RFC3156CompliantGenerator, -) +from leap.mail.rfc3156 import RFC3156CompliantGenerator # replace email generator with a RFC 3156 compliant one. from email import generator -- cgit v1.2.3