def respondToQueries(self, msg): if msg[0] == 'PRIVMSG' and msg[3].split(':')[0] == self.name: words = msg[3].split()[1:] if len(words) > 1 and words[0] == "reload": try: exec("reload(%s)" % words[1]) reply = "'%s' reloaded\n" % words[1] except: reply = "'%s' isn't a module, or at least not one I can reload.\n" % words[1] self.send(('PRIVMSG', self.channel, reply), "irc") self.send(self.format(reply), "outbox") LoggerFunctions.respondToQueries(self, msg)
def getFilenames(self): """returns tuple (logname, infoname) according to the parameters given""" return LoggerFunctions.getFilenames(self.logdir, self.channel)
def currentTimeString(self): """returns current time""" return LoggerFunctions.currentTimeString()
def currentDateString(self): """returns the current date""" return LoggerFunctions.currentDateString()
info = Carousel(filewriter), linkages = {("logger", "irc") : ("irc", "inbox"), ("irc", "outbox") : ("logger", "inbox"), ("logger", "log_next") : ("log", "next"), ("logger", "outbox") : ("log", "inbox"), ("logger", "info_next") : ("info", "next"), ("logger", "system") : ("info", "inbox"), } ) if __name__ == '__main__': import sys channel = "#kamtest" Name = "jinnaslogbot" pwd = None if len(sys.argv) > 1: channel = sys.argv[1] if len(sys.argv) > 2: Name = sys.argv[2] if len(sys.argv) > 3: pwd = sys.argv[3] from Kamaelia.Internet.TCPClient import TCPClient from Kamaelia.Util.Introspector import Introspector from Kamaelia.Chassis.Pipeline import Pipeline Pipeline( Introspector(), TCPClient("127.0.0.1",1501) ).activate() print "Logging %s as %s" % (channel, Name) Logger(channel, name=Name, password=pwd, formatter=(lambda data: LoggerFunctions.HTMLOutformat(data)), filewriter = LoggerFunctions.LoggerWriter, ).run()