summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/core
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2016-12-27 02:08:19 +0100
committerKali Kaneko (leap communications) <kali@leap.se>2017-03-05 00:12:12 +0100
commit304f0cc995f6d861edca19ebf7c0ee8f8c6a2ea1 (patch)
tree1fa48d6badc62e81538bf73e47233569677ffa36 /src/leap/bitmask/core
parentd908a262680fa50ea2dcef9a866d9f03af65ce6f (diff)
[feature] pixelated UA integration
a bit hacky and all, but this should launch the service and allow interacting from the default site (localhost:9090). this is the first example of a pyqt-js bridge, it's an interesting mechanism that we can use more in the future. no efforts made so far in authenticating the app.
Diffstat (limited to 'src/leap/bitmask/core')
-rw-r--r--src/leap/bitmask/core/mail_services.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/leap/bitmask/core/mail_services.py b/src/leap/bitmask/core/mail_services.py
index 92712019..7d5d9533 100644
--- a/src/leap/bitmask/core/mail_services.py
+++ b/src/leap/bitmask/core/mail_services.py
@@ -34,6 +34,7 @@ from twisted.internet import task
from twisted.logger import Logger
from leap.common.files import check_and_fix_urw_only
+from leap.bitmask import pix
from leap.bitmask.hooks import HookableService
from leap.bitmask.bonafide import config
from leap.bitmask.keymanager import KeyManager
@@ -499,6 +500,7 @@ class StandardMailService(service.MultiService, HookableService):
d = soledad.get_or_create_service_token('mail_auth')
d.addCallback(registerToken)
d.addCallback(self._write_tokens_file, userid)
+ d.addCallback(self._maybe_start_pixelated, userid, soledad, keymanager)
return d
# hooks
@@ -621,6 +623,8 @@ class StandardMailService(service.MultiService, HookableService):
def get_keymanager_session(self, userid):
return self._keymanager_sessions.get(userid)
+ # other helpers
+
def _write_tokens_file(self, token, userid):
tokens_folder = os.path.join(tempfile.gettempdir(), "bitmask_tokens")
if os.path.exists(tokens_folder):
@@ -638,6 +642,13 @@ class StandardMailService(service.MultiService, HookableService):
with open(tokens_path, 'w') as ftokens:
json.dump(token_dict, ftokens)
+ def _maybe_start_pixelated(self, passthrough, userid, soledad, keymanager):
+ if pix.HAS_PIXELATED:
+ reactor.callFromThread(
+ pix.start_pixelated_user_agent,
+ userid, soledad, keymanager)
+ return passthrough
+
class IMAPService(service.Service):