diff --git a/code/game/socket_talk.dm b/code/game/socket_talk.dm index b6024f3a19..8484b636b8 100644 --- a/code/game/socket_talk.dm +++ b/code/game/socket_talk.dm @@ -23,4 +23,4 @@ return send_raw("type=keepalive") -var/global/datum/socket_talk/socket_talk \ No newline at end of file +var/global/datum/socket_talk/socket_talk diff --git a/code/modules/admin/verbs/adminpm.dm b/code/modules/admin/verbs/adminpm.dm index 8e3f5e29bb..b056218a2e 100644 --- a/code/modules/admin/verbs/adminpm.dm +++ b/code/modules/admin/verbs/adminpm.dm @@ -182,3 +182,26 @@ continue if(X.key!=key && X.key!=C.key && (X.holder.rights & R_ADMIN) || (X.holder.rights & R_MOD) ) X << "PM: [key_name(src, X, 0)]->[key_name(C, X, 0)]: \blue [msg]" //inform X + +/client/proc/cmd_admin_irc_pm() + if(prefs.muted & MUTE_ADMINHELP) + src << "Error: Private-Message: You are unable to use PM-s (muted)." + return + + var/msg = input(src,"Message:", "Private message to admins on IRC") as text|null + sanitize(msg) + + + send2adminirc("PlayerPM from [key_name(src)]: [html_decode(msg)]") + + src << "IRC PM to-IRC-Admins: [msg]" + + log_admin("PM: [key_name(src)]->IRC: [msg]") + for(var/client/X in admins) + if(X == src) + continue + if((X.holder.rights & R_ADMIN) || (X.holder.rights & R_MOD)) + X << "PM: [key_name(src, X, 0)]->IRC-Admins: \blue [msg]" + + + diff --git a/code/modules/client/client defines.dm b/code/modules/client/client defines.dm index c85ee0159c..2a6ef51074 100644 --- a/code/modules/client/client defines.dm +++ b/code/modules/client/client defines.dm @@ -32,6 +32,10 @@ // comment out the line below when debugging locally to enable the options & messages menu //control_freak = 1 + var/received_irc_pm = -99999 + var/irc_admin //IRC admin that spoke with them last. + var/mute_irc = 0 + //////////////////////////////////// //things that require the database// diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index 1d955a9e74..0f8930bb1c 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -45,6 +45,18 @@ cmd_admin_pm(C,null) return + if(href_list["irc_msg"]) + if(!holder && received_irc_pm < world.time - 6000) //Worse they can do is spam IRC for 10 minutes + usr << "You are no longer able to use this, it's been more then 10 minutes since an admin on IRC has responded to you" + return + if(mute_irc) + usr << "" + return + cmd_admin_irc_pm() + return + + + //Logs all hrefs if(config && config.log_hrefs && href_logfile) href_logfile << "[time2text(world.timeofday,"hh:mm")] [src] (usr:[usr]) || [hsrc ? "[hsrc] " : ""][href]
" diff --git a/code/modules/ext_scripts/irc.dm b/code/modules/ext_scripts/irc.dm index fc8910d79f..e145617690 100644 --- a/code/modules/ext_scripts/irc.dm +++ b/code/modules/ext_scripts/irc.dm @@ -26,3 +26,4 @@ /hook/startup/proc/ircNotify() send2mainirc("Server starting up on [config.server? "byond://[config.server]" : "byond://[world.address]:[world.port]"]") return 1 + diff --git a/code/world.dm b/code/world.dm index 4793e47c16..c402ebfc1e 100644 --- a/code/world.dm +++ b/code/world.dm @@ -109,6 +109,47 @@ return list2params(s) + else if(copytext(T,1,9) == "adminmsg") + /* + We got an adminmsg from IRC bot lets split the input then validate the input. + expected output: + 1. adminmsg = ckey of person the message is to + 2. msg = contents of message, parems2list requires + 3. validatationkey = the key the bot has, it should match the gameservers commspassword in it's configuration. + 4. sender = the ircnick that send the message. + */ + + var/input[] = params2list(T) + if(input["key"] != config.comms_password) + return "Bad Key" + + var/client/C + + for(var/client/K in clients) + if(K.ckey == input["adminmsg"]) + C = K + break + if(!C) + return "No client with that name on server" + + var/message = "IRC-Admin PM from [C.holder ? "IRC-" + input["sender"] : "Administrator"]: [input["msg"]]" + var/amessage = "IRC-Admin PM from IRC-[input["sender"]] to [key_name(C)] : [input["msg"]]" + + C.received_irc_pm = world.time + C.irc_admin = input["sender"] + + C << 'sound/effects/adminhelp.ogg' + C << message + + + for(var/client/A in admins) + if(A != C) + A << amessage + + return "Message Successful" + + + /world/Reboot(var/reason) /*spawn(0)