summaryrefslogtreecommitdiff
path: root/src/leap/mail/imap/mailbox.py
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2014-02-07 02:54:52 -0400
committerKali Kaneko <kali@leap.se>2014-02-17 11:38:24 -0400
commit813db4a356141592337f39f9c801203367c63193 (patch)
tree72192408155c5852ca50575b424cd9f0b3544f79 /src/leap/mail/imap/mailbox.py
parent3149bbe64346d558ef300a3d760732cf499a28d3 (diff)
remove hdoc copy since it's in its own structure now
Diffstat (limited to 'src/leap/mail/imap/mailbox.py')
-rw-r--r--src/leap/mail/imap/mailbox.py22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/leap/mail/imap/mailbox.py b/src/leap/mail/imap/mailbox.py
index c188f91..6e472ee 100644
--- a/src/leap/mail/imap/mailbox.py
+++ b/src/leap/mail/imap/mailbox.py
@@ -824,12 +824,12 @@ class SoledadMailbox(WithMsgFields, MBoxParser):
memstore = self._memstore
def createCopy(result):
- exist, new_fdoc, hdoc = result
+ exist, new_fdoc = result
if exist:
# Should we signal error on the callback?
logger.warning("Destination message already exists!")
- # XXX I'm still not clear if we should raise the
+ # XXX I'm not sure if we should raise the
# errback. This actually rases an ugly warning
# in some muas like thunderbird. I guess the user does
# not deserve that.
@@ -848,8 +848,7 @@ class SoledadMailbox(WithMsgFields, MBoxParser):
self._memstore.create_message(
self.mbox, uid_next,
- MessageWrapper(
- new_fdoc, hdoc),
+ MessageWrapper(new_fdoc),
observer=observer,
notify_on_disk=False)
@@ -862,6 +861,9 @@ class SoledadMailbox(WithMsgFields, MBoxParser):
"""
Get a copy of the fdoc for this message, and check whether
it already exists.
+
+ :return: exist, new_fdoc
+ :rtype: tuple
"""
# XXX for clarity, this could be delegated to a
# MessageCollection mixin that implements copy too, and
@@ -869,22 +871,16 @@ class SoledadMailbox(WithMsgFields, MBoxParser):
msg = message
memstore = self._memstore
- # XXX should use a public api instead
- fdoc = msg._fdoc
- hdoc = msg._hdoc
- if not fdoc:
+ if empty(msg.fdoc):
logger.warning("Tried to copy a MSG with no fdoc")
return
- new_fdoc = copy.deepcopy(fdoc.content)
- copy_hdoc = copy.deepcopy(hdoc.content)
+ new_fdoc = copy.deepcopy(msg.fdoc.content)
fdoc_chash = new_fdoc[fields.CONTENT_HASH_KEY]
- # XXX is this hitting the db??? --- probably.
- # We should profile after the pre-fetch.
dest_fdoc = memstore.get_fdoc_from_chash(
fdoc_chash, self.mbox)
exist = dest_fdoc and not empty(dest_fdoc.content)
- return exist, new_fdoc, copy_hdoc
+ return exist, new_fdoc
# convenience fun