diff --git a/code/modules/admin/player_notes.dm b/code/modules/admin/player_notes.dm index dd0f69b8f3e..3a74da5fca6 100644 --- a/code/modules/admin/player_notes.dm +++ b/code/modules/admin/player_notes.dm @@ -152,3 +152,16 @@ datum/admins/proc/notes_gethtml(var/ckey) log_admin("[key_name(usr)] deleted one of [key]'s notes.") del info + +/proc/show_player_info_irc(var/key as text) + var/dat = " Info on [key]%0D%0A" + var/savefile/info = new("data/player_saves/[copytext(key, 1, 2)]/[key]/info.sav") + var/list/infos + info >> infos + if(!infos) + dat = "No information found on the given key." + else + for(var/datum/player_info/I in infos) + dat += "[I.content]%0D%0Aby [I.author] ([I.rank]) on [I.timestamp]%0D%0A%0D%0A" + + return dat diff --git a/code/world.dm b/code/world.dm index 44927ba7797..c79759843a5 100644 --- a/code/world.dm +++ b/code/world.dm @@ -66,9 +66,12 @@ // world << "End of Topic() call." // ..() +var/world_topic_spam_protect_ip = "0.0.0.0" +var/world_topic_spam_protect_time = world.timeofday + /world/Topic(T, addr, master, key) diary << "TOPIC: \"[T]\", from:[addr], master:[master], key:[key][log_end]" - + if (T == "ping") var/x = 1 for (var/client/C) @@ -120,8 +123,18 @@ 4. sender = the ircnick that send the message. */ + var/input[] = params2list(T) if(input["key"] != config.comms_password) + if(world_topic_spam_protect_ip == addr && abs(world_topic_spam_protect_time - world.time) < 50) + + spawn(50) + world_topic_spam_protect_time = world.time + return "Bad Key (Throttled)" + + world_topic_spam_protect_time = world.time + world_topic_spam_protect_ip = addr + return "Bad Key" var/client/C @@ -149,6 +162,28 @@ return "Message Successful" + else if(copytext(T,1,6) == "notes") + /* + We got a request for notes from the IRC Bot + expected output: + 1. notes = ckey of person the notes lookup is for + 2. validationkey = the key the bot has, it should match the gameservers commspassword in it's configuration. + */ + var/input[] = params2list(T) + if(input["key"] != config.comms_password) + if(world_topic_spam_protect_ip == addr && abs(world_topic_spam_protect_time - world.time) < 50) + + spawn(50) + world_topic_spam_protect_time = world.time + return "Bad Key (Throttled)" + + world_topic_spam_protect_time = world.time + world_topic_spam_protect_ip = addr + return "Bad Key" + + return show_player_info_irc(input["notes"]) + +