diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index d0a60a0816..a22c9eec5f 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -118,7 +118,10 @@ var/gateway_delay = 18000 //How long the gateway takes before it activates. Default is half an hour. var/ghost_interaction = 0 + var/comms_password = "" + var/use_irc_bot = 0 + var/irc_bot_host = "" var/main_irc = "" var/admin_irc = "" var/python_path = "" //Path to the python executable. Defaults to "python" on windows and "/usr/bin/env python2" on unix @@ -407,6 +410,12 @@ if("ghost_interaction") config.ghost_interaction = 1 + if("comms_password") + config.comms_password = value + + if("irc_bot_host") + config.irc_bot_host = value + if("main_irc") config.main_irc = value diff --git a/code/modules/ext_scripts/irc.dm b/code/modules/ext_scripts/irc.dm index bc4774af11..f4e94f3ffc 100644 --- a/code/modules/ext_scripts/irc.dm +++ b/code/modules/ext_scripts/irc.dm @@ -1,14 +1,14 @@ /proc/send2irc(var/channel, var/msg) - if(config.use_irc_bot) - ext_python("ircbot_message.py", "[channel] [msg]") + if(config.use_irc_bot && config.irc_bot_host) + ext_python("ircbot_message.py", "[config.comms_password] [config.irc_bot_host] [channel] [msg]") return /proc/send2mainirc(var/msg) - if(config.use_irc_bot && config.main_irc) - ext_python("ircbot_message.py", "[config.main_irc] [msg]") + if(config.use_irc_bot && config.main_irc && config.irc_bot_host) + ext_python("ircbot_message.py", "[config.comms_password] [config.irc_bot_host] [config.main_irc] [msg]") return /proc/send2adminirc(var/msg) - if(config.use_irc_bot && config.admin_irc) - ext_python("ircbot_message.py", "[config.admin_irc] [msg]") - return \ No newline at end of file + if(config.use_irc_bot && config.admin_irc && config.irc_bot_host) + ext_python("ircbot_message.py", "[config.comms_password] [config.irc_bot_host] [config.admin_irc] [msg]") + return diff --git a/code/modules/ext_scripts/python.dm b/code/modules/ext_scripts/python.dm index a6e578635d..9b798d80ca 100644 --- a/code/modules/ext_scripts/python.dm +++ b/code/modules/ext_scripts/python.dm @@ -6,4 +6,4 @@ var/command = config.python_path + " " + script + " " + args - return shell(command) \ No newline at end of file + return shell(command) diff --git a/code/world.dm b/code/world.dm index 502d25d190..8d811e8ea4 100644 --- a/code/world.dm +++ b/code/world.dm @@ -82,6 +82,8 @@ sleep_offline = 1 + send2mainirc("Server starting up on [config.server? "byond://[config.server]" : "byond://[world.address]:[world.port]"]") + master_controller = new /datum/controller/game_controller() spawn(1) master_controller.setup() diff --git a/config/config.txt b/config/config.txt index 65ea61919e..6538a9edbf 100644 --- a/config/config.txt +++ b/config/config.txt @@ -211,15 +211,21 @@ USEALIENWHITELIST ##Remove the # to let ghosts spin chairs #GHOST_INTERACTION +## Password used for authorizing ircbot and other external tools. +#COMMS_PASSWORD + ## Uncomment to enable sending data to the IRC bot. #USE_IRC_BOT +## Host where the IRC bot is hosted. Port 45678 needs to be open. +#IRC_BOT_HOST localhost + ## IRC channel to send information to. Leave blank to disable. #MAIN_IRC #main ## IRC channel to send adminhelps to. Leave blank to disable adminhelps-to-irc. #ADMIN_IRC #admin -## Path to the python executable on the system. Leave blank for default. +## Path to the python2 executable on the system. Leave blank for default. ## Default is "python" on Windows, "/usr/bin/env python2" on UNIX. -PYTHON_PATH +#PYTHON_PATH diff --git a/scripts/ircbot_message.py b/scripts/ircbot_message.py index b2b8a02f1b..95673c62f4 100644 --- a/scripts/ircbot_message.py +++ b/scripts/ircbot_message.py @@ -6,18 +6,18 @@ import sys,cPickle,socket def pack(): - ip = sys.argv[1] + passwd = sys.argv[1] + ip = sys.argv[3] try: - data = sys.argv[2:] #The rest of the arguments is data + data = sys.argv[4:] #The rest of the arguments is data except: data = "NO DATA SPECIFIED" - dictionary = {"ip":ip,"data":["PASSWORD"] + data} + dictionary = {"ip":ip,"data":[passwd] + data} pickled = cPickle.dumps(dictionary) nudge(pickled) def nudge(data): - HOST = "IRCBOT IP" + HOST = sys.argv[2] PORT = 45678 - size = 1024 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST,PORT)) s.send(data)