diff options
author | Kali Kaneko <kali@leap.se> | 2015-01-27 14:13:55 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2015-02-11 14:05:44 -0400 |
commit | 3e723f7a003f72a33d761874e64cbce0604d37a9 (patch) | |
tree | 4f1d4def836dbdfea9a9efb9787f06ac1535ea42 /src/leap/mail/mail.py | |
parent | d8b078504b522add8542ebe3bdbe4da39e4ffaac (diff) |
implement copy interface
Diffstat (limited to 'src/leap/mail/mail.py')
-rw-r--r-- | src/leap/mail/mail.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/leap/mail/mail.py b/src/leap/mail/mail.py index 4306ec3..b46d223 100644 --- a/src/leap/mail/mail.py +++ b/src/leap/mail/mail.py @@ -509,25 +509,27 @@ class MessageCollection(object): return d - def copy_msg(self, msg, newmailbox): + def copy_msg(self, msg, new_mbox_uuid): """ Copy the message to another collection. (it only makes sense for mailbox collections) """ - # TODO currently broken ------------------FIXME- if not self.is_mailbox_collection(): raise NotImplementedError() - def insert_copied_mdoc_id(wrapper): - # TODO this needs to be implemented before the copy - # interface works. - newmailbox_uuid = get_mbox_uuid_from_msg_wrapper(wrapper) + def insert_copied_mdoc_id(wrapper_new_msg): return self.mbox_indexer.insert_doc( - newmailbox_uuid, wrapper.mdoc.doc_id) + new_mbox_uuid, wrapper.mdoc.doc_id) wrapper = msg.get_wrapper() - d = wrapper.copy(self.store, newmailbox) + + def print_result(result): + print "COPY CALLBACK:>>>", result + return result + + d = wrapper.copy(self.store, new_mbox_uuid) d.addCallback(insert_copied_mdoc_id) + d.addCallback(print_result) return d def delete_msg(self, msg): |