Commit e4846ff2 authored by Christophe Benz's avatar Christophe Benz Committed by Christophe Benz

no API break

parent 9cb692a8
......@@ -25,5 +25,5 @@ class AuMBackend(Backend, ICapMessages, ICapMessagesReply):
def __init__(self, weboob):
Backend.__init__(self, weboob)
def iter_messages(self, thread=None):
def iterNewMessages(self, thread=None):
pass
......@@ -26,7 +26,7 @@ class DLFPBackend(Backend, ICapMessages, ICapMessagesReply):
def __init__(self, weboob):
Backend.__init__(self, weboob)
def iter_messages(self, thread=None):
def iterNewMessages(self, thread=None):
articles_list = ArticlesList('newspaper')
for id, author, title in articles_list.iter_articles():
yield Message('threadid', id, title, author, signature='Bite bite bite bite', content='Content content\nContent content.')
......@@ -73,10 +73,19 @@ class Message:
return self.new
class ICapMessages:
def iter_messages(self, thread=None):
def getNewMessages(self, thread=None):
"""
Get new messages from last time this function has been called.
@param thread [str] if given, get new messages for a specific thread.
@return [list] a list of Message objects.
"""
return [m for m in self.iterNewMessages(thread)]
def iterNewMessages(self, thread=None):
"""
Iterates on new messages from last time this function has been called.
@param thread [str] if given, get new messages for a specific thread.
@return [list] a list of Message objects.
"""
......
......@@ -59,7 +59,7 @@ class Application(BaseApplication):
def process(self):
backends = self.weboob.getBackends()
for name, b in backends.iteritems():
for message in b.iter_messages():
for message in b.iterNewMessages():
self.send_email(name, message)
def send_email(self, backend_name, mail):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment