fix iter_unread_threads() to correctly set the UNREAD flag

This commit is contained in:
Romain Bignon 2011-03-04 16:21:08 +01:00
commit ae4b77df44

View file

@ -38,19 +38,18 @@ class NewsfeedBackend(BaseBackend, ICapMessages):
def iter_threads(self): def iter_threads(self):
for article in Newsfeed(self.config["url"]).iter_entries(): for article in Newsfeed(self.config["url"]).iter_entries():
thread = Thread(article.id) yield self.get_thread(article.id, article)
thread.title = article.title
yield thread
def get_thread(self, id, entry=None):
def get_thread(self, id):
if isinstance(id, Thread): if isinstance(id, Thread):
thread = id thread = id
id = thread.id id = thread.id
else: else:
thread = Thread(id) thread = Thread(id)
entry = Newsfeed(self.config["url"]).get_entry(id)
if entry is None:
entry = Newsfeed(self.config["url"]).get_entry(id)
flags = Message.IS_HTML flags = Message.IS_HTML
if not thread.id in self.storage.get('seen', default=[]): if not thread.id in self.storage.get('seen', default=[]):
flags |= Message.IS_UNREAD flags |= Message.IS_UNREAD