[pybot-commits] CVS: pybot/scripts pybotsetup.py,1.3,1.4
Brought to you by:
niemeyer
From: Gustavo N. <nie...@us...> - 2002-06-20 01:17:54
|
Update of /cvsroot/pybot/pybot/scripts In directory usw-pr-cvs1:/tmp/cvs-serv15052/scripts Modified Files: pybotsetup.py Log Message: - Improved permission module a lot; - Included help system; - Changed admin permission handling (WARNING!!! Don't merge this patch if you don't know what it means!) Index: pybotsetup.py =================================================================== RCS file: /cvsroot/pybot/pybot/scripts/pybotsetup.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pybotsetup.py 3 Apr 2002 22:29:51 -0000 1.3 --- pybotsetup.py 20 Jun 2002 01:17:48 -0000 1.4 *************** *** 25,41 **** import time import cPickle if os.path.isfile("options"): - sys.exit("You already have an options file!") - # For the future: file = open("options") option = cPickle.load(file) ! file.close() else: option = {} - if os.path.isdir("pybot"): - sys.path.append(".") - from pybot.user import User --- 25,40 ---- import time import cPickle + import shutil + + if os.path.isdir("pybot"): + sys.path.append(".") if os.path.isfile("options"): file = open("options") option = cPickle.load(file) ! file.close() else: option = {} from pybot.user import User *************** *** 43,50 **** print """ This program does the basic setup for pybot. It will allow you to ! set the first nick, username and server you want pybot to connect, ! and also who you are (supposing you're the one who pybot will obey ! to). Further setup (including connecting to other servers and ! setting new masters) may be done talking with him, after connected. You may also use it to recover a previous setup. You may need to --- 42,48 ---- print """ This program does the basic setup for pybot. It will allow you to ! set the first nick, username and server you want pybot to connect. ! Further setup (including setting administrators and connecting to ! channels and servers) may be done by talking with him, after connected. You may also use it to recover a previous setup. You may need to *************** *** 57,78 **** print """ - Enter the nick you're going to use while talking to pybot.""" - nick = raw_input("Your nick: ") - - print """Enter the username you're going to use while talking to pybot. - Please, note that you may have a '~' added to your username, depending on - your host's configuration. If you want to be sure what your username is, - issue a '/whois %s' while connected to your irc server. You may also - use a wildcard, like *username, if you're not sure at all."""%nick - username = raw_input("Your username: ") - - print """ - Enter the hostname you're going to use while talking to pybot. - If you're not sure, you should also look at the output of the command - '/whois %s' while connected to your irc server. A wildcard like - *.my.host also work here, but be careful!"""%nick - hostname = raw_input("Your host: ") - - print """ Enter the server name:port where pybot will connect to. This is just to start it out. You may add and/or remove servers later talking --- 55,58 ---- *************** *** 96,108 **** sys.exit("Interrupted!") ! option["Permission.gosh"] = [User(nick, username, hostname)] ! option["ServerControl.servers"] = {server:[pybotnick, pybotusername, "0", pybotrealname, {}]} ! option["ModuleControl.modules"] = ["servercontrol", "pong", "permission", "help", "social"] file = open("options", "w") option = cPickle.dump(option,file,1) file.close() ! print "Options saved!" # vim:ts=4:sw=4:et --- 76,101 ---- sys.exit("Interrupted!") ! if option["Permission.perm"].has_key("admin"): ! del option["Permission.perm"]["admin"] ! #option["ServerControl.servers"] = {server:[pybotnick, pybotusername, "0", pybotrealname, {}]} ! #option["ModuleControl.modules"] = ["servercontrol", "pong", "permission", "help", "social"] + # Clean old permission system + if option.has_key("Permission.gosh"): + del option["Permission.gosh"] + + if os.path.isfile("options"): + shutil.copyfile("options", "options.old") file = open("options", "w") option = cPickle.dump(option,file,1) file.close() ! print """ ! Options saved! ! ! WARNING: As soon as your bot connects to the new server, you must set ! the "admin" permission, otherwise your bot will be free to hack by ! anyone. To understand how to do this, ask the bot "help permissions". ! """ # vim:ts=4:sw=4:et |