From e16d698d0e8745486a61217419faaf3cf813c480 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Fri, 30 Mar 2012 10:17:13 -0500 Subject: [PATCH] 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() --- DrBotIRC.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/DrBotIRC.py b/DrBotIRC.py index 6f88362..d473716 100644 --- a/DrBotIRC.py +++ b/DrBotIRC.py @@ -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."""