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:
parent
3279f5dc9c
commit
79724c90f5
8 changed files with 8 additions and 9 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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():
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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():
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue