From 9a5a1dc82c5610ef20e39d66cc182070aa85b7a8 Mon Sep 17 00:00:00 2001 From: Mloc-Argent Date: Mon, 5 Aug 2013 14:07:06 +0100 Subject: [PATCH 1/2] Made IRCbot's password and host a config option. Added a hook to send a message to the bot when a round starts. Signed-off-by: Mloc-Argent --- code/controllers/configuration.dm | 9 +++++++++ code/modules/ext_scripts/irc.dm | 14 +++++++------- code/modules/ext_scripts/python.dm | 2 +- code/world.dm | 2 ++ config/config.txt | 10 ++++++++-- scripts/ircbot_message.py | 10 +++++----- 6 files changed, 32 insertions(+), 15 deletions(-) diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index d0a60a08162..a22c9eec5f1 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 bc4774af115..f4e94f3ffc4 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 a6e578635d3..9b798d80cae 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 502d25d1905..8d811e8ea46 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 65ea61919e4..6538a9edbfb 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 b2b8a02f1ba..95673c62f44 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) From e969345a6e497f22965f55b17ebcf05bd9ecf5be Mon Sep 17 00:00:00 2001 From: Mloc-Argent Date: Mon, 5 Aug 2013 14:41:33 +0100 Subject: [PATCH 2/2] Fixed farwa lying down state. Signed-off-by: Mloc-Argent --- icons/mob/monkey.dmi | Bin 28385 -> 28385 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/icons/mob/monkey.dmi b/icons/mob/monkey.dmi index 30a7bdb3c575bcef8ff4dee85494987d0496bc2f..82262675d4bddc28909487bc52fffd0b0f079800 100644 GIT binary patch delta 525 zcmV+o0`mRg-2vg<0gyU>v2NQi5Qb;zDTriEib&1SMN8nI@Q}QMaVAeBBZ?GADysAJ z9c{RW_m#KkKqEXtl}v zhm;|sXvAF~e22U0t}K*|Ni^cQEZPV?CeeuMl6yLF)&DsIUdge4ZE537)}&KI+Vqe* zQaOXPa(f~C7Nd1NPuDYbmvO(v7^@qcs>HUg_`nd=6S delta 525 zcmV+o0`mRg-2vg<0gyU>!EW0y3_#EJR|xI39cr(KU3@803^}yF5HJ!gsg@-}lIx{k zzeD0=3FeYP;FE#JXOW^P-;0;m-|Kg=dRv#D7?TZNG~)TkQ&~(_Wg{B#vn~sRR-3$k zNf|PVM%?wmcetzW%0k(gL?fQdqK(jF5{;-Xxu+9X{hu@7l^olDmNw30O*%ECO%JIf zl`}{yw->^1FgoqLY< zX-FGznbn8jGF?jP!sJPvbYb$0eX%{#=h*g)Elv|GWLcMmLI*q1i29*Ek67?7g-ENz zLh`>(A=Sg#a}mCO@JVib+tS6iI&g-Rv>M`#`9QoiBZ$nLAhNOwlOt_ma*XCgWhKzE z14j#6kZ4A&Fcs>HUg_`qqqiQ