summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changes/VERSION_COMPAT1
-rw-r--r--changes/bug_improve_logging2
-rw-r--r--changes/bug_look_for_charset_first2
-rw-r--r--src/leap/mx/mail_receiver.py18
4 files changed, 15 insertions, 8 deletions
diff --git a/changes/VERSION_COMPAT b/changes/VERSION_COMPAT
new file mode 100644
index 0000000..98efc6e
--- /dev/null
+++ b/changes/VERSION_COMPAT
@@ -0,0 +1 @@
+leap.common>=0.3.5 \ No newline at end of file
diff --git a/changes/bug_improve_logging b/changes/bug_improve_logging
new file mode 100644
index 0000000..920c33b
--- /dev/null
+++ b/changes/bug_improve_logging
@@ -0,0 +1,2 @@
+ o Improve logging in general and support possible unicode parameters
+ without breaking. \ No newline at end of file
diff --git a/changes/bug_look_for_charset_first b/changes/bug_look_for_charset_first
new file mode 100644
index 0000000..0ab964a
--- /dev/null
+++ b/changes/bug_look_for_charset_first
@@ -0,0 +1,2 @@
+ o Try to figure out the encoding of an email first by looking into
+ its header, if that fails then by using chardet. \ No newline at end of file
diff --git a/src/leap/mx/mail_receiver.py b/src/leap/mx/mail_receiver.py
index 36cfe0b..8fcadce 100644
--- a/src/leap/mx/mail_receiver.py
+++ b/src/leap/mx/mail_receiver.py
@@ -86,7 +86,7 @@ class MailReceiver(Service):
mask = inotify.IN_CREATE
for directory, recursive in self._directories:
- log.msg("Watching %s --- Recursive: %s" % (directory, recursive))
+ log.msg("Watching %r --- Recursive: %r" % (directory, recursive))
self.wm.watch(filepath.FilePath(directory), mask,
callbacks=[self._process_incoming_email],
recursive=recursive)
@@ -109,10 +109,11 @@ class MailReceiver(Service):
:rtype: tuple(str, SoledadDocument)
"""
if uuid is None or pubkey is None or len(pubkey) == 0:
+ log.msg("_encrypt_message: Something went wrong, here's all "
+ "I know: %r | %r" % (uuid, pubkey))
return None, None
log.msg("Encrypting message to %s's pubkey" % (uuid,))
- log.msg("Pubkey: %s" % (pubkey,))
doc = SoledadDocument(doc_id=str(pyuuid.uuid4()))
@@ -165,13 +166,12 @@ class MailReceiver(Service):
"""
uuid, doc = uuid_doc
if uuid is None or doc is None:
+ log.msg("_export_message: Something went wrong, here's all "
+ "I know: %r | %r" % (uuid, doc))
return False
log.msg("Exporting message for %s" % (uuid,))
- if uuid is None:
- uuid = 0
-
db = CouchDatabase(self._mail_couch_url, "user-%s" % (uuid,))
db.put_doc(doc)
@@ -192,11 +192,13 @@ class MailReceiver(Service):
if do_remove:
# remove the original mail
try:
- log.msg("Removing %s" % (filepath.path,))
+ log.msg("Removing %r" % (filepath.path,))
filepath.remove()
log.msg("Done removing")
except Exception:
log.err()
+ else:
+ log.msg("Not removing %r" % (filepath.path,))
def _get_owner(self, mail):
"""
@@ -235,13 +237,13 @@ class MailReceiver(Service):
"""
try:
if os.path.split(filepath.dirname())[-1] == "new":
- log.msg("Processing new mail at %s" % (filepath.path,))
+ log.msg("Processing new mail at %r" % (filepath.path,))
with filepath.open("r") as f:
mail_data = f.read()
mail = message_from_string(mail_data)
uuid = self._get_owner(mail)
if uuid is None:
- log.msg("Don't know how to deliver mail %s, skipping..." %
+ log.msg("Don't know how to deliver mail %r, skipping..." %
filepath.path)
return
log.msg("Mail owner: %s" % (uuid,))