[Otfbot-svn] r100 - in trunk: . modules

allo at BerliOS allo
So Jun 10 16:13:37 CEST 2007


Author: allo
Date: 2007-06-10 16:13:36 +0200 (Sun, 10 Jun 2007)
New Revision: 100

Added:
   trunk/modules/
   trunk/modules/answerMod.py
   trunk/modules/authMod.py
   trunk/modules/badwordsMod.py
   trunk/modules/commandsMod.py
   trunk/modules/controlMod.py
   trunk/modules/eightBallMod.py
   trunk/modules/identifyMod.py
   trunk/modules/inactive/
   trunk/modules/kiMod.py
   trunk/modules/kursMod.py
   trunk/modules/logMod.py
   trunk/modules/marvinMod.py
   trunk/modules/mathMod.py
   trunk/modules/modeMod.py
   trunk/modules/nobodyisperfectMod.py
   trunk/modules/rdfMod.py
   trunk/modules/reminderMod.py
   trunk/modules/weatherMod.py
Removed:
   trunk/answerMod.py
   trunk/authMod.py
   trunk/badwordsMod.py
   trunk/commandsMod.py
   trunk/controlMod.py
   trunk/eightBallMod.py
   trunk/identifyMod.py
   trunk/kiMod.py
   trunk/kursMod.py
   trunk/logMod.py
   trunk/marvinMod.py
   trunk/mathMod.py
   trunk/modeMod.py
   trunk/nobodyisperfectMod.py
   trunk/rdfMod.py
   trunk/reminderMod.py
   trunk/weatherMod.py
Modified:
   trunk/otfbot.py
Log:
dynamic module loading


Deleted: trunk/answerMod.py
===================================================================
--- trunk/answerMod.py	2007-06-10 13:19:33 UTC (rev 99)
+++ trunk/answerMod.py	2007-06-10 14:13:36 UTC (rev 100)
@@ -1,64 +0,0 @@
-# This file is part of OtfBot.
-#
-# OtfBot is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# OtfBot is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with OtfBot; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-# 
-# (c) 2005, 2006 by Alexander Schier
-#
-
-import string, re, functions
-import chatMod
-
-def default_settings():
-	settings={};
-	settings['answerMod.fileencoding']='iso-8859-15'
-	settings['answerMod.file']='answers.txt'
-	return settings
-		
-class chatMod(chatMod.chatMod):
-	def __init__(self, bot):
-		self.bot = bot
-
-		self.answersFile=bot.getConfig("file", "answers.txt", "answerMod")
-		self.answers = functions.loadProperties(self.answersFile)
-		self.channels={}
-		
-	def joined(self, channel):
-		self.channels[channel]=1
-	
-	def msg(self, user, channel, msg):
-		user = user.split("!")[0] #only nick
-		if(self.channels.has_key(channel)): #Do not respond to server messages
-			if msg == "!reload-answers":
-				self.logger.info("reloading")
-				self.reload()
-				return
-			answer = self.respond(user, msg)
-			if answer != "":
-				self.bot.sendmsg(channel, answer, self.bot.getConfig("fileencoding", "iso-8859-15","answerMod"))
-
-	def reload(self):
-		self.answers = functions.loadProperties(self.answersFile)
-
-	def respond(self, user, msg):
-		answer = ""
-		for key in self.answers.keys():
-			if re.search(key, msg, re.I):
-				answer = self.answers[key]
-				answer = re.sub("USER", user, answer)
-				answer = re.sub("MESSAGE", msg, answer)
-		if len(answer)>0 and answer[-1] == "\n":
-			return answer[0:-1]
-		else:
-			return answer

Deleted: trunk/authMod.py
===================================================================
--- trunk/authMod.py	2007-06-10 13:19:33 UTC (rev 99)
+++ trunk/authMod.py	2007-06-10 14:13:36 UTC (rev 100)
@@ -1,48 +0,0 @@
-# This file is part of OtfBot.
-#
-# OtfBot is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# OtfBot is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with OtfBot; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-# 
-# (c) 2005, 2006 by Alexander Schier
-#
-
-import random, re
-import chatMod
-
-def default_settings():
-	settings={};
-	settings['authMod.whitelist']=''
-	settings['authMod.password']=''
-	return settings
-		
-class chatMod(chatMod.chatMod):
-	def __init__(self, bot):
-		self.bot=bot
-		self.whitelist=[]
-		for user in self.bot.getConfig("whitelist", "", "authMod").split(","):
-			self.whitelist.append(user)
-		self.password=self.bot.getConfig("password", "", "authMod")
-
-	def msg(self, user, channel, msg):
-		user=user.split("!")[0]
-		if channel == self.bot.nickname and msg[0:9]=="identify ":
-			if self.password != "" and msg[9:] == self.password:
-				self.bot.sendmsg(user, "Password accepted")
-				self.logger.info("User "+str(user)+" successfully identified with password")
-				self.whitelist.append(user)
-
-	def auth(self, user):
-		user=user.split("!")[0]
-		if user in self.whitelist:
-			return 10

Deleted: trunk/badwordsMod.py
===================================================================
--- trunk/badwordsMod.py	2007-06-10 13:19:33 UTC (rev 99)
+++ trunk/badwordsMod.py	2007-06-10 14:13:36 UTC (rev 100)
@@ -1,52 +0,0 @@
-# This file is part of OtfBot.
-#
-# OtfBot is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# OtfBot is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with OtfBot; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-# 
-# (c) 2005, 2006 by Alexander Schier
-#
-
-import random, re
-import chatMod, functions
-
-def default_settings():
-	settings={};
-	settings['badwordsMod.file']='badwords.txt'
-	return settings
-		
-class chatMod(chatMod.chatMod):
-	def __init__(self, bot):
-		self.bot=bot
-		self.badwordsFile=bot.getConfig("file", "badwords.txt","badwordsMod")
-		self.badwords=functions.loadList(self.badwordsFile)
-		self.channels = {}
-		
-	def joined(self, channel):
-		self.channels[channel]=1
-		
-	def part(self, channel):
-		self.channels[channel]=1
-
-	def reload(self):
-		self.badwords=functions.loadList(self.badwordsFile)
-
-	def msg(self, user, channel, msg):
-		if channel == self.bot.nickname:
-			if msg == "!reload-badwords":
-				self.reload()
-		else:
-			for word in self.badwords:
-				if self.channels.has_key(channel) and word != "" and re.search(word, msg, re.I) and user.split("!")[0]!=self.bot.nick:
-					self.logger.info("kicking "+user.split("!")[0]+" for badword: "+word)
-					self.bot.kick(channel, user.split("!")[0], "Badword: "+word)

Deleted: trunk/commandsMod.py
===================================================================
--- trunk/commandsMod.py	2007-06-10 13:19:33 UTC (rev 99)
+++ trunk/commandsMod.py	2007-06-10 14:13:36 UTC (rev 100)
@@ -1,101 +0,0 @@
-# This file is part of OtfBot.
-#
-# Otfbot is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# Otfbot is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with OtfBot; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-# 
-# (c) 2005, 2006 by Alexander Schier
-#
-
-import string, re
-import chatMod, functions
-
-def default_settings():
-	settings={};
-	settings['commandsMod.fileencoding']='iso-8859-15'
-	settings['commandsMod.file']='commands.txt'
-	settings['commandsmod.commandChar']='!'
-	return settings
-		
-class chatMod(chatMod.chatMod):
-	def __init__(self, bot):
-		self.bot = bot
-		self.commandChar={}
-
-	def connectionMade(self):
-		self.reload()
-		
-	def joined(self, channel):
-		self.channel = channel
-		self.commandChar[channel]=self.bot.getConfig("commandChar", "!", "commandsMod", self.bot.network, channel)
-	
-	def msg(self, user, channel, msg):
-		user = user.split("!")[0] #only nick
-		if self.commandChar.has_key(channel):
-			try:
-				char=msg[0].decode('UTF-8').encode('UTF-8')
-			except UnicodeDecodeError:
-				char=msg[0].decode('iso-8859-15').encode('UTF-8')
-			if char == self.commandChar[channel]:
-				#if msg == "!reload-commands": #TODO: global methodChar
-				#	self.logger.info("reloading")
-				#	self.reload()
-				#	return
-				answer = self.respond(channel, user, msg)
-				if answer != "":
-					if answer[0] == ":":
-						self.bot.sendmsg(channel, answer[1:], self.bot.getConfig("commandsMod.fileencoding", "iso-8859-15"))
-					else:
-						self.bot.sendme(channel, answer, self.bot.getConfig("commandsMod.fileencoding", "iso-8859-15"))
-			
-	def start(self):
-		self.commands={}
-		self.commandChar={}
-		self.commands["general"]=functions.loadProperties(self.bot.getConfig("file","commands.txt","commandsMod"))
-		self.commands["network"]=functions.loadProperties(self.bot.getConfig("file","commands.txt","commandsMod", self.bot.network))
-		for channel in self.bot.channels:
-			self.commands[channel]=functions.loadProperties(self.bot.getConfig("file", "commands.txt", "commandsMod", self.bot.network, channel))
-			self.commandChar[channel]=self.bot.getConfig("commandChar", "!", "commandsMod", self.bot.network, channel)
-
-	def reload(self):
-		self.start()
-	
-	def getCommand(self, channel, cmd):
-		if not self.commands.has_key(channel):
-			self.commands[channel]={}
-		if self.commands[channel].has_key(cmd):
-			return self.commands[channel][cmd]
-		elif self.commands["network"].has_key(cmd):
-			return self.commands["network"][cmd]
-		elif self.commands["general"].has_key(cmd):
-			return self.commands["general"][cmd]
-		else:
-			return ""
-
-	def respond(self, channel, user, command):
-		answer = ""
-		if command[0] == self.commandChar[channel]:
-			tmp=command[1:].split(" ", 1)
-			cmd=string.lower(tmp[0])
-			if len(tmp) >1:
-				param=tmp[1]
-				answer=self.getCommand(channel, cmd+"_")
-				answer = re.sub("OTHER", param, answer)
-			else:
-				answer=self.getCommand(channel, cmd)
-			answer = re.sub("USER", user, answer)
-				
-		if len(answer)>0 and answer[-1] == "\n":
-			return answer[0:-1]
-		else:
-			return answer

Deleted: trunk/controlMod.py
===================================================================
--- trunk/controlMod.py	2007-06-10 13:19:33 UTC (rev 99)
+++ trunk/controlMod.py	2007-06-10 14:13:36 UTC (rev 100)
@@ -1,185 +0,0 @@
-# This file is part of OtfBot.
-#
-# OtfBot is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# OtfBot is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with OtfBot; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-# 
-# (c) 2005, 2006 by Alexander Schier
-#
-
-import random, re, string
-import chatMod
-
-class chatMod(chatMod.chatMod):
-	def __init__(self, bot):
-		self.bot=bot
-		self.configshell=False
-		self.configlevel=[]
-	
-	def configgetlevellist(self):
-		if len(self.configlevel) == 0:
-			return self.bot.getNetworks()
-		elif len(self.configlevel) == 1:
-			return self.bot.getChannels(self.configlevel[0])
-		else:
-			return self.bot.getSubOptions(self.configlevel)
-	
-	def msg(self, user, channel, msg):
-		nick=user.split("!")[0]
-		if self.bot.auth(user) > 7 and string.lower(channel)==string.lower(self.bot.nickname):
-			if msg[0:6] == "config":
-				self.configshell=True
-				self.configlevel=[]
-				self.bot.sendmsg(nick,"Entering configshell ...")
-			elif self.configshell:
-				if msg[0:2] == "ls":
-					out=""
-					lst=self.configgetlevellist()
-					for i in range(1,len(lst)):
-						out=out+str(i)+" "+lst[i-1]+" | "
-					self.bot.sendmsg(nick,out.encode("utf-8"))
-				elif msg[0:2] == "cd":
-					if msg[3:5] == ".." and len(self.configlevel)>=0:
-						self.configlevel.pop()
-					else:
-						num=int(msg[3:])
-						if 0 < num and num < len(self.configgetlevellist())+1:
-							self.configlevel.append(self.configgetlevellist()[num-1])
-						else:
-							self.bot.sendmsg(nick,"No such setting: "+str(num))
-				elif msg[0:4] == "quit":
-					self.configshell=False
-					self.bot.sendmsg(nick,"Leaving configshell ...")
-				elif msg[0:3] == "get":
-					msg=msg[4:]
-					msg=msg.split(" ")
-					#self.logger.debug(msg)
-					if len(msg) == 4:
-						res=self.bot.getConfig(msg[0], "",msg[1],msg[2],msg[3])
-					elif len(msg) == 3:
-						res=self.bot.getConfig(msg[0], "", msg[1], msg[2])
-					elif len(msg) == 2:
-						res=self.bot.getConfig(msg[0], "", msg[1])
-					elif len(msg) == 1:
-						res=self.bot.getConfig(msg[0], "")
-					if len(msg) == 0 or len(msg) > 4:
-						self.bot.sendmsg(nick, "Syntax: config get key [modul] [network] [channel]")
-					else:
-						#self.logger.debug(".".join(msg))
-						#self.logger.debug(res)
-						self.bot.sendmsg(nick, ".".join(msg).encode("utf-8")+"="+res.encode("utf-8"))
-				elif msg[0:3] == "set":
-					#FIXME: 
-					#msg=msg[4:]
-					#tmp=msg.split("=")
-					#if len(tmp) != 2:
-					#	self.bot.sendmsg(nick, "Syntax: config set key=value")
-					#	return
-					#self.bot.setConfig(tmp[0], tmp[1])
-					self.bot.sendmsg(nick, "function is out of order")
-				else:
-					self.bot.sendmsg(nick, "Syntax: config [get <key> [modul] [network] [channel]|set <key=value>]")
-			elif msg[0:4] == "help":
-				self.bot.sendmsg(nick,"Available administrationcommands: reload, stop|quit, disconnect [network], connect network [port], listnetworks, changenick newnick, join channel, part channel [message], listchannels")
-			elif msg[0:6] == "reload":
-				self.bot.sendmsg(nick,"Reloading all modules ...")
-				self.bot.reloadModules()
-			elif msg[0:11] == "listmodules":
-				module=[]
-				for mod in self.bot.mods:
-					module.append(mod.name)
-				self.bot.sendmsg(nick,str(module))
-			elif msg[0:4] == "stop" or msg[0:4] == "quit":
-				self.bot.sendmsg(nick,"Disconnecting from all networks und exiting ...")
-				conns=self.bot.getConnections()
-				for c in conns:
-					conns[c].disconnect()
-			elif msg[0:10] == "disconnect":
-				args = msg[10:].split(" ")
-				conns=self.bot.getConnections()
-				if len(args) == 2:
-					if conns.has_key(args[1]):
-						self.bot.sendmsg(nick,"Disconnecting from "+str(conns[args[1]].getDestination()))
-						conns[args[1]].disconnect()
-					else:
-						self.bot.sendmsg(nick,"Not connected to "+str(args[1]))
-				else:
-					self.bot.sendmsg(nick,"Disconnecting from current network. Bye.")
-					self.bot.quit("Bye.")
-			elif msg[0:7] == "connect":
-				args = msg[7:].split(" ")
-				if len(args) < 2 or len(args) > 3:
-					self.bot.sendmsg(nick,"Usage: connect irc.network.tld [port]")
-				else:
-					if len(args) == 3:
-						port=args[2]
-					else:
-						port=6667
-					self.bot.addConnection(args[1],port)
-					self.bot.sendmsg(nick,"Connecting to "+str(self.bot.getConnections()[args[1]].getDestination()))
-			elif msg[0:12] == "listnetworks":
-				ne=""
-				for n in self.bot.getConnections():
-					ne=ne+" "+n
-				self.bot.sendmsg(nick,"Currently connected to:"+unicode(ne).encode("utf-8"))
-			elif msg[0:12] == "listchannels":
-				ch=""
-				for c in self.bot.channel:
-					ch=ch+" "+c
-				self.bot.sendmsg(nick,"Currently in:"+unicode(ch).encode("utf-8"))
-			elif msg[0:10] == "changenick":
-				args=msg.split(" ")
-				if len(args) < 2:
-					self.bot.sendmsg(nick,"Usage: changenick newnick")
-				else:
-					self.bot.setNick(args[1])
-			elif msg[0:4] == "join":
-				args=msg.split(" ")
-				if len(args) < 2:
-					self.bot.sendmsg(nick,"Usage: join channel")
-				else:
-					self.bot.join(args[1])
-					self.bot.sendmsg(nick,"Joined "+str(args[1]))
-			elif msg[0:4] == "part":
-				args=msg.split(" ")
-				if len(args) == 1:
-					self.bot.sendmsg(nick,"Usage: part channel [message]")
-				else:
-					if len(args) > 2:
-						partmsg=" ".join(args[2:])
-					else:
-						partmsg=""
-					self.bot.leave(args[1],partmsg)
-					self.bot.sendmsg(nick,"Left "+args[1])
-			elif msg[0:4] == "kick":
-				args=msg.split(" ")
-				if len(args) < 3:
-					self.bot.sendmsg(nick,"Usage: kick channel user [message]")
-				else:
-					if len(args) == 3:
-						self.bot.kick(args[1],args[2])
-					else:
-						self.bot.kick(args[1],args[2]," ".join(args[3:]))
-					self.bot.sendmsg(nick,"Kicked "+args[2]+" from "+args[1]+".")
-		#elif channel==self.bot.nickname:
-		#	self.bot.sendmsg(nick,"Not authorized")
-		elif self.bot.auth(user) > -1 and msg[0] == "!": #TODO: make "!" configurable
-			if msg[1:7] == "reload":
-				if len(msg.split(" ")) == 2:
-					for chatMod in self.bot.mods:
-						if chatMod.name == msg.split(" ")[1]:
-							try:
-								chatMod.reload()
-								self.logger.info("Reloading Settings of "+chatMod.name)
-							except Exception, e:
-								self.logger.error("Error while reloading "+chatMod.name)

Deleted: trunk/eightBallMod.py
===================================================================
--- trunk/eightBallMod.py	2007-06-10 13:19:33 UTC (rev 99)
+++ trunk/eightBallMod.py	2007-06-10 14:13:36 UTC (rev 100)
@@ -1,52 +0,0 @@
-# This file is part of OtfBot.
-#
-# OtfBot is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# OtfBot is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with OtfBot; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-# 
-# (c) 2006 by Alexander Schier
-#
-
-import random
-import chatMod
-
-class chatMod(chatMod.chatMod):
-	def __init__(self, bot):
-		self.bot=bot
-		self.answers=[
-		"Signs point to yes (Zeichen deuten auf ja)",
-		"Yes (Ja)",
-		"Without a doubt (Ohne einen Zweifel)",
-		"As I see it yes (Wie ich es sehe ja)",
-		"Most likely (Hoechstwahrscheinlich)",
-		"You may rely on it (Darauf kannst du dich verlassen)",
-		"Yes definitely (Definitiv ja)",
-		"It is decidedly so (Es ist entschieden so)",
-		"Outlook good (Gute Aussichten)",
-		"It is certain (Es ist sicher)",
-		"My sources say no (Meine Quellen sagen nein)",
-		"Very doubtful (Sehr zweifelhaft)",
-		"Don't count on it (Zaehl nicht drauf)",
-		"Outlook not so good (Nicht so gute Aussichten)",
-		"My reply is no (Meine Antwort ist nein)",
-		"Reply hazy, try again (Antwort unklar, versuchs nochmal)",
-		"Concentrate and ask again (Konzentriere dich und frag nochmal)",
-		"Better not tell you now (Ich sags dir jetzt lieber nicht)",
-		"Cannot predict now (Kann es jetzt nicht vorhersagen)",
-		"Ask again later (Frag spaeter nochmal)"
-		]
-
-	def msg(self, user, channel, msg):
-		#if channel == self.bot.nickname:
-		if len(msg) > 7 and msg[:7] == "!8ball ": #>7 = only if the user asked something.
-			self.bot.sendmsg(channel, random.choice(self.answers))

Deleted: trunk/identifyMod.py
===================================================================
--- trunk/identifyMod.py	2007-06-10 13:19:33 UTC (rev 99)
+++ trunk/identifyMod.py	2007-06-10 14:13:36 UTC (rev 100)
@@ -1,65 +0,0 @@
-# This file is part of OtfBot.
-#
-# OtfBot is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# OtfBot is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with OtfBot; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-# 
-# (c) 2005, 2006 by Alexander Schier
-# (c) 2006 by Robert Weidlich
-#
-
-import random, re, time
-import chatMod
-from threading import Thread
-
-def default_settings():
-	settings={};
-	settings['identifyMod.password']=''
-	settings['identifyMod.setBotFlag']='true'
-	return settings
-		
-class chatMod(chatMod.chatMod):
-	def __init__(self, bot):
-		self.bot=bot
-		self.mywhois=False
-		self.whois=False
-
-	def connectionMade(self):
-		self.password = str(self.bot.getConfig("password", "", "identifyMod", self.bot.network))
-	
-	def dowhois(self):
-		time.sleep(1)
-		self.bot.sendLine("WHOIS "+str(self.bot.nickname))
-
-	def signedOn(self):
-		if self.password != "":
-			self.logger.info("identifying to nickserv")
-			self.bot.sendmsg("nickserv", "identify "+self.password)
-			Thread(target=self.dowhois).start()
-			self.whois=True
-		if self.bot.getBoolConfig("setBotFlag", "True", "identifyMod", self.bot.network):
-			self.logger.info("setting usermode +b")
-			self.bot.mode(self.bot.nickname, 1, "B")
-	
-	def irc_unknown(self, prefix, command, params):
-		if command == "RPL_WHOISUSER" and params[0] == self.bot.nickname and self.whois:
-			self.mywhois=True
-			self.ident=False
-		if command in ['307','320'] and self.mywhois and params[0] == self.bot.nickname:
-			self.logger.info("Identification was successful")
-			self.ident=True
-		if command == "RPL_ENDOFWHOIS" and params[0] == self.bot.nickname and self.mywhois:
-			if self.ident==False:
-				self.logger.warn("Identification failed")
-			self.mywhois=False
-			self.whois=False

Deleted: trunk/kiMod.py
===================================================================
--- trunk/kiMod.py	2007-06-10 13:19:33 UTC (rev 99)
+++ trunk/kiMod.py	2007-06-10 14:13:36 UTC (rev 100)
@@ -1,291 +0,0 @@
-# This file is part of OtfBot.
-#
-# OtfBot is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# OtfBot is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with OtfBot; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-# 
-# (c) 2005, 2006 by Alexander Schier
-#
-
-import string, re, random, time
-import chatMod, functions
-
-MEGAHAL=1
-CITE=1
-try:
-	import mh_python
-except ImportError:
-	MEGAHAL=0
-try:
-	import MySQLdb
-except ImportError:
-	CITE=0
-
-def default_settings():
-	settings={};
-	settings['kiMod_module']='megahal'
-	
-	settings['kiMod_mysqlHost']=''
-	settings['kiMod_mysqlUser']=''
-	settings['kiMod_mysqlPasswd']=''
-	settings['kiMod_mysqlDB']='chatbot'
-	settings['kiMod_keywordsTable']='keywords'
-	settings['kiMod_stringsTable']='strings'
-	
-	settings['kiMod_wordpairsFile']='wordpairs.txt'
-	settings['kiMod_randomPercent']='0'
-	settings['kiMod_answerPercent']='50'
-	settings['kiMod_answerQueryPercent']='70'
-	settings['kiMode_maxStrings']='1000'
-	return settings
-		
-class responder:
-	def __init__(self):
-		pass
-	def learn(self, string):
-		pass
-	def reply(self, msg):
-		return ""
-	def cleanup(self):
-		pass
-
-class megahalResponder(responder):
-	def __init__(self, bot):
-		mh_python.initbrain()
-		self.bot=bot
-	def learn(self, msg):
-		try:
-			msg=unicode(msg, "UTF-8").encode("iso-8859-15")
-		except UnicodeEncodeError:
-			return
-			#pass
-		except UnicodeDecodeError:
-			return
-			#pass
-		mh_python.learn(msg)
-	def reply(self, msg):
-		try:
-			string=unicode(msg, "UTF-8").encode("iso-8859-15")
-		except UnicodeEncodeError:
-			return ""
-			#pass
-		except UnicodeDecodeError:
-			return ""
-			#pass
-		return unicode(mh_python.doreply(string), "iso-8859-15").encode("UTF-8")
-
-	def cleanup(self):
-		mh_python.cleanup()
-
-class citeResponder(responder):
-	def __init__(self, bot):
-		self.host=bot.getConfig("kiMod_mysqlHost", "")
-		self.user=bot.getConfig("kiMod_mysqlUser", "")
-		self.passwd=bot.getConfig("kiMod_mysqlPasswd", "")
-		self.database=bot.getConfig("kiMod_mysqlDB", "chatbot")
-		self.keywordsTable=bot.getConfig("kiMod_keywordsTable", "keywords")
-		self.stringsTable=bot.getConfig("kiMod_stringsTable", "strings")
-		self.maxStrings=int(bot.getConfig("kiMod_maxStrings", "1000"))
-		self.logger=bot.logger
-		
-		try:
-			self.db=MySQLdb.connect(host=self.host, user=self.user, passwd=self.passwd, db=self.database)
-			self.cursor=self.db.cursor()
-		except MySQLdb.OperationalError:
-			raise "boterror", "Error Connecting the DB"
-		self.cursor.execute("SHOW TABLES;");
-		tmp=self.cursor.fetchall()
-		#get list of tables
-		tables=[]
-		for i in tmp:
-			tables.append(i[0])
-		
-		#create tables, if needed
-		if not self.keywordsTable in tables:
-			self.cursor.execute("CREATE TABLE "+MySQLdb.escape_string(self.keywordsTable)+"(keyword TEXT, stringid INT);");
-			self.logger.info("created keywords table:"+self.keywordsTable)
-		if not self.stringsTable in tables:
-			self.cursor.execute("CREATE TABLE "+MySQLdb.escape_string(self.stringsTable)+"(id INT AUTO_INCREMENT, string TEXT, PRIMARY KEY(id));");
-			self.logger.info("created strings table:"+self.stringsTable)
-
-	def learn(self, string):
-		cursor=self.cursor;
-		words=self.getwords(string)
-		self.cursor.execute("SELECT id FROM "+MySQLdb.escape_string(self.stringsTable)+" WHERE string = '"+MySQLdb.escape_string(string)+"';")
-		if len(words) >1 and not len(self.cursor.fetchall()): #Do not learn single word / do not leran something twice
-			self.cursor.execute("INSERT INTO "+MySQLdb.escape_string(self.stringsTable)+" (string) VALUES (\""+MySQLdb.escape_string(string)+"\");")
-			self.cursor.execute("SELECT LAST_INSERT_ID();")
-			id=(self.cursor.fetchall())[0][0];
-			if id>self.maxStrings:
-				self.cursor.execute("DELETE FROM "+MySQLdb.escape_string(self.stringsTable)+" WHERE id < "+MySQLdb.escape_string(str(id-self.maxStrings)));
-			for word in words:
-				if word!="":
-					self.cursor.execute("INSERT INTO "+MySQLdb.escape_string(self.keywordsTable)+" VALUES (\""+MySQLdb.escape_string(word)+"\","+MySQLdb.escape_string(str(id))+");")
-				if id>self.maxStrings:
-					self.cursor.execute("DELETE FROM "+MySQLdb.escape_string(self.keywordsTable)+" WHERE stringid < "+MySQLdb.escape_string(str(id-self.maxStrings)));
-
-	def reply(self, msg):
-		#self.learn(msg)
-		ids=()
-		words=self.getwords(msg)
-		notwords=[]
-		reply=""
-		#try to find the best(long) keyword in database
-		while len(words) and len(ids)==0:
-			topword=""
-			for word in words:
-				if len(word) > len(topword):
-					topword=word
-			#print "Topword: "+topword
-			self.cursor.execute("SELECT stringid FROM "+MySQLdb.escape_string(self.keywordsTable)+" WHERE keyword LIKE '%"+MySQLdb.escape_string(topword)+"%';")
-			ids=(self.cursor.fetchall());
-			if len(ids)==0:
-				notwords.append(topword)
-			words2=[]
-			for word in words:
-				if not word in notwords:
-					words2.append(word)
-			words=words2
-
-		if len(ids):
-			id=random.choice(ids)[0] #choose one (if multiple matches)
-			self.cursor.execute("SELECT string FROM "+MySQLdb.escape_string(self.stringsTable)+" WHERE id='"+MySQLdb.escape_string(str(id))+"';")
-			ret=self.cursor.fetchall()
-			if len(ret):
-				reply=(ret)[0][0]
-		self.learn(msg)
-		return reply
-
-	def getwords(self, string):
-		#string=re.sub("[.,!?;\"':]", " ", string)
-		string=re.sub("[.,!?\"']", " ", string) #save the smileys ;-)
-		words=string.split(" ")
-		return words
-	def cleanup(self):
-		pass
-
-
-
-class chatMod(chatMod.chatMod):
-	def __init__(self, bot):
-		self.bot=bot
-	
-	def start(self):
-		self.logger = self.bot.logging.getLogger("core.kiMod")
-		self.channels=[]
-		self.wordpairsFile=self.bot.getConfig("kiMod_wordpairsFile", "wordpairs.txt")#XXX: this needs to be utf-8 encoded
-		self.wordpairs=functions.loadProperties(self.wordpairsFile)
-
-		module=self.bot.getConfig("kiMod_module", "megahal")
-		self.logger.debug("kiMod: using module "+module+",cite="+str(CITE)+",megahal="+str(MEGAHAL))
-		if module=="cite":
-			if CITE:
-				try:
-					self.responder=citeResponder(self.bot)
-					self.logger.debug("kiMod: using cite module")
-				except "boterror":
-					self.logger.error("Error connecting the cite-DB.")
-					self.responder=responder() #null responder
-					#Fallback
-					if MEGAHAL:
-						self.logger.warning("kiMod: Using Megahal instead")
-						self.responder=megahalResponder(bot)
-			else:
-				self.logger.error("Cannot use citeDB. Module MySQLdb not availible.")
-				if MEGAHAL:
-					self.logger.warning("Using Megahal instead")
-					self.responder=megahalResponder(self.bot)
-				else:
-					self.responder=responder() #null responder
-		elif module=="megahal":
-			if MEGAHAL:
-				self.responder=megahalResponder(self.bot)
-			else:
-				self.logger.error("Cannot use megahal. Module mh_python not availible.")
-				self.responder=responder() #null responder
-				#Fallback
-				if CITE:
-					self.logger.warning("Trying citeDB instead.")
-					try:
-						self.responder=citeResponder(self.bot)
-					except "boterror":
-						self.logger.error("Error connecting the cite-DB.")
-
-	def joined(self, channel):
-		self.channels.append(channel)
-	def msg(self, user, channel, msg):
-		user=user.split("!")[0]
-		if user == self.bot.nickname:
-			return
-		if not channel in self.channels: 
-			return
-		if msg[0]=="!":
-			return
-			
-
-		reply=""
-		private=0
-
-		#bot answers random messages
-		number=random.randint(1,1000)
-		chance=int(float(self.bot.getConfig("kiMod_randomPercent", "0"))*10)
-		israndom=0
-		if number < chance:
-			israndom=1
-			
-		if self.lnickname==string.lower(channel):
-			private=1
-			reply=self.responder.reply(msg)
-		#elif string.lower(msg[0:len(self.bot.nickname)])==string.lower(self.bot.nickname) or number<chance:
-		elif (self.lnickname in string.lower(msg)) or israndom:
-			if string.lower(msg[:len(self.bot.nickname)])==self.lnickname:
-				msg=msg[len(self.bot.nickname)+1:] #+1 for the following ":", " " or ","
-			if len(msg) and msg[0]==" ": 
-				msg=msg[1:]
-			reply=self.responder.reply(msg)
-		else:
-			#TODO: match with nicklist
-			if not re.match("^(:|;|http)", msg):
-				msg=re.sub("^[^ ]*?[:,;]", "", msg)
-				#msg=re.sub("^[a-zA-Z]*?[:;,]", "", msg)
-			self.responder.learn(msg)
-		if reply!="":
-			#reply=re.sub(" "+self.bot.nickname, " "+user, reply) #more secure to match only the name
-			reply=re.sub(self.bot.nickname, user, reply, re.I) 
-			for key in self.wordpairs.keys():
-				reply=re.sub(key, self.wordpairs[key], reply, re.I)
-			
-			reply=re.sub("Http", "http", reply, re.I) #fix for nice urls
-			#time.sleep(len(reply)*0.3*float(self.bot.getConfig("kiMod_wait", "2")))
-
-			if reply==string.upper(reply): #no UPPERCASE only Posts
-				reply=string.lower(reply)
-			if private:
-				number=random.randint(1,1000)
-				chance=int(self.bot.getConfig("kiMod_answerQueryPercent", "70"))*10
-				if number < chance:
-					self.bot.sendmsg(user, reply, "UTF-8")
-			else:
-				number=random.randint(1,1000)
-				chance=int(self.bot.getConfig("kiMod_answerPercent", "50"))*10
-				if israndom or number < chance: #apply answerPercent only on answers(check for israndom)
-					self.bot.sendmsg(channel, user+": "+reply, "UTF-8")
-
-	def connectionMade(self):
-		self.lnickname=string.lower(self.bot.nickname)
-	def connectionLost(self, reason):
-		self.responder.cleanup()
-
-	def stop(self):
-		self.responder.cleanup()
-

Deleted: trunk/kursMod.py
===================================================================
--- trunk/kursMod.py	2007-06-10 13:19:33 UTC (rev 99)
+++ trunk/kursMod.py	2007-06-10 14:13:36 UTC (rev 100)
@@ -1,91 +0,0 @@
-# This file is part of OtfBot.
-#
-# OtfBot is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# OtfBot is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with OtfBot; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-# 
-# (c) 2006, 2007 by Robert Weidlich
-#
-
-import string, re, functions
-import urllib, time
-import chatMod
-
-def default_settings():
-	settings={};
-	return settings
-		
-class chatMod(chatMod.chatMod):
-	def __init__(self, bot):
-		self.bot = bot
-		self.channels={}
-		self.time=time.time()
-		self.commands = ["kurs","wkn"]
-		
-	def joined(self, channel):
-		self.channels[channel]=1
-	
-	def msg(self, user, channel, msg):
-		nick=user.split("!")[0]
-		if msg.split(" ")[0][1:] in self.commands and 0 < (time.time() - self.time) < 5:
-			self.bot.sendmsg(channel,"Wait a minute ...")
-		else:
-			self.time = time.time()
-			if msg[:5] == "!kurs":
-				datas = urllib.urlopen("http://de.old.finance.yahoo.com/d/quotes.csv?s="+urllib.quote_plus(" ".join(msg.split(" ")[1:]))+"&f=nsl1d1t1cohgvc4x&e=.csv").read().strip().split('\r\n')
-				if len(datas) > 4:
-					datas = datas[:3]
-				for data in datas:
-					data = data.strip().split(";")
-					date = data[3].split("/")
-					d = { 'name' : data[0], 
-					      'symbol' : data[1],
-					      'kurs' : data[2],
-					      'day' : date[1]+"."+date[0]+"."+date[2],
-					      'time' : data[4],
-					      'change_kurs' : data[5].split(" - ")[0],
-					      'change_percent' : data[5].split(" - ")[1],
-					      'last_day' : data[6],
-					      'top_range' : data[7],
-					      'low_range' : data[8],
-					      'volumen' : data[9],
-					      'currency' : data[10],
-					      'boerse' : data[11]
-					}
-					# \x03C C=Colorcode
-					answer = d['day']+", "+d['time']+" "+ d['name']+" ("+d['boerse']+":"+d['symbol']+") "+d['kurs']+" "+d['currency']
-					if d['change_kurs'] != "N/A":
-						if d['change_kurs'][:1] == "+":
-							color="\x033"
-						elif d['change_kurs'][:1] == "-":
-							color="\x034"
-						else:
-							color=""
-						answer = answer +", "+color+d['change_kurs']+" "+d['currency']+"\x03, "+color+d['change_percent']+"\x03, Vol.:"+d['volumen']+" St."
-					if d['low_range'] != "N/A":
-						answer = answer + ", Intraday "+d['low_range']+ " bis "+d['top_range']+" "+d['currency']+"."
-					if d['kurs'] == "N/A":
-						answer = "Der geforderte Kurs wurde nicht gefunden."
-					self.bot.sendmsg(channel,answer)
-			if msg[:4] == "!wkn":
-				res=[]
-				for line in urllib.urlopen("http://de.finsearch.yahoo.com/de/index.php?s=de_sort&nm="+urllib.quote_plus(" ".join(msg.split(" ")[1:]))+"&tp=S").read().split("\n"):
-					if line[:3] == " <a":
-						res.append(re.sub('.*s\=([^"]*)">([^<]*)<.*',r'\1;\2',line).split(";"))
-				if len(res) < 4:
-					to = len(res)
-				else:
-					to = 4
-				for i in range(to):
-					self.bot.sendmsg(channel,res[i][0]+"\t"+res[i][1])
-

Deleted: trunk/logMod.py
===================================================================
--- trunk/logMod.py	2007-06-10 13:19:33 UTC (rev 99)
+++ trunk/logMod.py	2007-06-10 14:13:36 UTC (rev 100)
@@ -1,180 +0,0 @@
-# This file is part of OtfBot.
-#
-# OtfBot is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# OtfBot is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with OtfBot; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-# 
-# (c) 2005, 2006 by Alexander Schier
-# (c) 2006 by Robert Weidlich
-#
-
-import time, string, locale, threading, os
-from string import Template
-import chatMod
-
-
-def default_settings():
-	settings={'logMod.path':'$n-$c/$y-$m-$d.log',
-			  'logMod.storedir':'log'}
-	return settings
-		
-class chatMod(chatMod.chatMod):
-	def __init__(self, bot):
-		self.bot=bot
-		self.channels={}
-		self.files={}
-		self.path={}
-		self.logpath=bot.getConfig("logMod.storedir", "log")+"/"+bot.getConfig("logMod.path", "$n-$c/$y-$m-$d.log")
-		if not os.path.isdir(bot.getConfig("logMod.storedir", "log")):
-			os.mkdir(bot.getConfig("logMod.storedir", "log"))
-		locale.setlocale(locale.LC_ALL, "de_DE.UTF-8")
-		self.day=self.ts("%d") #saves the hour, to detect daychanges
-		#self.timer=threading.Timer(self.secsUntilDayChange(), self.dayChange)
-		#self.timer.start()
-		for c in self.bot.channel:
-			self.setNetwork()
-			self.joined(c)
-	
-	def timemap(self):
-		return {'y':self.ts("%Y"), 'm':self.ts("%m"), 'd':self.ts("%d")}
-
-	def ts(self, format="%H:%M"):
-		"""timestamp"""
-		return time.strftime(format, time.localtime(time.time()))
-		
-	def secsUntilDayChange(self):
-		"""calculate the Seconds to midnight"""
-		tmp=time.localtime(time.time())
-		wait=(24-tmp[3] -1)*60*60
-		wait+=(60-tmp[4] -1)*60
-		wait+=60-tmp[5]
-		return wait
-
-	def dayChange(self):
-		self.day=self.ts("%d")
-		self.stop()
-		for channel in self.channels:
-			self.joined(channel)
-			#self.log(channel, "--- Day changed "+self.ts("%a %b %d %Y"))
-		#restart the timer
-		#self.timer=threading.Timer(self.secsUntilDayChange(), self.dayChange)
-		#self.timer.start()
-		
-		
-	def log(self, channel, string, timestamp=True):
-		if self.day != self.ts("%d"):
-			self.dayChange()
-		if channel in self.channels:
-			logmsg=string+"\n"
-			if timestamp:
-				logmsg=self.ts()+" "+logmsg
-			self.files[channel].write(logmsg)
-			self.files[channel].flush()
-
-	def logPrivate(self, user, mystring):
-		dic=self.timemap()
-		dic['c']=string.lower(user)
-		filename=Template(self.logpath).safe_substitute(dic)
-		if not os.path.exists(os.path.dirname(filename)):
-			os.mkdir(os.path.dirname(filename))	
-		file=open(filename, "a")
-		file.write(self.ts()+" "+mystring+"\n")
-		file.close()
-
-	def joined(self, channel):
-		self.channels[string.lower(channel)]=1
-		#self.files[string.lower(channel)]=open(string.lower(channel)+".log", "a")
-		self.path[channel]=Template(self.logpath).safe_substitute({'c':channel})
-		file=Template(self.path[channel]).safe_substitute(self.timemap())
-		if not os.path.exists(os.path.dirname(file)):
-			os.mkdir(os.path.dirname(file))
-		self.files[string.lower(channel)]=open(file, "a")
-		self.log(channel, "--- Log opened "+self.ts("%a %b %d %H:%M:%S %Y"), False)
-		self.log(channel, "-!- "+self.bot.nickname+" ["+self.bot.nickname+"@hostmask] has joined "+channel) #TODO: real Hostmask
-		
-	def left(self, channel):
-		self.log(channel, "-!- "+self.bot.nickname+"["+self.bot.nickname+"@hostmask] has left "+channel)
-		del self.channels[string.lower(channel)]
-		self.files[string.lower(channel)].close()
-	def msg(self, user, channel, msg):
-		user=user.split("!")[0]
-		modesign=" " #self.bot.users[channel][user]['modchar']
-		if string.lower(channel)==string.lower(self.bot.nickname):
-			self.logPrivate(user, "<"+modesign+user+"> "+msg)
-		elif len(channel)>0 and channel[0]=="#":
-			modesign=self.bot.users[channel][user]['modchar']
-			self.log(channel, "<"+modesign+user+"> "+msg)
-		else:
-			self.logPrivate(channel, "<"+modesign+self.bot.nickname+"> "+msg)
-	
-	def noticed(self, user, channel, msg):
-		if user != "":
-			#self.logger.info(str(user+" : "+channel+" : "+msg))
-			self.logPrivate(user.split("!")[0], "< "+user.split("!")[0]+"> "+msg)
-
-	def action(self, user, channel, message):
-		#self.logger.debug(user+channel+message)
-		user=user.split("!")[0]
-		self.log(channel, " * "+user+" "+message)
-		
-	def modeChanged(self, user, channel, set, modes, args):
-		user=user.split("!")[0]
-		sign="+"
-		if not set:
-			sign="-"
-		self.log(channel, "-!- mode/"+channel+" ["+sign+modes+" "+string.join(args, " ")+"] by "+user)
-		
-	def userKicked(self, kickee, channel, kicker, message):
-		self.log(channel, "-!- "+kickee+" was kicked from "+channel+" by "+kicker+" ["+message+"]")
-
-	def userJoined(self, user, channel):
-		self.log(channel, "-!- "+user.split("!")[0]+" ["+user.split("!")[1]+"] has joined "+channel)#TODO: real Hostmask
-
-	def userLeft(self, user, channel):
-		self.log(channel, "-!- "+user.split("!")[0]+" ["+user.split("!")[1]+"] has left "+channel)#TODO: real Hostmask
-	
-	def userQuit(self, user, quitMessage):
-		users = self.bot.getUsers()
-		for channel in self.channels:
-			if users[channel].has_key(user.split("!")[0]):
-				self.log(channel, "-!- "+user.split("!")[0]+" ["+user.split("!")[1]+"] has quit ["+quitMessage+"]")
-		
-	def topicUpdated(self, user, channel, newTopic):
-		#TODO: first invoced on join. This should not be logged
-		self.log(channel, "-!- "+user+" changed the topic of "+channel+" to: "+newTopic)
-
-	def userRenamed(self, oldname, newname):
-		#TODO: This can not handle different channels right
-		user = self.bot.getUsers()
-		for channel in self.channels:
-			if user[channel].has_key(newname):
-				self.log(channel, "-!- "+oldname+" is now known as "+newname)
-		
-	def stop(self):
-		for channel in self.channels:
-			self.log(channel, "--- Log closed "+self.ts("%a %b %d %H:%M:%S %Y"), False)
-			self.files[channel].close()
-		#self.timer.cancel()
-
-	def connectionMade(self):
-		self.setNetwork()
-		
-	def setNetwork(self):
-		if len(self.bot.network.split(".")) < 3:
-			net=self.bot.network
-		else:
-			net=self.bot.network.split(".")[-2]
-		self.logpath=Template(self.logpath).safe_substitute({'n':net})
-
-	def connectionLost(self, reason):
-		self.stop()

Deleted: trunk/marvinMod.py
===================================================================
--- trunk/marvinMod.py	2007-06-10 13:19:33 UTC (rev 99)
+++ trunk/marvinMod.py	2007-06-10 14:13:36 UTC (rev 100)
@@ -1,49 +0,0 @@
-# This file is part of OtfBot.
-#
-# OtfBot is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# OtfBot is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with OtfBot; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-# 
-# (c) 2005, 2006 by Alexander Schier
-#
-
-import random
-import chatMod, functions
-
-
-def default_settings():
-	settings={};
-	settings['marvinMod.filename']='marvin.txt'
-	settings['marvinMod.percent']='5'
-	settings['marvinMod.fileencoding']='iso-8859-15'
-	return settings
-		
-class chatMod(chatMod.chatMod):
-	def __init__(self, bot):
-		self.bot=bot
-		self.start()
-
-	def msg(self, user, channel, msg):
-		#if channel == self.bot.nickname:
-		#if msg[0]=="!" or msg[:len(self.bot.nickname)]==self.bot.nickname:
-		if (msg[0]=="!" or self.bot.nickname in msg) and len(self.marvin):
-			number=random.randint(0,100)
-			chance=int(self.bot.getConfig("percent", "20", "marvinMod"))
-			if number <chance:
-				self.bot.sendmsg(channel, random.choice(self.marvin), self.bot.getConfig("fileencoding", "iso-8859-15", "marvinMod"))
-
-	def start(self):
-		self.marvin=functions.loadList(self.bot.getConfig("filename", "marvin.txt", "marvinMod"))
-
-	def reload(self):
-		self.start()

Deleted: trunk/mathMod.py
===================================================================
--- trunk/mathMod.py	2007-06-10 13:19:33 UTC (rev 99)
+++ trunk/mathMod.py	2007-06-10 14:13:36 UTC (rev 100)
@@ -1,46 +0,0 @@
-# This file is part of OtfBot.
-#
-# OtfBot is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# OtfBot is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with OtfBot; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-# 
-# (c) 2005, 2006 by Alexander Schier
-#
-
-import random, re
-import chatMod
-
-class chatMod(chatMod.chatMod):
-	def __init__(self, bot):
-		self.bot=bot
-
-	def msg(self, user, channel, msg):
-		#if channel == self.bot.nickname:
-		if msg == "!wuerfel":
-			self.bot.sendme(channel, "wuerfelt. Das Ergebnis ist: "+str(random.randint(1,6)))
-		elif msg[0:8] == "!wuerfel":
-			num = 2
-			string = "wuerfelt. Die Ergebnisse sind: "
-			try:
-				num = int(msg[8:])
-			except ValueError:
-				num = 2
-			if num > 10:
-				num = 10
-			for i in range(1,num+1):
-				zahl = random.randint(1,6)/s
-				if i < num:
-					string += str(zahl)+", "
-				else:
-					string += str(zahl)
-			self.bot.sendme(channel, string) 

Deleted: trunk/modeMod.py
===================================================================
--- trunk/modeMod.py	2007-06-10 13:19:33 UTC (rev 99)
+++ trunk/modeMod.py	2007-06-10 14:13:36 UTC (rev 100)
@@ -1,50 +0,0 @@
-# This file is part of OtfBot.
-#
-# OtfBot is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# OtfBot is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with OtfBot; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-# 
-# (c) 2005, 2006 by Alexander Schier
-#
-
-import random, re
-import chatMod
-
-class chatMod(chatMod.chatMod):
-    def __init__(self, bot):
-        self.bot=bot
-        self.modes={}
-        self.modes["op"]={"char": "o", "set": 1}
-        self.modes["deop"]={"char": "o", "set": 0}
-        self.modes["voice"]={"char": "v", "set": 1}
-        self.modes["devoice"]={"char": "v", "set": 0}
-	self.modes["protect"]={"char": "a", "set": 1}
-	self.modes["unprotect"]={"char": "a", "set": 0}
-
-    def msg(self, user, channel, msg):
-        user=user.split("!")[0]
-        if self.bot.auth(user) > 2:
-            for mode in self.modes.keys():
-                if msg[0:len(mode)+1]=="!"+mode:
-                    msg=msg[len(mode)+1:]
-                    if msg != "":
-                        if msg[0]==" ":
-                            msg=msg[1:]
-                        self.bot.mode(channel, self.modes[mode]["set"], self.modes[mode]["char"], None, msg)
-                    else:
-                        self.bot.mode(channel, self.modes[mode]["set"], self.modes[mode]["char"], None, user)
-	if self.bot.auth(user) > 5 and msg[0:5] == "!kick":
-		if len(msg.split(" ")) == 2:
-			self.bot.kick(channel,msg.split(" ")[1])
-		elif len(msg.split(" ")) > 2:
-			self.bot.kick(channel,msg.split(" ")[1]," ".join(msg.split(" ")[2:]))

Copied: trunk/modules/answerMod.py (from rev 99, trunk/answerMod.py)

Copied: trunk/modules/authMod.py (from rev 99, trunk/authMod.py)

Copied: trunk/modules/badwordsMod.py (from rev 99, trunk/badwordsMod.py)

Copied: trunk/modules/commandsMod.py (from rev 99, trunk/commandsMod.py)

Copied: trunk/modules/controlMod.py (from rev 99, trunk/controlMod.py)

Copied: trunk/modules/eightBallMod.py (from rev 99, trunk/eightBallMod.py)

Copied: trunk/modules/identifyMod.py (from rev 99, trunk/identifyMod.py)

Copied: trunk/modules/kiMod.py (from rev 99, trunk/kiMod.py)

Copied: trunk/modules/kursMod.py (from rev 99, trunk/kursMod.py)

Copied: trunk/modules/logMod.py (from rev 99, trunk/logMod.py)

Copied: trunk/modules/marvinMod.py (from rev 99, trunk/marvinMod.py)

Copied: trunk/modules/mathMod.py (from rev 99, trunk/mathMod.py)

Copied: trunk/modules/modeMod.py (from rev 99, trunk/modeMod.py)

Copied: trunk/modules/nobodyisperfectMod.py (from rev 99, trunk/nobodyisperfectMod.py)

Copied: trunk/modules/rdfMod.py (from rev 99, trunk/rdfMod.py)

Copied: trunk/modules/reminderMod.py (from rev 99, trunk/reminderMod.py)

Copied: trunk/modules/weatherMod.py (from rev 99, trunk/weatherMod.py)

Deleted: trunk/nobodyisperfectMod.py
===================================================================
--- trunk/nobodyisperfectMod.py	2007-06-10 13:19:33 UTC (rev 99)
+++ trunk/nobodyisperfectMod.py	2007-06-10 14:13:36 UTC (rev 100)
@@ -1,267 +0,0 @@
-# This file is part of OtfBot.
-#
-# OtfBot is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# OtfBot is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with OtfBot; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-# 
-# (c) 2006 by Alexander Schier
-#
-
-import random, string, threading, time
-import chatMod
-
-ANSWER_TIME=90
-QUIZ_TIME=60
-TIMEOUT=300 #idle time until game stops
-
-#game phases
-NO_GAME=0
-WAITING_FOR_PLAYERS=1
-WAITING_FOR_QUESTION=2
-WAITING_FOR_QUIZMASTER_ANSWER=3
-WAITING_FOR_ANSWERS=4
-QUIZ=5
-
-class waitfor(threading.Thread):
-	def __init__(self, delay, function):
-		threading.Thread.__init__(self)
-		self.function=function
-		self.delay=delay
-	def run(self):
-		self.end=False
-		while not self.end and self.delay >0:
-			time.sleep(1)
-			self.delay-=1
-		if not self.end:
-			self.function()
-	def stop(self):
-		self.end=True
-
-def mypass():
-	pass
-
-class chatMod(chatMod.chatMod):
-	def __init__(self, bot):
-		self.bot=bot
-		self.init_vars()
-		self.timer=waitfor(1, mypass)
-		self.allscore={}
-
-	def init_vars(self):
-		self.phase=NO_GAME
-		self.players=[]
-		self.gameadmin="" #needed for deciding when to start the game
-		self.gamemaster="" #different for each round.
-		#self.gamechannel="" #this is not multichannel compatible!
-		self.question=""
-		self.answers={}
-		self.answeruser={} #usernames(!) for the numbers
-		self.score={}
-		self.guessed=[] #users, which already have guessed
-		self.additional_info=None
-
-	def init_vars_for_restart(self):
-		self.question=""
-		self.answers={}
-		self.answeruser={} #usernames(!) for the numbers
-		self.score={}
-		self.guessed=[] #users, which already have guessed
-		self.additional_info=None
-
-		#each player will be gamemaster, in order
-		self.players.append(self.gamemaster)
-		self.gamemaster=self.players[0]
-		self.players=self.players[1:]
-
-	def end_of_answertime(self):
-		if self.timer:
-			self.timer.stop()
-		self.phase=QUIZ
-		count=1
-		self.bot.sendmsg(self.gamechannel, "Die Frage ist: "+self.question, self.bot.getConfig("encoding", "UTF-8"))
-		self.bot.sendmsg(self.gamechannel, "Moegliche Antworten (eine waehlen)", self.bot.getConfig("encoding", "UTF-8"))
-		users=self.answers.keys()
-		random.shuffle(users)
-		for user in users:
-			self.bot.sendmsg(self.gamechannel, str(count)+". "+self.answers[user], self.bot.getConfig("encoding", "UTF-8"))
-			self.answeruser[count]=user
-			count=count+1
-		self.timer=waitfor(QUIZ_TIME, self.end_of_quiz)
-		self.timer.start()
-
-	def end_of_quiz(self):
-		self.phase=NO_GAME
-		if self.timer:
-			self.timer.stop()
-		self.bot.sendmsg(self.gamechannel, "===Ende der Runde===")
-		correct="Die richtige Antwort war: "+self.answers[self.gamemaster]
-		if self.additional_info:
-			correct=correct+" ("+self.additional_info+")"
-		self.bot.sendmsg(self.gamechannel, correct, self.bot.getConfig("encoding", "UTF-8"))
-		if len(self.score):
-			#show who gave which answer.
-			text=""
-			for num in self.answeruser:
-				if self.answeruser[num]==self.gamemaster:
-					text+="**"+str(num)+"** war von "+self.answeruser[num]+", "
-				else:
-					text+=str(num)+" war von "+self.answeruser[num]+", "
-			text=text[:-2]+"."
-			self.bot.sendmsg(self.gamechannel, text, self.bot.getConfig("encoding", "UTF-8"))
-			#Points.
-			#self.bot.sendmsg(self.gamechannel, "=== Punkte ===", self.bot.getConfig("encoding", "UTF-8"))
-			for player in self.score:
-				self.bot.sendmsg(self.gamechannel, player+": "+str(self.score[player])+ " Punkte", self.bot.getConfig("encoding", "UTF-8"))
-			#set in allscore
-			for user in self.score:
-				if user in self.allscore.keys():
-					self.allscore[user]+=self.score[user]
-				else:
-					self.allscore[user]=self.score[user]
-
-
-	def msg(self, user, channel, msg):
-		user=string.lower(user.split("!")[0])
-		if channel == self.bot.nickname:
-			if self.phase==WAITING_FOR_QUESTION and user==self.gamemaster:
-				self.timer.stop()
-				self.question=msg
-				self.bot.sendmsg(user, "Und jetzt die richtige Antwort")
-				self.phase=WAITING_FOR_QUIZMASTER_ANSWER
-				self.timer=waitfor(TIMEOUT, self.end_of_quiz)
-				self.timer.start()
-
-			elif self.phase==WAITING_FOR_QUIZMASTER_ANSWER and user==self.gamemaster:
-				self.timer.stop()
-				self.answers[user]=msg
-				self.bot.sendmsg(self.gamechannel, "Die Frage ist: "+self.question, self.bot.getConfig("encoding", "UTF-8"))
-				self.bot.sendmsg(self.gamechannel, "/msg mir eure Antworten.", self.bot.getConfig("encoding", "UTF-8"))
-				self.phase=WAITING_FOR_ANSWERS
-				self.timer=waitfor(ANSWER_TIME, self.end_of_answertime)
-				self.timer.start() #TIMEOUT
-
-				#remove gamemaster from game, because he knows the answer
-				self.players.remove(self.gamemaster)
-				self.bot.sendmsg(self.gamemaster, "Zusatzinformation fuer nach dem Quiz(wenn nicht gewuenscht, einfach freilassen):")
-
-			elif (self.phase==WAITING_FOR_ANSWERS or self.phase==QUIZ) and user==self.gamemaster and not self.additional_info:
-				self.additional_info=msg
-
-			elif self.phase==WAITING_FOR_ANSWERS and not user in self.answers and user in self.players:
-				self.answers[user]=msg
-				if len(self.answers) == len(self.players)+1: #+gamemaster
-					if self.timer:
-						self.timer.stop()
-					self.end_of_answertime()
-		else:
-			if msg[:7]=="!remove":
-				if self.phase==NO_GAME:
-					if len(msg)>8 and user==self.gameadmin: #8 because of the whitespace after !remove
-						player=string.lower(msg[8:])
-					else:
-						player=user
-					if player in self.players:
-						self.players.remove(player)
-						self.bot.sendmsg(channel, "Spieler "+player+" aus der Runde entfernt.")
-					else:
-						self.bot.sendmsg(channel, "Spieler "+player+" spielt nicht mit.")
-				else:
-					self.bot.sendmsg(channel, "Spieler koennen nur zwischen 2 Runden entfernt werden")
-
-			if msg[:4]=="!add":
-				if self.phase==NO_GAME:
-					self.players.append(user)
-					self.bot.sendmsg(channel, user+" spielt jetzt mit.")
-					#random.shuffle(self.players)
-				else:
-					self.bot.sendmsg(channel, "Spieler koennen nur zwischen 2 Runden hinzugefuegt werden")
-
-			if msg[:12]=="!restartgame":
-				if self.phase==NO_GAME and user==self.gameadmin:
-					self.bot.sendmsg(channel, "Eine neue Runde startet, Spieler bleiben gleich!")
-					self.init_vars_for_restart()
-					self.phase=WAITING_FOR_QUESTION
-					self.bot.sendmsg(channel, self.gamemaster+": /msg mir die Frage.", self.bot.getConfig("encoding", "UTF-8"))
-					self.timer=waitfor(TIMEOUT, self.end_of_quiz)
-					self.timer.start()
-					
-			if msg[:10]=="!startgame":
-				if self.phase==NO_GAME:
-					self.init_vars()
-					self.gameadmin=user
-					self.bot.sendmsg(channel, "Wer moechte an einer Runde \"Nobody is Perfect\" teilnehmen?(laut \"ich\" rufen!)")
-					self.bot.sendmsg(channel, self.gameadmin+": Zum starten nocheinmal !startgame sagen.", self.bot.getConfig("encoding", "UTF-8"))
-					self.phase=WAITING_FOR_PLAYERS
-					self.gamechannel=channel #needed for queries which result in a public answer
-					self.timer=waitfor(TIMEOUT, self.end_of_quiz)
-					self.timer.start()
-				elif self.phase==WAITING_FOR_PLAYERS and user==self.gameadmin:
-					self.timer.stop()
-					if len(self.players) >2:
-						self.phase=WAITING_FOR_QUESTION
-						random.shuffle(self.players)
-						self.gamemaster=random.choice(self.players)
-						self.bot.sendmsg(channel, self.gamemaster+": /msg mir die Frage.", self.bot.getConfig("encoding", "UTF-8"))
-						self.timer=waitfor(TIMEOUT, self.end_of_quiz)
-						self.timer.start()
-					else:
-						self.bot.sendmsg(channel, self.gamemaster+" zu wenig Spieler!", self.bot.getConfig("encoding", "UTF-8"))
-			elif msg[:10]=="!abortgame":
-				self.end_of_quiz()
-
-			elif msg[:6]=="!score":
-				if len(self.allscore):
-					self.bot.sendmsg(channel, "=== Punkte ===", self.bot.getConfig("encoding", "UTF-8"))
-					points=self.allscore.values()
-					points.sort()
-					points.reverse()
-					players=self.allscore.keys()
-					for point in points:
-						for player in players:
-							if self.allscore[player]==point:
-								self.bot.sendmsg(channel, player+": "+str(point)+ " Punkte", self.bot.getConfig("encoding", "UTF-8"))
-								players.remove(player)
-								break;
-
-			elif string.lower(msg)[:3]=="ich" and self.phase==WAITING_FOR_PLAYERS:
-				if not (user in self.players or user==self.gamemaster):
-					self.players.append(user)
-					text=""
-					for item in self.players:
-						text=text+item+", "
-					text=text[:-2]+"."
-					self.bot.sendmsg(channel, str(len(self.players))+" Teilnehmer: "+text, self.bot.getConfig("encoding", "UTF-8"))
-			elif self.phase==QUIZ and user in self.players and not user in self.guessed and user!=self.gamemaster:
-				try:
-					if(self.answeruser[int(msg)]==self.gamemaster):
-						if user in self.score:
-							self.score[user]=self.score[user]+1
-							#self.bot.sendmsg(self.gamechannel, user+" bekommt 1 Punkt", self.bot.getConfig("encoding", "UTF-8")) #DEBUG
-						else:
-							self.score[user]=1
-							#self.bot.sendmsg(self.gamechannel, user+" bekommt 1 Punkt", self.bot.getConfig("encoding", "UTF-8")) #DEBUG
-					elif(self.answeruser[int(msg)]==user):
-						#to select the own answer gives 0 points
-						pass
-					else:
-						if(self.answeruser[int(msg)] in self.score):
-							self.score[self.answeruser[int(msg)]]=self.score[self.answeruser[int(msg)]]+3
-							#self.bot.sendmsg(self.gamechannel, self.answeruser[int(msg)]+" bekommt 3 Punkte", self.bot.getConfig("encoding", "UTF-8")) #DEBUG
-						else:
-							self.score[self.answeruser[int(msg)]]=3
-							#self.bot.sendmsg(self.gamechannel, self.answeruser[int(msg)]+" bekommt 3 Punkte", self.bot.getConfig("encoding", "UTF-8")) #DEBUG
-					self.guessed.append(user)
-				except ValueError:
-					pass
-				if len(self.guessed) == len(self.players):
-					self.end_of_quiz()

Modified: trunk/otfbot.py
===================================================================
--- trunk/otfbot.py	2007-06-10 13:19:33 UTC (rev 99)
+++ trunk/otfbot.py	2007-06-10 14:13:36 UTC (rev 100)
@@ -29,9 +29,12 @@
 from twisted.internet import reactor, protocol, error
 import os, random, string, re, threading, time, sys, traceback, threading, atexit
 import functions, config
-import mathMod, commandsMod, identifyMod, badwordsMod, answerMod, logMod, authMod, controlMod, modeMod, marvinMod , reminderMod, eightBallMod, nobodyisperfectMod, rdfMod, weatherMod, kursMod, kiMod
 
-classes = [ mathMod, commandsMod, identifyMod, badwordsMod, answerMod, logMod, authMod, controlMod, modeMod, marvinMod , reminderMod, eightBallMod, nobodyisperfectMod, rdfMod, weatherMod, kursMod, kiMod ]
+sys.path.append("module")
+classes=[]
+for file in os.listdir("modules"):
+	if len(file)>=3 and file[-3:]==".py":
+		classes.append(__import__("modules/"+file[:-3]))
 
 modchars={'a':'!','o':'@','h':'%','v':'+'}
 modcharvals={'!':4,'@':3,'%':2,'+':1,' ':0}

Deleted: trunk/rdfMod.py
===================================================================
--- trunk/rdfMod.py	2007-06-10 13:19:33 UTC (rev 99)
+++ trunk/rdfMod.py	2007-06-10 14:13:36 UTC (rev 100)
@@ -1,177 +0,0 @@
-# This file is part of OtfBot.
-#
-# OtfBot is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# OtfBot is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with OtfBot; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-# 
-# (c) 2005, 2006 by Alexander Schier
-#
-
-import threading, time
-import chatMod, rdfParser
-
-
-def default_settings():
-	settings={};
-	settings['rdfMod.wait']='5' #XXX: works only global at the moment
-	settings['rdfMod.numRdfs']='0'
-	settings['rdfMod.rdf1']='http://localhost/example.rss'
-	return settings
-		
-class chatMod(threading.Thread):
-	def __init__(self, bot):
-		threading.Thread.__init__(self)
-
-		self.end = 0
-		self.read = {}
-		self.bot = bot
-		self.channel = ""
-		self.logger = self.bot.logging.getLogger("rdfMod")
-		
-		self.wait=60 * float(bot.getConfig("wait", "5", "rdfMod"))
-		self.rdfUrls=[]
-		self.rdfChannels={}
-
-				
-	def run(self):
-		while(not self.end):
-			#splits the waittime, to support stop()
-			#can be at end, too
-			i=0
-			while(not self.end and i<self.wait):
-				time.sleep(10)
-				i+=10
-				
-			if not self.end:
-				for rdfUrl in self.rdfUrls:
-					self.postNews(rdfUrl)
-		self.logger.info("rdfMod: successfully stopped.")
-
-	def postNews(self, rdfUrl):
-		unread =[]
-		#print "rdfMod: checking of", rdfUrl #DEBUG
-		rdf = rdfParser.parse(rdfUrl)
-		#print rdf
-		for key in rdf['links']:
-			if not self.read[rdfUrl].has_key(key):#sort unread
-				unread.append(key) #unread for us
-				self.read[rdfUrl][key] = 1 #but read for all later jobs
-		
-		if len(unread) > 3: #if there are more than three new ones, we only want the newest
-			unread = unread[:3] 
-		#print "rdfMod:", str(len(unread)), "new items" #DEBUG
-		for channel in self.rdfChannels[rdfUrl]:
-			for url in unread:
-				self.bot.sendmsg(channel.encode("UTF-8"), (url+" - "+rdf['elements'][url]).encode("UTF-8"), "UTF-8");
-		unread = []#mark all as read
-		i = 0
-
-	def joined(self, channel):
-		if self.channel == "" and self.bot.getConfig("enabled","False","rdfMod",self.bot.network,channel): #only the first channel
-			self.channel = channel
-
-	def connectionLost(self, reason):
-		self.stop()
-
-	def stop(self):
-		self.logger.info("Got Stop Signal.")
-		self.end=1
-
-	def setLogger(self,logger):
-		self.logger = logger
-	def auth(self, user):
-		"""check the authorisation of the user"""
-		pass
-	def privmsg(self, user, channel, msg):
-		"""a private message received"""
-		pass
-	def msg(self, user, channel, msg):
-		"""message received"""
-		pass
-	def connectionMade(self):
-		"""made connection to server"""
-		bot=self.bot
-		(general, networks, channels)=self.bot.hasConfig("numRdfs", "rdfMod")
-		for (network, channel) in channels:
-			numRdfs=int(bot.getConfig("numRdfs", 0, "rdfMod", network, channel))
-			for num in range(0, numRdfs):
-				rdfUrl=bot.getConfig("rdf"+str(num+1), "", "rdfMod", network, channel)
-				if rdfUrl != "":
-					#self.rdfChannels[rdfUrl]=(network, channel)
-					if(network==self.bot.network):
-						if not rdfUrl in self.rdfChannels.keys():
-							self.rdfChannels[rdfUrl]=[channel]
-						else:
-							self.rdfChannels[rdfUrl].append(channel)
-						if not rdfUrl in self.rdfUrls:
-							self.rdfUrls.append(rdfUrl)
-					
-
-		for rdfUrl in self.rdfUrls: #create emtpy lists
-			self.read[rdfUrl] = {}
-
-		for rdfUrl in self.rdfUrls:
-			#print "rdfMod: initial load of", rdfUrl #DEBUG
-			rdf = rdfParser.parse(rdfUrl)
-			#mark all urls as read on startup
-			#this prevents the bot from printing the newest 3 headlines on join.
-			#if you want to get the 3 headlines, disable this, 
-			#and put the sleep function in run() at end of the loop.
-			for key in rdf['links']:
-				if not self.read[rdfUrl].has_key(key):#sort unread
-					self.read[rdfUrl][key] = 1 #but read for all later jobs
-
-	def signedOn(self):
-		"""successfully signed on"""
-		pass
-	def left(self, channel):
-		"""we have left a channel"""
-		pass
-	def noticed(self, user, channel, msg):
-		"""we got a notice"""
-		pass
-	def action(self, user, channel, message):
-		"""action (/me) received"""
-		pass
-	def modeChanged(self, user, channel, set, modes, args):
-		"""mode changed"""
-		pass
-	def userKicked(self, kickee, channel, kicker, message):
-		"""someone kicked someone else"""
-		pass
-	def userJoined(self, user, channel):
-		"""a user joined the channel"""
-		pass
-	def userJoinedMask(self, user, channel):
-		pass
-	def userLeft(self, user, channel):
-		"""a user left the channel"""
-		pass
-	def userQuit(self, user, quitMessage):
-		"""a user disconnect from the network"""
-		pass
-	def yourHost(self, info):
-		"""info about your host"""
-		pass
-	def userRenamed(self, oldname, newname):
-		"""a user changed the nick"""
-		pass
-	def topicUpdated(self, user, channel, newTopic):
-		"""a user changed the topic of a channel"""
-		pass
-	def irc_unknown(self, prefix, command, params):
-		"""an IRC-Message, which is not handle by twisted was received"""
-		pass
-	def reload(self):
-		"""called to reload the settings of the module"""
-		pass

Deleted: trunk/reminderMod.py
===================================================================
--- trunk/reminderMod.py	2007-06-10 13:19:33 UTC (rev 99)
+++ trunk/reminderMod.py	2007-06-10 14:13:36 UTC (rev 100)
@@ -1,62 +0,0 @@
-# This file is part of OtfBot.
-#
-# OtfBot is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# OtfBot is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with OtfBot; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-# 
-# (c) 2006 by Alexander Schier
-#
-
-import time
-import chatMod
-
-
-def default_settings():
-	settings={};
-	return settings
-		
-class chatMod(chatMod.chatMod):
-	def __init__(self, bot):
-		self.bot=bot
-		self.messages={}
-
-	def remind(self):
-		when=int( (time.time())/60 )
-		messages=[]
-		if self.messages.has_key(when):
-			messages=self.messages[when]
-			del self.messages[when]
-
-		for message in messages:
-			self.bot.sendmsg(message[0], message[1]+": Reminder: "+message[2])
-
-	def msg(self, user, channel, msg):
-		#if channel == self.bot.nickname:
-		#if msg[0]=="!" or msg[:len(self.bot.nickname)]==self.bot.nickname:
-		if msg[0:10]=="!remindme ":
-			user=user.split("!")[0]
-
-			tmp=msg.split(" ", 2)
-			try:
-				wait=int(tmp[1])
-			except ValueError:
-				self.bot.sendmsg(channel, user.split("!")[0]+": invalid number format \""+msg[1]+"\".")
-				return
-			text=str(tmp[2])
-			
-			when=int( (time.time()+wait*60)/60 ) #when will this be executed? (minutes since 1.1.1970 ;-))
-			if self.messages.has_key(when):
-				self.messages[when].append([channel, user, text])
-			else:
-				self.messages[when]=[[channel, user, text]]
-			self.bot.addScheduleJob(wait, self.remind)

Deleted: trunk/weatherMod.py
===================================================================
--- trunk/weatherMod.py	2007-06-10 13:19:33 UTC (rev 99)
+++ trunk/weatherMod.py	2007-06-10 14:13:36 UTC (rev 100)
@@ -1,194 +0,0 @@
-# This file is part of OtfBot.
-# -*- coding: utf-8 -*-
-#
-# OtfBot is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# OtfBot is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with OtfBot; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-# 
-# (c) 2005, 2006 by Alexander Schier
-# (c) 2007 by Robert Weidlich
-#
-
-
-### Parsers ###
-import xml.sax
-import xml.sax.handler
-import urllib
-
-class weatherParserOne(xml.sax.handler.ContentHandler):
-	"""Parses the answer of the CityCode Search"""
-	def __init__(self):
-		self.content = []
-		
-		self.inSearch = 0;
-		self.inLoc = 0;
-		
-		self.currentLoc = -1;
-		self.currentLocText = "";
-
-	def startElement(self, name, attributes):
-		if name == "search":
-			self.inSearch = 1
-		if name == "loc":
-			self.inLoc = 1
-			self.currentLoc += 1
-			self.content.append({'code':attributes.getValue('id')})
-
-
-	def characters(self, data):
-		if self.inSearch:
-			if self.inLoc:
-				self.currentLocText += data
-
-	def endElement(self, name):
-		if name == "search":
-			self.inSearch = 0;
-		if name == "loc":
-			self.content[self.currentLoc]['text'] = self.currentLocText
-			self.currentLocText = ""
-			self.inLoc = 0;
-
-def getLocationCode(location):
-	"""wrapperfunction for the weatherParserOne"""
-	try:
-		parser = xml.sax.make_parser()
-		handler = weatherParserOne()
-		parser.setContentHandler(handler)
-		parser.parse("http://xoap.weather.com/search/search?where="+urllib.quote_plus(location))
-		return handler.content
-	except xml.sax._exceptions.SAXParseException:
-		print "weatherParserOne: Parse Exception"
-		return [{}]
-
-class weatherParserTwo(xml.sax.handler.ContentHandler):
-	"""Parses the actual weatherdata into a dict"""
-	def __init__(self):
-		self.content = {}
-		
-		self.inChannel = 0;
-		self.inItem = 0;
-		self.Item = "";
-		self.inSub = 0;
-		self.Sub = "";
-		
-		self.currentText = "";
-
-	def startElement(self, name, attributes):
-		if name == "channel":
-			self.inChannel = 1
-		if name == "item":
-			self.inItem = 1
-		if name in ["title","description","lastBuildDate","ttl"] and not self.inItem:
-			self.inSub = 1
-			self.Sub = name
-		if name in ["yweather:location", "yweather:units","yweather:wind","yweather:atmosphere","yweather:astronomy","yweather:condition","geo:lat","geo:long"]:
-			vals={}
-			for attr in attributes.getNames():
-				vals[attr]=attributes.getValue(attr)
-			self.content[name.split(":")[1]] = vals
-
-	def characters(self, data):
-		if self.inChannel:
-			if self.inItem:
-				pass
-			if self.inSub:
-				self.currentText += data
-
-	def endElement(self, name):
-		if name == "channel":
-			self.inChannel = 0;
-		if name == "item":
-			self.inItem = 0;
-		if name == self.Sub:
-			self.inSub = 0;
-			self.content[self.Sub] = self.currentText
-			self.currentText = ""
-			self.inSub = 0;
-
-def getWeather(location):
-	"""wrapperfunction for weatherParserTwo"""
-	try:
-		parser = xml.sax.make_parser()
-		handler = weatherParserTwo()
-		parser.setContentHandler(handler)
-		codes = getLocationCode(location)
-		if len(codes) < 1:
-			return []
-		parser.parse("http://xml.weather.yahoo.com/forecastrss/"+str(codes[0]['code'])+"_c.xml")
-		return handler.content
-	except xml.sax._exceptions.SAXParseException:
-		print "weatherParserTwo: Parse Exception"
-		return []
-
-### otfBot-Modulecode ####
-
-import string, re, functions, time
-import chatMod
-
-weathercodes = { 0: "Tornado", 1: "Tropensturm", 2: "Hurrikan", 3: "ernsthafte Gewitter", 
-	4: "Gewitter", 5: "Regen und Schnee", 6: "Regen und Graupelschauer", 
-	7: "Schnee und Graupelschauer", 8: "gefriender Nieselregen", 9: "Nieselregen",
-	10: "gefrierender Regen", 11: "Schauer", 12: "Schauer", 13: "Schneegest\xf6ber",
-	14: "leichte Schneeschauer", 15: "Schneesturm", 16: "Schnee", 17: "Hagel",
-	18: "Graupelschauer", 19: "starker Nebel", 20: "Nebel", 21: "schwacher Nebel",
-	22: "Qualmig", 23: "St\xfcrmisch", 24: "Windig", 25: "Kalt", 26: "Bew\xf6lkt",
-	27: "\xfcberwiegend bew\xf6lkt", 28: "\xfcberwiegend bew\xf6lkt", 29: "Teils bew\xf6lkt",
-	30: "Teils bew\xf6lkt", 31: "Klar", 32: "Sonnig", 33: "Heiter", 34: "Heiter",
-	35: "Regen und Hagel", 36: "Heiss", 37: "vereinzelte Gewitter",
-	38: "verstreute Gewitter", 39: "verstreute Gewitter", 40: "vereinzelte Schauer",
-	41: "starker Schneefall", 42: "vereinzelt Schnee und Regen", 43: "starker Schneefall",
-	44: "teils Bew\xf6lkt", 45: "Gewitter", 46: "Schneeschauer", 47: "vereinzelte Gewitte",
-	3200: "Unbekannt" }
-
-def getDirection(deg):
-	dirs = ["N","NNO","NO","NOO","O","SOO","SO","SSO","S","SSW","SW","SWW","W","NWW","NW","NNW","N"]
-	d=11.25
-	i=0
-	while d < 372:
-		if deg < d:
-			return dirs[i]
-		i += 1
-		d += 22.5
-
-def default_settings():
-	settings={};
-	return settings
-		
-class chatMod(chatMod.chatMod):
-	def __init__(self, bot):
-		self.bot = bot
-		self.time=time.time()
-		self.commands = ["wetter"]
-		
-	def msg(self, user, channel, msg):
-		nick=user.split("!")[0]
-		cmd=msg.split(" ")[0][1:]
-		if cmd in self.commands and ((time.time() - self.time) < 5 and (time.time() - self.time) > 0):
-			self.bot.sendmsg(channel,"Wait a minute ...")
-		elif cmd in self.commands:
-			self.time = time.time()
-			if cmd == "wetter":
-				c = getWeather(" ".join(msg.split(" ")[1:]))
-				if len(c) < 1:
-					self.bot.sendmsg(channel,"Keinen passenden Ort gefunden")
-				else:
-					#self.logger.debug(str(c))
-					answ = "Wetter f\xfcr "+str(c['location']['city'])
-					if len(c['location']['country'])>0: 
-						answ += " ("+str(c['location']['country'])+")"
-					answ += ": "+str(weathercodes[int(c['condition']['code'])])
-					answ += ", "+str(c['condition']['temp'])+"\xb0"+str(c['units']['temperature'])
-					answ += " gef\xfchlt "+str(c['wind']['chill'])+"\xb0"+str(c['units']['temperature'])
-					answ += ", Wind: "+str(c['wind']['speed'])+str(c['units']['speed'])+" aus "+str(getDirection(int(c['wind']['direction'])))
-					answ += ", Luftfeuchte: "+str(c['atmosphere']['humidity'])+"%"
-					self.bot.sendmsg(channel,answ,"UTF-8")




Mehr Informationen über die Mailingliste Otfbot-dev