DrBotIRC: add method to register a function to the XML-RPC server

this appears to be safe to do while the other thread is doing serve_forever()
This commit is contained in:
Brian S. Stephan 2012-03-30 10:17:13 -05:00
parent 05a3bd0af7
commit e16d698d0e
1 changed files with 7 additions and 0 deletions

View File

@ -196,6 +196,13 @@ class DrBotIRC(irclib.IRC):
except Exception as e:
print("exception floated up to DrBotIrc: " + str(e))
def xmlrpc_register_function(self, func, name):
"""Add a method to the XML-RPC interface."""
if func:
if hasattr(func, '__call__'):
self.xmlrpc.register_function(func, name)
def _xmlrpc_listen(self):
"""Begin listening. Hopefully this was called in a new thread."""