summaryrefslogtreecommitdiff
path: root/mail/src/leap
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2014-02-27 12:47:11 -0300
committerTomás Touceda <chiiph@leap.se>2014-02-27 12:47:11 -0300
commita1b8dd8c94f01fa87c8ca7cca8e0bcad111cd57d (patch)
tree4b9e49648adcd1b69860c3956c805d490716a769 /mail/src/leap
parent80d8172c4bc141d4fd723ab376daa359bbe53fec (diff)
parentc09c6506c518c8510da705db462f7505df9fc1f5 (diff)
Merge remote-tracking branch 'refs/remotes/kali/bug/delete_folder' into develop
Diffstat (limited to 'mail/src/leap')
-rw-r--r--mail/src/leap/mail/imap/account.py9
-rw-r--r--mail/src/leap/mail/imap/mailbox.py2
-rw-r--r--mail/src/leap/mail/imap/memorystore.py21
3 files changed, 24 insertions, 8 deletions
diff --git a/mail/src/leap/mail/imap/account.py b/mail/src/leap/mail/imap/account.py
index ede63d38..199a2a46 100644
--- a/mail/src/leap/mail/imap/account.py
+++ b/mail/src/leap/mail/imap/account.py
@@ -329,20 +329,13 @@ class SoledadBackedAccount(WithMsgFields, IndexedDB, MBoxParser):
raise imap4.MailboxCollision(repr(new))
for (old, new) in inferiors:
+ self._memstore.rename_fdocs_mailbox(old, new)
mbox = self._get_mailbox_by_name(old)
mbox.content[self.MBOX_KEY] = new
self._soledad.put_doc(mbox)
self._load_mailboxes()
- # XXX ---- FIXME!!!! ------------------------------------
- # until here we just renamed the index...
- # We have to rename also the occurrence of this
- # mailbox on ALL the messages that are contained in it!!!
- # ... we maybe could use a reference to the doc_id
- # in each msg, instead of the "mbox" field in msgs
- # -------------------------------------------------------
-
def _inferiorNames(self, name):
"""
Return hierarchically inferior mailboxes.
diff --git a/mail/src/leap/mail/imap/mailbox.py b/mail/src/leap/mail/imap/mailbox.py
index d8e6cb1d..503e38bd 100644
--- a/mail/src/leap/mail/imap/mailbox.py
+++ b/mail/src/leap/mail/imap/mailbox.py
@@ -337,6 +337,8 @@ class SoledadMailbox(WithMsgFields, MBoxParser):
"""
if self._uidvalidity is None:
mbox = self._get_mbox_doc()
+ if mbox is None:
+ return 0
self._uidvalidity = mbox.content.get(self.CREATED_KEY, 1)
return self._uidvalidity
diff --git a/mail/src/leap/mail/imap/memorystore.py b/mail/src/leap/mail/imap/memorystore.py
index 6206468d..d383b79c 100644
--- a/mail/src/leap/mail/imap/memorystore.py
+++ b/mail/src/leap/mail/imap/memorystore.py
@@ -1244,6 +1244,27 @@ class MemoryStore(object):
"""
self.permanent_store.set_mbox_closed(mbox, closed)
+ # Rename flag-documents
+
+ def rename_fdocs_mailbox(self, old_mbox, new_mbox):
+ """
+ Change the mailbox name for all flag documents in a given mailbox.
+ Used from account.rename
+
+ :param old_mbox: name for the old mbox
+ :type old_mbox: str or unicode
+ :param new_mbox: name for the new mbox
+ :type new_mbox: str or unicode
+ """
+ fs = self._fdoc_store
+ keys = fs[old_mbox].keys()
+ for k in keys:
+ fdoc = fs[old_mbox][k]
+ fdoc['mbox'] = new_mbox
+ fs[new_mbox][k] = fdoc
+ fs[old_mbox].pop(k)
+ self._dirty.add((new_mbox, k))
+
# Dump-to-disk controls.
@property