Commit 0c71eb64 authored by Romain Bignon's avatar Romain Bignon

error messages when backend is not found or if it does not implement

ICapMessagesReply
parent e402c49f
......@@ -29,7 +29,7 @@ import time
import re
import sys
from weboob.capabilities.messages import ICapMessages
from weboob.capabilities.messages import ICapMessages, ICapMessagesReply
from weboob.tools.application import ConsoleApplication
from weboob.tools.misc import html2text
......@@ -77,24 +77,19 @@ class Monboob(ConsoleApplication):
content = content.split(u'\n-- \n')[0]
bname, id = reply_to.split('.', 1)
backend = self.weboob.backends[bname]
try:
backend = self.weboob.backends[bname]
except KeyError:
print >>sys.stderr, 'Backend %s not found' % bname
return 1
if not backend.has_caps(ICapMessagesReply):
print >>sys.stderr, 'The backend %s does not implement ICapMessagesReply' % bname
return 1
thread_id, msg_id = id.rsplit('.', 1)
backend.post_reply(thread_id, msg_id, title, content)
MAIL_REGEXP = re.compile('(.*) <(.*)@(.*)>')
def get_mail(self, text):
if not text:
return None
m = self.MAIL_REGEXP.match(text)
if not m:
to = text.split('@')[0]
else:
to = m.group(2)
return to
@ConsoleApplication.command("run daemon")
def command_run(self):
self.weboob.repeat(self.config.get('interval'), self.process)
......
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