summaryrefslogtreecommitdiff
path: root/src/leap/mail/smtp
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2015-05-11 18:04:29 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2015-05-14 12:41:48 -0300
commitd5d9c3794566b999bfd42398072c9f7e3177d1b9 (patch)
treee8035a20e5f888e53b221b5593ea484d441f4f10 /src/leap/mail/smtp
parent154e1aa347bb9ee0a9ed9abd60ed703a81cce017 (diff)
[feat] adapt to new events api on common
- Related: #6359
Diffstat (limited to 'src/leap/mail/smtp')
-rw-r--r--src/leap/mail/smtp/__init__.py6
-rw-r--r--src/leap/mail/smtp/gateway.py12
2 files changed, 9 insertions, 9 deletions
diff --git a/src/leap/mail/smtp/__init__.py b/src/leap/mail/smtp/__init__.py
index 24402b4..3ef016b 100644
--- a/src/leap/mail/smtp/__init__.py
+++ b/src/leap/mail/smtp/__init__.py
@@ -26,7 +26,7 @@ from leap.mail.outgoing.service import OutgoingMail
logger = logging.getLogger(__name__)
-from leap.common.events import proto, signal
+from leap.common.events import emit, catalog
from leap.mail.smtp.gateway import SMTPFactory
@@ -65,12 +65,12 @@ def setup_smtp_gateway(port, userid, keymanager, smtp_host, smtp_port,
factory = SMTPFactory(userid, keymanager, encrypted_only, outgoing_mail)
try:
tport = reactor.listenTCP(port, factory, interface="localhost")
- signal(proto.SMTP_SERVICE_STARTED, str(port))
+ emit(catalog.SMTP_SERVICE_STARTED, str(port))
return factory, tport
except CannotListenError:
logger.error("STMP Service failed to start: "
"cannot listen in port %s" % port)
- signal(proto.SMTP_SERVICE_FAILED_TO_START, str(port))
+ emit(catalog.SMTP_SERVICE_FAILED_TO_START, str(port))
except Exception as exc:
logger.error("Unhandled error while launching smtp gateway service")
logger.exception(exc)
diff --git a/src/leap/mail/smtp/gateway.py b/src/leap/mail/smtp/gateway.py
index 954a7d0..dd2c32d 100644
--- a/src/leap/mail/smtp/gateway.py
+++ b/src/leap/mail/smtp/gateway.py
@@ -39,7 +39,7 @@ from twisted.python import log
from email.Header import Header
from leap.common.check import leap_assert_type
-from leap.common.events import proto, signal
+from leap.common.events import emit, catalog
from leap.keymanager.openpgp import OpenPGPKey
from leap.keymanager.errors import KeyNotFound
from leap.mail.utils import validate_address
@@ -201,19 +201,19 @@ class SMTPDelivery(object):
# verify if recipient key is available in keyring
def found(_):
log.msg("Accepting mail for %s..." % user.dest.addrstr)
- signal(proto.SMTP_RECIPIENT_ACCEPTED_ENCRYPTED, user.dest.addrstr)
+ emit(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:
- signal(proto.SMTP_RECIPIENT_REJECTED, user.dest.addrstr)
+ emit(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).")
- signal(
- proto.SMTP_RECIPIENT_ACCEPTED_UNENCRYPTED,
+ emit(
+ catalog.SMTP_RECIPIENT_ACCEPTED_UNENCRYPTED,
user.dest.addrstr)
def encrypt_func(_):
@@ -306,7 +306,7 @@ class EncryptedMessage(object):
"""
log.msg("Connection lost unexpectedly!")
log.err()
- signal(proto.SMTP_CONNECTION_LOST, self._user.dest.addrstr)
+ emit(catalog.SMTP_CONNECTION_LOST, self._user.dest.addrstr)
# unexpected loss of connection; don't save
self._lines = []