Remove "thread" argument in iter_unread_messages

It is unused, and no backend implemented it — so it was wrong to have it
in the function signature.
It also does not seem very helpful, we have get_threads() if we want to
do something advanced with treads.

fixes #825
This commit is contained in:
Laurent Bachelier 2012-03-22 19:17:07 +01:00 committed by Romain Bignon
commit 79724c90f5
8 changed files with 8 additions and 9 deletions

View file

@ -240,7 +240,7 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
return thread
def iter_unread_messages(self, thread=None):
def iter_unread_messages(self):
try:
contacts = {}
with self.browser:

View file

@ -149,7 +149,7 @@ class BNPorcBackend(BaseBackend, ICapBank, ICapMessages):
thread = self.browser.get_thread(thread)
return thread
def iter_unread_messages(self, thread=None):
def iter_unread_messages(self):
threads = list(self.iter_threads(cache=True))
for thread in threads:
if thread.root.flags & thread.root.IS_UNREAD:

View file

@ -172,7 +172,7 @@ class DLFPBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapContent):
for sub in com.comments:
self._insert_comment(sub, message, getseen)
def iter_unread_messages(self, thread=None):
def iter_unread_messages(self):
for thread in self.iter_threads():
self.fill_thread(thread, 'root', False)
for m in thread.iter_all_messages():

View file

@ -88,7 +88,7 @@ class HDSBackend(BaseBackend, ICapMessages):
return thread
def iter_unread_messages(self, thread=None):
def iter_unread_messages(self):
for thread in self.iter_threads():
if thread.id in self.storage.get('seen', default=[]):
continue

View file

@ -76,7 +76,7 @@ class NewsfeedBackend(BaseBackend, ICapMessages):
def iter_unread_messages(self, thread=None):
def iter_unread_messages(self):
for thread in self.iter_threads():
for m in thread.iter_all_messages():
if m.flags & m.IS_UNREAD:

View file

@ -130,7 +130,7 @@ class PhpBBBackend(BaseBackend, ICapMessages, ICapMessagesPost):
children=[],
flags=Message.IS_HTML)
def iter_unread_messages(self, thread=None):
def iter_unread_messages(self):
with self.browser:
url = self.browser.get_root_feed_url()
for article in Newsfeed(url, rssid).iter_entries():

View file

@ -140,11 +140,10 @@ class ICapMessages(IBaseCap):
"""
raise NotImplementedError()
def iter_unread_messages(self, thread=None):
def iter_unread_messages(self):
"""
Iterates on messages which hasn't been marked as read.
@param thread thread name (optional)
@return [iter] Message objects
"""
raise NotImplementedError()

View file

@ -87,7 +87,7 @@ class GenericNewspaperBackend(BaseBackend, ICapMessages):
t = self.get_thread(thread)
return t or thread
def iter_unread_messages(self, thread=None):
def iter_unread_messages(self):
for thread in self.iter_threads():
if thread.id in self.storage.get('seen', default={}):
continue