summaryrefslogtreecommitdiff
path: root/src/leap
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap')
-rw-r--r--src/leap/bitmask/bonafide/_protocol.py6
-rw-r--r--src/leap/bitmask/bonafide/_srp.py1
-rw-r--r--src/leap/bitmask/bonafide/config.py5
-rw-r--r--src/leap/bitmask/bonafide/cred_srp.py18
-rw-r--r--src/leap/bitmask/bonafide/service.py5
-rw-r--r--src/leap/bitmask/bonafide/session.py8
-rw-r--r--src/leap/bitmask/cli/keys.py2
-rw-r--r--src/leap/bitmask/core/mail_services.py20
-rw-r--r--src/leap/bitmask/core/service.py2
-rw-r--r--src/leap/bitmask/keymanager/keys.py10
-rw-r--r--src/leap/bitmask/keymanager/migrator.py4
-rw-r--r--src/leap/bitmask/keymanager/openpgp.py10
-rw-r--r--src/leap/bitmask/mail/adaptors/soledad.py18
-rw-r--r--src/leap/bitmask/mail/imap/account.py7
-rw-r--r--src/leap/bitmask/mail/imap/mailbox.py4
-rw-r--r--src/leap/bitmask/mail/imap/messages.py2
-rw-r--r--src/leap/bitmask/mail/imap/service/imap-server.tac9
-rw-r--r--src/leap/bitmask/mail/imap/service/imap.py8
-rw-r--r--src/leap/bitmask/mail/incoming/service.py8
-rw-r--r--src/leap/bitmask/mail/mail.py16
-rw-r--r--src/leap/bitmask/mail/mailbox_indexer.py2
-rw-r--r--src/leap/bitmask/mail/outgoing/service.py22
-rw-r--r--src/leap/bitmask/mail/plugins/soledad_sync_hooks.py2
-rw-r--r--src/leap/bitmask/mail/smtp/README.rst2
-rw-r--r--src/leap/bitmask/mail/smtp/__init__.py7
-rw-r--r--src/leap/bitmask/mail/smtp/bounces.py4
-rw-r--r--src/leap/bitmask/mail/smtp/gateway.py22
-rw-r--r--src/leap/bitmask/mail/sync_hooks.py2
-rw-r--r--src/leap/bitmask/mail/testing/__init__.py7
-rw-r--r--src/leap/bitmask/mail/testing/imap.py10
-rw-r--r--src/leap/bitmask/mail/testing/smtp.py6
-rw-r--r--src/leap/bitmask/mail/walk.py2
32 files changed, 112 insertions, 139 deletions
diff --git a/src/leap/bitmask/bonafide/_protocol.py b/src/leap/bitmask/bonafide/_protocol.py
index 726185e..3986540 100644
--- a/src/leap/bitmask/bonafide/_protocol.py
+++ b/src/leap/bitmask/bonafide/_protocol.py
@@ -21,10 +21,10 @@ import os
import resource
from collections import defaultdict
-from leap.bonafide import config
-from leap.bonafide.provider import Api
-from leap.bonafide.session import Session, OK
from leap.common.config import get_path_prefix
+from leap.bitmask.bonafide import config
+from leap.bitmask.bonafide.provider import Api
+from leap.bitmask.bonafide.session import Session, OK
from twisted.cred.credentials import UsernamePassword
from twisted.internet.defer import fail
diff --git a/src/leap/bitmask/bonafide/_srp.py b/src/leap/bitmask/bonafide/_srp.py
index 38f657b..b0dd83f 100644
--- a/src/leap/bitmask/bonafide/_srp.py
+++ b/src/leap/bitmask/bonafide/_srp.py
@@ -143,5 +143,6 @@ class SRPAuthNoB(SRPAuthError):
class SRPAuthBadDataFromServer(SRPAuthError):
pass
+
class SRPRegistrationError(Exception):
pass
diff --git a/src/leap/bitmask/bonafide/config.py b/src/leap/bitmask/bonafide/config.py
index ae66a0e..0288676 100644
--- a/src/leap/bitmask/bonafide/config.py
+++ b/src/leap/bitmask/bonafide/config.py
@@ -30,13 +30,12 @@ from twisted.internet.ssl import ClientContextFactory
from twisted.python import log
from twisted.web.client import Agent, downloadPage
-from leap.bonafide._http import httpRequest
-from leap.bonafide.provider import Discovery
-
from leap.common.check import leap_assert
from leap.common.config import get_path_prefix as common_get_path_prefix
from leap.common.files import mkdir_p
# check_and_fix_urw_only, get_mtime
+from leap.bitmask.bonafide._http import httpRequest
+from leap.bitmask.bonafide.provider import Discovery
APPNAME = "bonafide"
diff --git a/src/leap/bitmask/bonafide/cred_srp.py b/src/leap/bitmask/bonafide/cred_srp.py
index 9fcb97b..c986c61 100644
--- a/src/leap/bitmask/bonafide/cred_srp.py
+++ b/src/leap/bitmask/bonafide/cred_srp.py
@@ -31,7 +31,7 @@ from twisted.cred import portal, credentials, error as credError
from twisted.cred.checkers import ICredentialsChecker
from twisted.internet import defer, reactor
-from leap.bonafide.session import Session
+from leap.bitmask.bonafide.session import Session
@implementer(ICredentialsChecker)
@@ -126,26 +126,10 @@ class LeapAuthRealm(object):
if __name__ == '__main__':
- # from the browser-id implementation
- #import sys
- #def _done(res):
- #print res
- #reactor.stop()
- #assertion = sys.argv[1]
- #d = defer.Deferred()
- #reactor.callLater(0, d.callback, "http://localhost:8081")
- #d.addCallback(SRPCredentialsChecker)
- #d.addCallback(lambda c: c.requestAvatarId(assertion))
- #d.addBoth(_done)
- #reactor.run()
-
# XXX move boilerplate to some bitmask-core template.
-
leap_realm = LeapAuthRealm()
# XXX should pass a provider mapping to realm too?
-
leap_portal = portal.Portal(leap_realm)
-
# XXX should we add an offline credentials checker, that's able
# to unlock local soledad sqlcipher backend?
# XXX should pass a provider mapping to credentials checker too?
diff --git a/src/leap/bitmask/bonafide/service.py b/src/leap/bitmask/bonafide/service.py
index 14585ef..deead22 100644
--- a/src/leap/bitmask/bonafide/service.py
+++ b/src/leap/bitmask/bonafide/service.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# service.py
-# Copyright (C) 2015 LEAP
+# Copyright (C) 2015-2016 LEAP
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,7 +14,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
"""
Bonafide Service.
"""
@@ -23,7 +22,7 @@ from collections import defaultdict
from leap.common.config import get_path_prefix
from leap.common.service_hooks import HookableService
-from leap.bonafide._protocol import BonafideProtocol
+from leap.bitmask.bonafide._protocol import BonafideProtocol
from twisted.internet import defer
from twisted.python import log
diff --git a/src/leap/bitmask/bonafide/session.py b/src/leap/bitmask/bonafide/session.py
index 4180041..f25fa05 100644
--- a/src/leap/bitmask/bonafide/session.py
+++ b/src/leap/bitmask/bonafide/session.py
@@ -20,9 +20,9 @@ LEAP Session management.
from twisted.internet import defer, reactor
from twisted.python import log
-from leap.bonafide import _srp
-from leap.bonafide import provider
-from leap.bonafide._http import httpRequest, cookieAgentFactory
+from leap.bitmask.bonafide import _srp
+from leap.bitmask.bonafide import provider
+from leap.bitmask.bonafide._http import httpRequest, cookieAgentFactory
OK = 'ok'
@@ -209,7 +209,7 @@ if __name__ == "__main__":
d.addErrback(auth_eb)
d.addCallback(lambda _: session.get_smtp_cert())
- #d.addCallback(lambda _: session.get_vpn_cert())
+ # d.addCallback(lambda _: session.get_vpn_cert())
d.addCallback(print_result)
d.addErrback(auth_eb)
diff --git a/src/leap/bitmask/cli/keys.py b/src/leap/bitmask/cli/keys.py
index d74c40a..4683ac2 100644
--- a/src/leap/bitmask/cli/keys.py
+++ b/src/leap/bitmask/cli/keys.py
@@ -23,7 +23,7 @@ import sys
from colorama import Fore
from leap.bitmask.cli import command
-from leap.keymanager.validation import ValidationLevels
+from leap.bitmask.keymanager.validation import ValidationLevels
class Keys(command.Command):
diff --git a/src/leap/bitmask/core/mail_services.py b/src/leap/bitmask/core/mail_services.py
index 68cb444..72a3512 100644
--- a/src/leap/bitmask/core/mail_services.py
+++ b/src/leap/bitmask/core/mail_services.py
@@ -29,17 +29,19 @@ from twisted.application import service
from twisted.internet import defer
from twisted.python import log
-from leap.bonafide import config
+# TODO move to bitmask.common
from leap.common.service_hooks import HookableService
-from leap.keymanager import KeyManager
-from leap.keymanager.errors import KeyNotFound
-from leap.keymanager.validation import ValidationLevels
+from leap.bitmask.bonafide import config
+from leap.bitmask.keymanager import KeyManager
+from leap.bitmask.keymanager.errors import KeyNotFound
+from leap.bitmask.keymanager.validation import ValidationLevels
+from leap.bitmask.mail.constants import INBOX_NAME
+from leap.bitmask.mail.mail import Account
+from leap.bitmask.mail.imap.service import imap
+from leap.bitmask.mail.incoming.service import IncomingMail
+from leap.bitmask.mail.incoming.service import INCOMING_CHECK_PERIOD
+from leap.bitmask.mail import smtp
from leap.soledad.client.api import Soledad
-from leap.mail.constants import INBOX_NAME
-from leap.mail.mail import Account
-from leap.mail.imap.service import imap
-from leap.mail.incoming.service import IncomingMail, INCOMING_CHECK_PERIOD
-from leap.mail import smtp
from leap.bitmask.core.uuid_map import UserMap
from leap.bitmask.core.configurable import DEFAULT_BASEDIR
diff --git a/src/leap/bitmask/core/service.py b/src/leap/bitmask/core/service.py
index 99132c2..79465a8 100644
--- a/src/leap/bitmask/core/service.py
+++ b/src/leap/bitmask/core/service.py
@@ -35,7 +35,7 @@ backend = flags.BACKEND
if backend == 'default':
from leap.bitmask.core import mail_services
- from leap.bonafide.service import BonafideService
+ from leap.bitmask.bonafide.service import BonafideService
elif backend == 'dummy':
from leap.bitmask.core.dummy import mail_services
from leap.bitmask.core.dummy import BonafideService
diff --git a/src/leap/bitmask/keymanager/keys.py b/src/leap/bitmask/keymanager/keys.py
index 91ecf3a..2ea4c8e 100644
--- a/src/leap/bitmask/keymanager/keys.py
+++ b/src/leap/bitmask/keymanager/keys.py
@@ -17,8 +17,6 @@
"""
Abstact key type and encryption scheme representations.
"""
-
-
import json
import logging
import re
@@ -26,10 +24,10 @@ import time
from datetime import datetime
-from leap.keymanager import errors
-from leap.keymanager.wrapper import TempGPGWrapper
-from leap.keymanager.validation import ValidationLevels
-from leap.keymanager import documents as doc
+from leap.bitmask.keymanager import errors
+from leap.bitmask.keymanager.wrapper import TempGPGWrapper
+from leap.bitmask.keymanager.validation import ValidationLevels
+from leap.bitmask.keymanager import documents as doc
logger = logging.getLogger(__name__)
diff --git a/src/leap/bitmask/keymanager/migrator.py b/src/leap/bitmask/keymanager/migrator.py
index c73da2e..979590c 100644
--- a/src/leap/bitmask/keymanager/migrator.py
+++ b/src/leap/bitmask/keymanager/migrator.py
@@ -26,8 +26,8 @@ Document migrator
from collections import namedtuple
from twisted.internet.defer import gatherResults, succeed
-from leap.keymanager import documents as doc
-from leap.keymanager.validation import ValidationLevels
+from leap.bitmask.keymanager import documents as doc
+from leap.bitmask.keymanager.validation import ValidationLevels
KEY_ID_KEY = 'key_id'
diff --git a/src/leap/bitmask/keymanager/openpgp.py b/src/leap/bitmask/keymanager/openpgp.py
index 31c13df..b07ac41 100644
--- a/src/leap/bitmask/keymanager/openpgp.py
+++ b/src/leap/bitmask/keymanager/openpgp.py
@@ -32,15 +32,15 @@ from twisted.internet import defer
from twisted.internet.threads import deferToThread
from leap.common.check import leap_assert, leap_assert_type, leap_check
-from leap.keymanager import errors
-from leap.keymanager.wrapper import TempGPGWrapper
-from leap.keymanager.keys import (
+from leap.bitmask.keymanager import errors
+from leap.bitmask.keymanager.wrapper import TempGPGWrapper
+from leap.bitmask.keymanager.keys import (
OpenPGPKey,
is_address,
parse_address,
build_key_from_dict,
)
-from leap.keymanager.documents import (
+from leap.bitmask.keymanager.documents import (
init_indexes,
TAGS_PRIVATE_INDEX,
TYPE_FINGERPRINT_PRIVATE_INDEX,
@@ -108,7 +108,7 @@ class OpenPGPScheme(object):
self._wait_indexes("get_key", "put_key", "get_all_keys")
def _migrate_documents_schema(self, _):
- from leap.keymanager.migrator import KeyDocumentsMigrator
+ from leap.bitmask.keymanager.migrator import KeyDocumentsMigrator
migrator = KeyDocumentsMigrator(self._soledad)
return migrator.migrate()
diff --git a/src/leap/bitmask/mail/adaptors/soledad.py b/src/leap/bitmask/mail/adaptors/soledad.py
index ca8f741..39c6bcb 100644
--- a/src/leap/bitmask/mail/adaptors/soledad.py
+++ b/src/leap/bitmask/mail/adaptors/soledad.py
@@ -29,15 +29,15 @@ from leap.soledad.common import l2db
from leap.common.check import leap_assert, leap_assert_type
-from leap.mail import constants
-from leap.mail import walk
-from leap.mail.adaptors import soledad_indexes as indexes
-from leap.mail.constants import INBOX_NAME
-from leap.mail.adaptors import models
-from leap.mail.imap.mailbox import normalize_mailbox
-from leap.mail.utils import lowerdict, first
-from leap.mail.utils import stringify_parts_map
-from leap.mail.interfaces import IMailAdaptor, IMessageWrapper
+from leap.bitmask.mail import constants
+from leap.bitmask.mail import walk
+from leap.bitmask.mail.adaptors import soledad_indexes as indexes
+from leap.bitmask.mail.constants import INBOX_NAME
+from leap.bitmask.mail.adaptors import models
+from leap.bitmask.mail.imap.mailbox import normalize_mailbox
+from leap.bitmask.mail.utils import lowerdict, first
+from leap.bitmask.mail.utils import stringify_parts_map
+from leap.bitmask.mail.interfaces import IMailAdaptor, IMessageWrapper
from leap.soledad.common.document import SoledadDocument
diff --git a/src/leap/bitmask/mail/imap/account.py b/src/leap/bitmask/mail/imap/account.py
index e795c1b..d885d59 100644
--- a/src/leap/bitmask/mail/imap/account.py
+++ b/src/leap/bitmask/mail/imap/account.py
@@ -28,10 +28,9 @@ from twisted.python import log
from zope.interface import implements
from leap.common.check import leap_assert, leap_assert_type
-
-from leap.mail.constants import MessageFlags
-from leap.mail.mail import Account
-from leap.mail.imap.mailbox import IMAPMailbox, normalize_mailbox
+from leap.bitmask.mail.constants import MessageFlags
+from leap.bitmask.mail.mail import Account
+from leap.bitmask.mail.imap.mailbox import IMAPMailbox, normalize_mailbox
from leap.soledad.client import Soledad
logger = logging.getLogger(__name__)
diff --git a/src/leap/bitmask/mail/imap/mailbox.py b/src/leap/bitmask/mail/imap/mailbox.py
index e70a1d8..b80280c 100644
--- a/src/leap/bitmask/mail/imap/mailbox.py
+++ b/src/leap/bitmask/mail/imap/mailbox.py
@@ -36,8 +36,8 @@ from zope.interface import implements
from leap.common.check import leap_assert
from leap.common.check import leap_assert_type
-from leap.mail.constants import INBOX_NAME, MessageFlags
-from leap.mail.imap.messages import IMAPMessage
+from leap.bitmask.mail.constants import INBOX_NAME, MessageFlags
+from leap.bitmask.mail.imap.messages import IMAPMessage
logger = logging.getLogger(__name__)
diff --git a/src/leap/bitmask/mail/imap/messages.py b/src/leap/bitmask/mail/imap/messages.py
index d1c7b93..841ebb2 100644
--- a/src/leap/bitmask/mail/imap/messages.py
+++ b/src/leap/bitmask/mail/imap/messages.py
@@ -22,7 +22,7 @@ from twisted.mail import imap4
from twisted.internet import defer
from zope.interface import implements
-from leap.mail.utils import find_charset, CaseInsensitiveDict
+from leap.bitmask.mail.utils import find_charset, CaseInsensitiveDict
logger = logging.getLogger(__name__)
diff --git a/src/leap/bitmask/mail/imap/service/imap-server.tac b/src/leap/bitmask/mail/imap/service/imap-server.tac
index c4d602d..685db6b 100644
--- a/src/leap/bitmask/mail/imap/service/imap-server.tac
+++ b/src/leap/bitmask/mail/imap/service/imap-server.tac
@@ -28,19 +28,18 @@ userid = 'user@provider'
uuid = 'deadbeefdeadabad'
passwd = 'supersecret' # optional, will get prompted if not found.
"""
-
# TODO -- this .tac file should be deprecated in favor of bitmask.core.bitmaskd
-
import ConfigParser
import getpass
import os
import sys
-from leap.keymanager import KeyManager
-from leap.mail.imap.service import imap
+from twisted.application import service, internet
+
+from leap.bitmask.keymanager import KeyManager
+from leap.bitmask.mail.imap.service import imap
from leap.soledad.client import Soledad
-from twisted.application import service, internet
# TODO should get this initializers from some authoritative mocked source
diff --git a/src/leap/bitmask/mail/imap/service/imap.py b/src/leap/bitmask/mail/imap/service/imap.py
index 4663854..aac49b6 100644
--- a/src/leap/bitmask/mail/imap/service/imap.py
+++ b/src/leap/bitmask/mail/imap/service/imap.py
@@ -32,9 +32,9 @@ from twisted.python import log
from zope.interface import implementer
from leap.common.events import emit_async, catalog
-from leap.mail.cred import LocalSoledadTokenChecker
-from leap.mail.imap.account import IMAPAccount
-from leap.mail.imap.server import LEAPIMAPServer
+from leap.bitmask.mail.cred import LocalSoledadTokenChecker
+from leap.bitmask.mail.imap.account import IMAPAccount
+from leap.bitmask.mail.imap.server import LEAPIMAPServer
# TODO: leave only an implementor of IService in here
@@ -42,7 +42,7 @@ logger = logging.getLogger(__name__)
DO_MANHOLE = os.environ.get("LEAP_MAIL_MANHOLE", None)
if DO_MANHOLE:
- from leap.mail.imap.service import manhole
+ from leap.bitmask.mail.imap.service import manhole
# The default port in which imap service will run
diff --git a/src/leap/bitmask/mail/incoming/service.py b/src/leap/bitmask/mail/incoming/service.py
index 1e20862..5490c19 100644
--- a/src/leap/bitmask/mail/incoming/service.py
+++ b/src/leap/bitmask/mail/incoming/service.py
@@ -39,10 +39,10 @@ from twisted.internet.task import deferLater
from leap.common.events import emit_async, catalog
from leap.common.check import leap_assert, leap_assert_type
from leap.common.mail import get_email_charset
-from leap.keymanager import errors as keymanager_errors
-from leap.mail.adaptors import soledad_indexes as fields
-from leap.mail.generator import Generator
-from leap.mail.utils import json_loads, empty
+from leap.bitmask.keymanager import errors as keymanager_errors
+from leap.bitmask.mail.adaptors import soledad_indexes as fields
+from leap.bitmask.mail.generator import Generator
+from leap.bitmask.mail.utils import json_loads, empty
from leap.soledad.client import Soledad
from leap.soledad.common.crypto import ENC_SCHEME_KEY, ENC_JSON_KEY
from leap.soledad.common.errors import InvalidAuthTokenError
diff --git a/src/leap/bitmask/mail/mail.py b/src/leap/bitmask/mail/mail.py
index 2fde3a1..7a16b46 100644
--- a/src/leap/bitmask/mail/mail.py
+++ b/src/leap/bitmask/mail/mail.py
@@ -37,13 +37,13 @@ from twisted.python import log
from leap.common.check import leap_assert_type
from leap.common.events import emit_async, catalog
-from leap.mail.adaptors.soledad import SoledadMailAdaptor
-from leap.mail.constants import INBOX_NAME
-from leap.mail.constants import MessageFlags
-from leap.mail.mailbox_indexer import MailboxIndexer
-from leap.mail.plugins import soledad_sync_hooks
-from leap.mail.utils import find_charset, CaseInsensitiveDict
-from leap.mail.utils import lowerdict
+from leap.bitmask.mail.adaptors.soledad import SoledadMailAdaptor
+from leap.bitmask.mail.constants import INBOX_NAME
+from leap.bitmask.mail.constants import MessageFlags
+from leap.bitmask.mail.mailbox_indexer import MailboxIndexer
+from leap.bitmask.mail.plugins import soledad_sync_hooks
+from leap.bitmask.mail.utils import find_charset, CaseInsensitiveDict
+from leap.bitmask.mail.utils import lowerdict
logger = logging.getLogger(name=__name__)
@@ -870,7 +870,7 @@ class Account(object):
basic collection handled by traditional MUAs, but it can also handle other
types of Collections (tag based, for instance).
- leap.mail.imap.IMAPAccount partially proxies methods in this
+ leap.bitmask.mail.imap.IMAPAccount partially proxies methods in this
class.
"""
diff --git a/src/leap/bitmask/mail/mailbox_indexer.py b/src/leap/bitmask/mail/mailbox_indexer.py
index c49f808..da12327 100644
--- a/src/leap/bitmask/mail/mailbox_indexer.py
+++ b/src/leap/bitmask/mail/mailbox_indexer.py
@@ -22,7 +22,7 @@ Local tables to store the message Unique Identifiers for a given mailbox.
import re
import uuid
-from leap.mail.constants import METAMSGID_RE
+from leap.bitmask.mail.constants import METAMSGID_RE
def _maybe_first_query_item(thing):
diff --git a/src/leap/bitmask/mail/outgoing/service.py b/src/leap/bitmask/mail/outgoing/service.py
index 8b02f2e..9fe3ec1 100644
--- a/src/leap/bitmask/mail/outgoing/service.py
+++ b/src/leap/bitmask/mail/outgoing/service.py
@@ -40,16 +40,16 @@ from twisted.python import log
from leap.common.check import leap_assert_type, leap_assert
from leap.common.events import emit_async, catalog
-from leap.keymanager.errors import KeyNotFound, KeyAddressMismatch
-from leap.mail import __version__
-from leap.mail import errors
-from leap.mail.utils import validate_address
-from leap.mail.rfc3156 import MultipartEncrypted
-from leap.mail.rfc3156 import MultipartSigned
-from leap.mail.rfc3156 import encode_base64_rec
-from leap.mail.rfc3156 import RFC3156CompliantGenerator
-from leap.mail.rfc3156 import PGPSignature
-from leap.mail.rfc3156 import PGPEncrypted
+from leap.bitmask import __version__
+from leap.bitmask.keymanager.errors import KeyNotFound, KeyAddressMismatch
+from leap.bitmask.mail import errors
+from leap.bitmask.mail.utils import validate_address
+from leap.bitmask.mail.rfc3156 import MultipartEncrypted
+from leap.bitmask.mail.rfc3156 import MultipartSigned
+from leap.bitmask.mail.rfc3156 import encode_base64_rec
+from leap.bitmask.mail.rfc3156 import RFC3156CompliantGenerator
+from leap.bitmask.mail.rfc3156 import PGPSignature
+from leap.bitmask.mail.rfc3156 import PGPEncrypted
# TODO
# [ ] rename this module to something else, service should be the implementor
@@ -223,7 +223,7 @@ class OutgoingMail(object):
heloFallback=True,
requireAuthentication=False,
requireTransportSecurity=True)
- factory.domain = bytes('leap.mail-' + __version__)
+ factory.domain = bytes('leap.bitmask.mail-' + __version__)
emit_async(catalog.SMTP_SEND_MESSAGE_START,
self._from_address, recipient.dest.addrstr)
reactor.connectSSL(
diff --git a/src/leap/bitmask/mail/plugins/soledad_sync_hooks.py b/src/leap/bitmask/mail/plugins/soledad_sync_hooks.py
index 9d48126..a13aaac 100644
--- a/src/leap/bitmask/mail/plugins/soledad_sync_hooks.py
+++ b/src/leap/bitmask/mail/plugins/soledad_sync_hooks.py
@@ -15,5 +15,5 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-from leap.mail.sync_hooks import MailProcessingPostSyncHook
+from leap.bitmask.mail.sync_hooks import MailProcessingPostSyncHook
post_sync_uid_reindexer = MailProcessingPostSyncHook()
diff --git a/src/leap/bitmask/mail/smtp/README.rst b/src/leap/bitmask/mail/smtp/README.rst
index 1d3a903..ec2c8c4 100644
--- a/src/leap/bitmask/mail/smtp/README.rst
+++ b/src/leap/bitmask/mail/smtp/README.rst
@@ -41,4 +41,4 @@ Running tests
Tests are run using Twisted's Trial API, like this::
- python setup.py test -s leap.mail.gateway.tests
+ python setup.py test -s leap.bitmask.mail.gateway.tests
diff --git a/src/leap/bitmask/mail/smtp/__init__.py b/src/leap/bitmask/mail/smtp/__init__.py
index 9fab70a..5f7fe66 100644
--- a/src/leap/bitmask/mail/smtp/__init__.py
+++ b/src/leap/bitmask/mail/smtp/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# __init__.py
-# Copyright (C) 2013 LEAP
+# Copyright (C) 2013-2016 LEAP
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,7 +14,6 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
"""
SMTP gateway helper function.
"""
@@ -25,12 +24,10 @@ from twisted.internet import reactor
from twisted.internet.error import CannotListenError
from leap.common.events import emit_async, catalog
-
-from leap.mail.smtp.gateway import SMTPFactory
+from leap.bitmask.mail.smtp.gateway import SMTPFactory
logger = logging.getLogger(__name__)
-
SMTP_PORT = 2013
diff --git a/src/leap/bitmask/mail/smtp/bounces.py b/src/leap/bitmask/mail/smtp/bounces.py
index 7a4674b..8260c1b 100644
--- a/src/leap/bitmask/mail/smtp/bounces.py
+++ b/src/leap/bitmask/mail/smtp/bounces.py
@@ -21,8 +21,8 @@ import time
from email.message import Message
from email.utils import formatdate
-from leap.mail.constants import INBOX_NAME
-from leap.mail.mail import Account
+from leap.bitmask.mail.constants import INBOX_NAME
+from leap.bitmask.mail.mail import Account
# TODO implement localization for this template.
diff --git a/src/leap/bitmask/mail/smtp/gateway.py b/src/leap/bitmask/mail/smtp/gateway.py
index e49bbe8..16e1af9 100644
--- a/src/leap/bitmask/mail/smtp/gateway.py
+++ b/src/leap/bitmask/mail/smtp/gateway.py
@@ -29,6 +29,7 @@ The following classes comprise the SMTP gateway service:
* EncryptedMessage - An implementation of twisted.mail.smtp.IMessage that
knows how to encrypt/sign itself before sending.
"""
+from email import generator
from email.Header import Header
from zope.interface import implements
@@ -42,20 +43,17 @@ from twisted.python import log
from leap.common.check import leap_assert_type
from leap.common.events import emit_async, catalog
-from leap.mail import errors
-from leap.mail.cred import LocalSoledadTokenChecker
-from leap.mail.utils import validate_address
-from leap.mail.rfc3156 import RFC3156CompliantGenerator
-from leap.mail.outgoing.service import outgoingFactory
-from leap.mail.smtp.bounces import bouncerFactory
-from leap.keymanager.errors import KeyNotFound
+from leap.bitmask.mail import errors
+from leap.bitmask.mail.cred import LocalSoledadTokenChecker
+from leap.bitmask.mail.utils import validate_address
+from leap.bitmask.mail.rfc3156 import RFC3156CompliantGenerator
+from leap.bitmask.mail.outgoing.service import outgoingFactory
+from leap.bitmask.mail.smtp.bounces import bouncerFactory
+from leap.bitmask.keymanager.errors import KeyNotFound
# replace email generator with a RFC 3156 compliant one.
-from email import generator
-
generator.Generator = RFC3156CompliantGenerator
-
LOCAL_FQDN = "bitmask.local"
@@ -237,7 +235,7 @@ class SMTPDelivery(object):
mail or not.
:type encrypted_only: bool
:param outgoing_mail: The outgoing mail to send the message
- :type outgoing_mail: leap.mail.outgoing.service.OutgoingMail
+ :type outgoing_mail: leap.bitmask.mail.outgoing.service.OutgoingMail
"""
self._userid = userid
self._outgoing_mail = outgoing_mail
@@ -368,7 +366,7 @@ class EncryptedMessage(object):
:param user: The recipient of this message.
:type user: twisted.mail.smtp.User
:param outgoing_mail: The outgoing mail to send the message
- :type outgoing_mail: leap.mail.outgoing.service.OutgoingMail
+ :type outgoing_mail: leap.bitmask.mail.outgoing.service.OutgoingMail
"""
# assert params
leap_assert_type(user, smtp.User)
diff --git a/src/leap/bitmask/mail/sync_hooks.py b/src/leap/bitmask/mail/sync_hooks.py
index 8efbb7c..ff4bf56 100644
--- a/src/leap/bitmask/mail/sync_hooks.py
+++ b/src/leap/bitmask/mail/sync_hooks.py
@@ -29,8 +29,8 @@ from twisted.internet import defer
from twisted.plugin import IPlugin
from twisted.python import log
+from leap.bitmask.mail import constants
from leap.soledad.client.interfaces import ISoledadPostSyncPlugin
-from leap.mail import constants
logger = logging.getLogger(__name__)
diff --git a/src/leap/bitmask/mail/testing/__init__.py b/src/leap/bitmask/mail/testing/__init__.py
index 8822a5c..b5a2a42 100644
--- a/src/leap/bitmask/mail/testing/__init__.py
+++ b/src/leap/bitmask/mail/testing/__init__.py
@@ -24,12 +24,9 @@ from twisted.internet.defer import gatherResults
from twisted.trial import unittest
from twisted.internet import defer
-
-from leap.soledad.client import Soledad
-from leap.keymanager import KeyManager
-
-
from leap.common.testing.basetest import BaseLeapTest
+from leap.bitmask.keymanager import KeyManager
+from leap.soledad.client import Soledad
ADDRESS = 'leap@leap.se'
ADDRESS_2 = 'anotheruser@leap.se'
diff --git a/src/leap/bitmask/mail/testing/imap.py b/src/leap/bitmask/mail/testing/imap.py
index 72acbf2..75ee9c7 100644
--- a/src/leap/bitmask/mail/testing/imap.py
+++ b/src/leap/bitmask/mail/testing/imap.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# utils.py
-# Copyright (C) 2014, 2015 LEAP
+# Copyright (C) 2014-2016 LEAP
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,10 +30,10 @@ from twisted.protocols import loopback
from twisted.python import log
from zope.interface import implementer
-from leap.mail.adaptors import soledad as soledad_adaptor
-from leap.mail.imap.account import IMAPAccount
-from leap.mail.imap.server import LEAPIMAPServer
-from leap.mail.testing.common import SoledadTestMixin
+from leap.bitmask.mail.adaptors import soledad as soledad_adaptor
+from leap.bitmask.mail.imap.account import IMAPAccount
+from leap.bitmask.mail.imap.server import LEAPIMAPServer
+from leap.bitmask.mail.testing.common import SoledadTestMixin
TEST_USER = "testuser@leap.se"
TEST_PASSWD = "1234"
diff --git a/src/leap/bitmask/mail/testing/smtp.py b/src/leap/bitmask/mail/testing/smtp.py
index d8690f1..834433f 100644
--- a/src/leap/bitmask/mail/testing/smtp.py
+++ b/src/leap/bitmask/mail/testing/smtp.py
@@ -1,8 +1,8 @@
from twisted.mail import smtp
-from leap.mail.smtp.gateway import SMTPFactory, LOCAL_FQDN
-from leap.mail.smtp.gateway import SMTPDelivery
-from leap.mail.outgoing.service import outgoingFactory
+from leap.bitmask.mail.smtp.gateway import SMTPFactory, LOCAL_FQDN
+from leap.bitmask.mail.smtp.gateway import SMTPDelivery
+from leap.bitmask.mail.outgoing.service import outgoingFactory
TEST_USER = u'anotheruser@leap.se'
diff --git a/src/leap/bitmask/mail/walk.py b/src/leap/bitmask/mail/walk.py
index d143d61..61bbe0b 100644
--- a/src/leap/bitmask/mail/walk.py
+++ b/src/leap/bitmask/mail/walk.py
@@ -25,7 +25,7 @@ from cryptography.hazmat.backends.openssl.backend import (
Backend as OpenSSLBackend)
from cryptography.hazmat.primitives import hashes
-from leap.mail.utils import first
+from leap.bitmask.mail.utils import first
crypto_backend = MultiBackend([OpenSSLBackend()])