summaryrefslogtreecommitdiff
path: root/src/leap/mail/imap/mailbox.py
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2014-01-28 18:39:59 -0400
committerKali Kaneko <kali@leap.se>2014-01-30 14:20:44 -0400
commita7e0054b595822325f749b0b1df7d25cab4e6486 (patch)
treeca1434b4bc03ccca4dcdd9519b3973da179d4809 /src/leap/mail/imap/mailbox.py
parentf096368cfbc49caab52811ae50388aae74272a1a (diff)
docstring fixes
Also some fixes for None comparisons.
Diffstat (limited to 'src/leap/mail/imap/mailbox.py')
-rw-r--r--src/leap/mail/imap/mailbox.py31
1 files changed, 11 insertions, 20 deletions
diff --git a/src/leap/mail/imap/mailbox.py b/src/leap/mail/imap/mailbox.py
index b5c5719..a0eb0a9 100644
--- a/src/leap/mail/imap/mailbox.py
+++ b/src/leap/mail/imap/mailbox.py
@@ -26,7 +26,6 @@ import cStringIO
from collections import defaultdict
from twisted.internet import defer
-#from twisted.internet.task import deferLater
from twisted.python import log
from twisted.mail import imap4
@@ -99,7 +98,6 @@ class SoledadMailbox(WithMsgFields, MBoxParser):
:param rw: read-and-write flag for this mailbox
:type rw: int
"""
- print "got memstore: ", memstore
leap_assert(mbox, "Need a mailbox name to initialize")
leap_assert(soledad, "Need a soledad instance to initialize")
@@ -240,10 +238,11 @@ class SoledadMailbox(WithMsgFields, MBoxParser):
the mailbox document in soledad if this is higher.
:return: the last uid for messages in this mailbox
- :rtype: bool
+ :rtype: int
"""
last = self._memstore.get_last_uid(self.mbox)
- print "last uid for %s: %s (from memstore)" % (self.mbox, last)
+ logger.debug("last uid for %s: %s (from memstore)" % (
+ repr(self.mbox), last))
return last
last_uid = property(
@@ -468,7 +467,6 @@ class SoledadMailbox(WithMsgFields, MBoxParser):
"""
Remove all messages flagged \\Deleted
"""
- print "EXPUNGE!"
if not self.isWriteable():
raise imap4.ReadOnlyMailbox
@@ -537,8 +535,6 @@ class SoledadMailbox(WithMsgFields, MBoxParser):
# can treat them all the same.
# Change this to the flag that twisted expects when we
# switch to content-hash based index + local UID table.
- print
- print "FETCHING..."
sequence = False
#sequence = True if uid == 0 else False
@@ -648,9 +644,12 @@ class SoledadMailbox(WithMsgFields, MBoxParser):
for msgid in seq_messg)
return result
- def signal_unread_to_ui(self):
+ def signal_unread_to_ui(self, *args, **kwargs):
"""
Sends unread event to ui.
+
+ :param args: ignored
+ :param kwargs: ignored
"""
unseen = self.getUnseenCount()
leap_events.signal(IMAP_UNREAD_MAIL, str(unseen))
@@ -767,13 +766,12 @@ class SoledadMailbox(WithMsgFields, MBoxParser):
# IMessageCopier
- @deferred
+ #@deferred
#@profile
def copy(self, messageObject):
"""
Copy the given message object into this mailbox.
"""
- from twisted.internet import reactor
msg = messageObject
memstore = self._memstore
@@ -791,23 +789,16 @@ class SoledadMailbox(WithMsgFields, MBoxParser):
exist = dest_fdoc and not empty(dest_fdoc.content)
if exist:
- print "Destination message already exists!"
+ logger.warning("Destination message already exists!")
else:
- print "DO COPY MESSAGE!"
mbox = self.mbox
uid_next = memstore.increment_last_soledad_uid(mbox)
new_fdoc[self.UID_KEY] = uid_next
new_fdoc[self.MBOX_KEY] = mbox
- # XXX set recent!
-
- print "****************************"
- print "copy message..."
- print "new fdoc ", new_fdoc
- print "hdoc: ", hdoc
- print "****************************"
+ # FIXME set recent!
- self._memstore.create_message(
+ return self._memstore.create_message(
self.mbox, uid_next,
MessageWrapper(
new_fdoc, hdoc.content),