summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/services/mail/conductor.py
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2014-09-11 16:59:03 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2014-09-11 16:59:03 -0300
commitaacc94aac0f824bb1c292a1cddbbe1a6a0cd4d39 (patch)
tree19f99bf8a5a24eb555680ad767e6da999a0e55f3 /src/leap/bitmask/services/mail/conductor.py
parentbdfac84e20389e2653939fa9f2dd9752eaabcfed (diff)
parent3d0708ad3e20aa8dddf6894b7536be3cd59cfbca (diff)
Merge remote-tracking branch 'meskio/feature/6040_email_firewall' into develop
Diffstat (limited to 'src/leap/bitmask/services/mail/conductor.py')
-rw-r--r--src/leap/bitmask/services/mail/conductor.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/leap/bitmask/services/mail/conductor.py b/src/leap/bitmask/services/mail/conductor.py
index 5e85368f..416aff34 100644
--- a/src/leap/bitmask/services/mail/conductor.py
+++ b/src/leap/bitmask/services/mail/conductor.py
@@ -22,6 +22,7 @@ import logging
from leap.bitmask.config import flags
from leap.bitmask.gui import statemachines
from leap.bitmask.services.mail import connection as mail_connection
+from leap.bitmask.services.mail.emailfirewall import get_email_firewall
from leap.common.events import events_pb2 as leap_events
from leap.common.events import register as leap_register
@@ -211,6 +212,11 @@ class MailConductor(IMAPControl, SMTPControl):
self._mail_connection = mail_connection.MailConnection()
self._userid = None
+ try:
+ self._firewall = get_email_firewall()
+ except NotImplementedError:
+ self._firewall = None
+ logger.info("Email firewall is not implemented in this platform")
@property
def userid(self):
@@ -247,12 +253,25 @@ class MailConductor(IMAPControl, SMTPControl):
self._smtp_machine = smtp
self._smtp_machine.start()
+ def start_mail_service(self, download_if_needed=False, offline=False):
+ """
+ Start the IMAP and SMTP servcies.
+ """
+ if self._firewall is not None:
+ self._firewall.start()
+ if not offline:
+ logger.debug("not starting smtp in offline mode")
+ self.start_smtp_service(download_if_needed=download_if_needed)
+ self.start_imap_service()
+
def stop_mail_services(self):
"""
Stop the IMAP and SMTP services.
"""
self.stop_imap_service()
self.stop_smtp_service()
+ if self._firewall is not None:
+ self._firewall.stop()
def connect_mail_signals(self, widget):
"""