# HG changeset patch # User Teemu Piippo # Date 1431884552 -10800 # Node ID 506e951fd3383395af4cfbcc062cad0d07e39c52 # Parent 631451eecefcb63382043b3a050bba8b9d60347e# Parent d0184734320e03fc7b9987bbcd440e0f473d2afb Merged diverged heads diff -r 631451eecefc -r 506e951fd338 .hgignore --- a/.hgignore Sun May 17 20:40:09 2015 +0300 +++ b/.hgignore Sun May 17 20:42:32 2015 +0300 @@ -5,3 +5,5 @@ *.pyc zandronum* cobalt.cfg +*.orig +*.rej diff -r 631451eecefc -r 506e951fd338 bt.py --- a/bt.py Sun May 17 20:40:09 2015 +0300 +++ b/bt.py Sun May 17 20:42:32 2015 +0300 @@ -184,3 +184,8 @@ def post_note (ticket_id, message): btuser, btpassword = credentials() suds_client.service.mc_issue_note_add (btuser, btpassword, ticket_id, { 'text': message }) + +def custom_query (func, args): + btuser, btpassword = credentials() + args = [x.replace ('$user', btuser).replace ('$password', btpassword) for x in args] + return getattr (suds_client.service, func)(*args) diff -r 631451eecefc -r 506e951fd338 mod_bt.py --- a/mod_bt.py Sun May 17 20:40:09 2015 +0300 +++ b/mod_bt.py Sun May 17 20:42:32 2015 +0300 @@ -51,6 +51,13 @@ 'args': None, 'level': 'admin', }, + + { + 'name': 'btsoap', + 'description': 'Sends a custom SOAP query', + 'args': ' [args...]', + 'level': 'admin', + }, ] } @@ -61,4 +68,10 @@ Bt.announce_new_issue (bot, Bt.get_issue (args['ticket'])) def cmd_checkbt (bot, **rest): - Bt.poll() \ No newline at end of file + Bt.poll() + +def cmd_btsoap (bot, args, reply, **rest): + result = Bt.custom_query (args['func'], args['args'].split (' ') if 'args' in args else []) + + for line in result.splitlines(): + reply (line) \ No newline at end of file