summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeissi Torres Lima <neissi.lima@gmail.com>2014-11-26 19:38:08 -0200
committerNeissi Torres Lima <neissi.lima@gmail.com>2014-11-26 19:38:08 -0200
commit6d14c2661d5072516255c7a6e49a4888eb6b3bbd (patch)
tree000052b05a4611478c57a92d04cca724c157bdbf
parent939d9eca745973a4f1a8c41bcc2be9f8dbf23a58 (diff)
#59 - Adding encryption status
-rw-r--r--service/pixelated/adapter/mail.py11
-rw-r--r--service/pixelated/controllers/features_controller.py2
-rw-r--r--service/test/unit/adapter/mail_test.py2
3 files changed, 10 insertions, 5 deletions
diff --git a/service/pixelated/adapter/mail.py b/service/pixelated/adapter/mail.py
index 124a16b1..eedc8242 100644
--- a/service/pixelated/adapter/mail.py
+++ b/service/pixelated/adapter/mail.py
@@ -243,9 +243,13 @@ class PixelatedMail(Mail):
@property
def security_casing(self):
- casing = {"imprints": []}
+ casing = {"imprints": [], "locks": []}
if self.signed:
casing["imprints"].append({"state": "valid", "seal": {"validity": "valid"}})
+
+ if self.encrypted:
+ casing["locks"].append({"state": "valid"})
+
return casing
@property
@@ -312,5 +316,6 @@ class PixelatedMail(Mail):
def signed(self):
return self.hdoc.content["headers"].get("X-Leap-Signature", "").startswith("valid")
- def encrypt(self):
- pass
+ @property
+ def encrypted(self):
+ return self.hdoc.content["headers"].get("OpenPGP", None) is not None
diff --git a/service/pixelated/controllers/features_controller.py b/service/pixelated/controllers/features_controller.py
index b91aa183..9720b7f2 100644
--- a/service/pixelated/controllers/features_controller.py
+++ b/service/pixelated/controllers/features_controller.py
@@ -19,7 +19,7 @@ import os
class FeaturesController:
- DISABLED_FEATURES = ['draftReply', 'encryptionStatus']
+ DISABLED_FEATURES = ['draftReply']
def __init__(self):
pass
diff --git a/service/test/unit/adapter/mail_test.py b/service/test/unit/adapter/mail_test.py
index adc17e44..4ce398b8 100644
--- a/service/test/unit/adapter/mail_test.py
+++ b/service/test/unit/adapter/mail_test.py
@@ -85,7 +85,7 @@ class TestPixelatedMail(unittest.TestCase):
},
'ident': 'chash',
'mailbox': 'inbox',
- 'security_casing': {'imprints': []},
+ 'security_casing': {'imprints': [], 'locks': []},
'status': ['recent'],
'tags': [],
'attachments': []