Introduce Response class and a new way to send message to user

Remove old send_* in Message class
!more is now a built-in command
This commit is contained in:
Némunaire 2012-08-30 15:29:11 +02:00
commit 5e52c4dbbb
4 changed files with 204 additions and 104 deletions

View file

@ -37,13 +37,22 @@ class Consumer(threading.Thread):
# Create, parse and treat the message
try:
msg = Message(srv, raw, time, prvt)
msg.treat(self.context.hooks)
res = msg.treat(self.context.hooks)
except:
print ("\033[1;31mERROR:\033[0m occurred during the "
"processing of the message: %s" % raw)
exc_type, exc_value, exc_traceback = sys.exc_info()
traceback.print_exception(exc_type, exc_value,
exc_traceback)
return
# Send message
if res is not None:
if isinstance(res, list):
for r in res:
srv.send_response(r)
else:
srv.send_response(res)
except queue.Empty:
pass