From 294dfbab3c3fea40414cbce67683a8c2477efed5 Mon Sep 17 00:00:00 2001 From: urlbot Date: Sun, 14 Dec 2014 01:21:30 +0100 Subject: [PATCH] cleanup; test .reply().send() --- urlbot.py | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/urlbot.py b/urlbot.py index ca9c493..bde0eb4 100755 --- a/urlbot.py +++ b/urlbot.py @@ -113,11 +113,12 @@ def send_reply(message, msg_obj): if debug_enabled(): print(message) else: - xmpp.send_message( - mto=msg_obj['from'].bare, - mbody=message, - mtype=msg_obj['type'] - ) + msg_obj.reply(body=message).send() +# xmpp.send_message( +# mto=msg_obj['from'].bare, +# mbody=message, +# mtype=msg_obj['type'] +# ) def ratelimit_touch(ignored=None): # FIXME: separate counters hist_ts.append(time.time()) @@ -208,14 +209,6 @@ def extract_url(data, msg_obj): ret = True return ret -def parse_pn(data): -# FIXME: changed - ## reply_user = data.split(' ')[0].strip('<>') - # since we can't determine if a user named 'foo> ' just wrote ' > bar' - # or a user 'foo' just wrote '> > bar', we can't safely answer here - logger('warn', 'received PN: ' + data) - return False - def handle_msg(msg_obj): content = msg_obj['body'] @@ -269,7 +262,11 @@ class bot(ClientXMPP): if 'groupchat' == msg_obj['type']: return - print('msg from %s: %s' % (msg_obj['from'].bare, msg_obj['body'])) + plugins.data_parse_commands(msg_obj) + plugins.data_parse_other(msg_obj) + + print('msg from %s: %s' % (msg_obj['from'].bare, msg_obj)) +# msg_obj.reply(body='waaaaah').send() if '__main__' == __name__: import plugins