summaryrefslogtreecommitdiff
path: root/src/leap
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap')
-rw-r--r--src/leap/mail/adaptors/soledad.py10
-rw-r--r--src/leap/mail/imap/mailbox.py7
-rw-r--r--src/leap/mail/mail.py11
3 files changed, 24 insertions, 4 deletions
diff --git a/src/leap/mail/adaptors/soledad.py b/src/leap/mail/adaptors/soledad.py
index dc0960f..7e41f94 100644
--- a/src/leap/mail/adaptors/soledad.py
+++ b/src/leap/mail/adaptors/soledad.py
@@ -547,7 +547,9 @@ class MessageWrapper(object):
"Cannot create: fdoc has a doc_id")
def unblock_pending_insert(result):
- msgid = self.hdoc.headers.get('Message-Id', None)
+ h = self.hdoc.headers
+ ci_headers = dict([(k.lower(), v) for (k, v) in h.items()])
+ msgid = ci_headers.get('message-id', None)
try:
d = pending_inserts_dict[msgid]
d.callback(msgid)
@@ -561,6 +563,9 @@ class MessageWrapper(object):
mdoc_created = self.mdoc.create(store, is_copy=self._is_copy)
fdoc_created = self.fdoc.create(store, is_copy=self._is_copy)
+ mdoc_created.addErrback(lambda f: log.err(f))
+ fdoc_created.addErrback(lambda f: log.err(f))
+
self.d.append(mdoc_created)
self.d.append(fdoc_created)
@@ -580,9 +585,10 @@ class MessageWrapper(object):
self.all_inserted_d = defer.gatherResults(self.d, consumeErrors=True)
self.all_inserted_d.addCallback(log_all_inserted)
+ self.all_inserted_d.addCallback(unblock_pending_insert)
+ self.all_inserted_d.addErrback(lambda failure: log.err(failure))
if notify_just_mdoc:
- self.all_inserted_d.addCallback(unblock_pending_insert)
return mdoc_created
else:
return self.all_inserted_d
diff --git a/src/leap/mail/imap/mailbox.py b/src/leap/mail/imap/mailbox.py
index c4821ff..72f5a43 100644
--- a/src/leap/mail/imap/mailbox.py
+++ b/src/leap/mail/imap/mailbox.py
@@ -504,8 +504,13 @@ class IMAPMailbox(object):
getimapmsg = self.get_imap_message
def get_imap_messages_for_range(msg_range):
+ print
+ print
+ print
+ print "GETTING FOR RANGE", msg_range
def _get_imap_msg(messages):
+ print "GETTING IMAP MSG FOR", messages
d_imapmsg = []
for msg in messages:
d_imapmsg.append(getimapmsg(msg))
@@ -532,6 +537,7 @@ class IMAPMailbox(object):
d = defer.gatherResults(d_msg, consumeErrors=True)
d.addCallback(_get_imap_msg)
d.addCallback(_zip_msgid)
+ d.addErrback(lambda failure: log.err(failure))
return d
# for sequence numbers (uid = 0)
@@ -542,6 +548,7 @@ class IMAPMailbox(object):
else:
d = self._get_messages_range(messages_asked)
d.addCallback(get_imap_messages_for_range)
+ d.addErrback(lambda failure: log.err(failure))
return d
diff --git a/src/leap/mail/mail.py b/src/leap/mail/mail.py
index bf5b34d..b4602b3 100644
--- a/src/leap/mail/mail.py
+++ b/src/leap/mail/mail.py
@@ -622,6 +622,12 @@ class MessageCollection(object):
d = self.mbox_indexer.create_table(self.mbox_uuid)
d.addBoth(lambda _: self.mbox_indexer.insert_doc(
self.mbox_uuid, doc_id))
+ # XXX---------------------------------
+ def print_inserted(r):
+ print "INSERTED", r
+ return r
+ d.addCallback(print_inserted)
+ # XXX---------------------------------
return d
d = wrapper.create(
@@ -629,8 +635,9 @@ class MessageCollection(object):
notify_just_mdoc=notify_just_mdoc,
pending_inserts_dict=self._pending_inserts)
d.addCallback(insert_mdoc_id, wrapper)
- d.addErrback(lambda f: f.printTraceback())
- d.addCallback(self.cb_signal_unread_to_ui)
+ d.addErrback(lambda failure: log.err(failure))
+ #d.addCallback(self.cb_signal_unread_to_ui)
+
return d
def cb_signal_unread_to_ui(self, result):