summaryrefslogtreecommitdiffstats
path: root/curunir.py
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2010-05-11 21:38:45 +0200
committerMatthias Schiffer <matthias@gamezock.de>2010-05-11 21:38:45 +0200
commitf95b596818a9ade81f9010b25923d0804a0c4469 (patch)
treef8b62fe9fdcdc84f6ee41cd3ec68f2d562528c57 /curunir.py
parent2451fdd40a873c3eada5b0689b55b35cd63e5277 (diff)
downloadcurunir-f95b596818a9ade81f9010b25923d0804a0c4469.tar
curunir-f95b596818a9ade81f9010b25923d0804a0c4469.zip
Improved module handler; improved mensa formatting
Diffstat (limited to 'curunir.py')
-rw-r--r--curunir.py55
1 files changed, 3 insertions, 52 deletions
diff --git a/curunir.py b/curunir.py
index 824a7c6..6b6ed8a 100644
--- a/curunir.py
+++ b/curunir.py
@@ -1,58 +1,9 @@
-from connection.xmpp import XMPPConnection
-
import signal, sys, traceback
-from config import config
-class ModuleManager:
- def __init__(self, config):
- self.config = config
- self._modules = {}
-
- for mod in config['modules']:
- self.get(mod)
-
- def get(self, name):
- if not name in self._modules:
- mod = __import__('modules.' + name, globals(), locals(), ['Module'])
- self._modules[name] = mod.Module(self)
-
- return self._modules[name]
-
- def commands(self):
- return reduce(lambda l, mod: l + mod.commands(), self._modules.itervalues(), [])
-
- def helptexts(self):
- return reduce(lambda l, mod: l + mod.helptexts(), self._modules.itervalues(), [])
-
- def groupchat(self, room, nick, text, handler):
- for mod in self._modules.itervalues():
- try:
- mod.groupchat(room, nick, text, handler)
- except:
- handler.reply(traceback.format_exc(5))
-
- def join(self, room, nick, show, status, handler):
- for mod in self._modules.itervalues():
- try:
- mod.join(room, nick, show, status, handler)
- except:
- handler.reply(traceback.format_exc(5))
-
- def leave(self, room, nick, show, status, handler):
- for mod in self._modules.itervalues():
- try:
- mod.leave(room, nick, show, status, handler)
- except:
- handler.reply(traceback.format_exc(5))
-
- def topic(self, room, nick, text, handler):
- for mod in self._modules.itervalues():
- try:
- mod.topic(room, nick, text, handler)
- except:
- handler.reply(traceback.format_exc(5))
+from config import config
+from modules import ModuleManager
+from connection.xmpp import XMPPConnection
-
run = True