diff --git a/core/bot.py b/core/bot.py index 919ec03..98fbf45 100644 --- a/core/bot.py +++ b/core/bot.py @@ -13,6 +13,7 @@ def clean_name(n): """strip all spaces and capitalization""" return re.sub('[^A-Za-z0-9_]+', '', n.replace(" ", "_")) + def get_logger(): """create and return a new logger object""" # create logger @@ -41,7 +42,6 @@ def get_logger(): class Bot(object): - def __init__(self): # basic variables self.start_time = time.time() @@ -146,4 +146,3 @@ class Bot(object): self.logger.debug("Logging engine stopped") logging.shutdown() sys.exit() - diff --git a/core/irc.py b/core/irc.py index e9b765e..1ff2389 100755 --- a/core/irc.py +++ b/core/irc.py @@ -104,7 +104,7 @@ class SendThread(threading.Thread): def run(self): while not self.shutdown: line = self.output_queue.get().splitlines()[0][:500] - print u"[{}]: {}".format(self.conn_name, line) + print u"{}>>> {}".format(self.conn_name, line) self.output_buffer += line.encode('utf-8', 'replace') + '\r\n' while self.output_buffer: sent = self.socket.send(self.output_buffer) diff --git a/core/loader.py b/core/loader.py index 80f4791..0fc0c61 100644 --- a/core/loader.py +++ b/core/loader.py @@ -58,6 +58,7 @@ class PluginLoader(object): """loads (or reloads) all valid plugins from a specified file""" filename = os.path.basename(path) + # compile the file and eval it in a namespace try: code = compile(open(path, 'U').read(), filename, 'exec') namespace = {} @@ -66,16 +67,19 @@ class PluginLoader(object): traceback.print_exc() return - # remove plugins already loaded from this filename + # remove plugins already loaded from this file for name, data in self.bot.plugins.iteritems(): self.bot.plugins[name] = [x for x in data if x[0]._filename != filename] + # stop all currently running instances of the plugins from this file for func, handler in list(self.bot.threads.iteritems()): if func._filename == filename: handler.stop() del self.bot.threads[func] + # find objects with hooks in the plugin namespace + # TODO: kill it with fire, kill it all for obj in namespace.itervalues(): if hasattr(obj, '_hook'): # check for magic if obj._thread: