From 7afd85e3fce1e471316696ff35cc2925c7dbbd31 Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Mon, 1 May 2017 12:47:22 -0500 Subject: [PATCH 1/3] PR announcement spam prevention --- code/world.dm.rej | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 code/world.dm.rej diff --git a/code/world.dm.rej b/code/world.dm.rej new file mode 100644 index 0000000000..70f208ed4d --- /dev/null +++ b/code/world.dm.rej @@ -0,0 +1,10 @@ +diff a/code/world.dm b/code/world.dm (rejected hunks) +@@ -184,7 +184,7 @@ + return + + #define CHAT_PULLR 64 //defined in preferences.dm, but not available here at compilation time +- for(var/client/C in clients) ++ for(var/client/C in GLOB.clients) + if(C.prefs && (C.prefs.chat_toggles & CHAT_PULLR)) + C << "PR: [announcement]" + #undef CHAT_PULLR From 9b3aaa45261a6a3b90ee30d48dbadd82d382511b Mon Sep 17 00:00:00 2001 From: LetterJay Date: Fri, 5 May 2017 09:36:27 -0500 Subject: [PATCH 2/3] merge --- code/world.dm | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/code/world.dm b/code/world.dm index 7af27a1504..4f89299b6f 100644 --- a/code/world.dm +++ b/code/world.dm @@ -136,11 +136,7 @@ if(!key_valid) return "Bad Key" else -#define CHAT_PULLR 64 //defined in preferences.dm, but not available here at compilation time - for(var/client/C in GLOB.clients) - if(C.prefs && (C.prefs.chat_toggles & CHAT_PULLR)) - to_chat(C, "PR: [input["announce"]]") -#undef CHAT_PULLR + AnnouncePR(input["announce"], json_decode(input["payload"])) else if("crossmessage" in input) if(!key_valid) @@ -176,6 +172,25 @@ else if("server_hop" in input) show_server_hop_transfer_screen(input["server_hop"]) +#define PR_ANNOUNCEMENTS_PER_ROUND 5 //The number of unique PR announcements allowed per round + //This makes sure that a single person can only spam 3 reopens and 3 closes before being ignored + +/world/proc/AnnouncePR(announcement, list/payload) + var/static/list/PRcounts = list() //PR id -> number of times announced this round + var/id = "[payload["pull_request"]["id"]]" + if(!PRcounts[id]) + PRcounts[id] = 1 + else + ++PRcounts[id] + if(PRcounts[id] > PR_ANNOUNCEMENTS_PER_ROUND) + return + +#define CHAT_PULLR 64 //defined in preferences.dm, but not available here at compilation time + for(var/client/C in GLOB.clients) + if(C.prefs && (C.prefs.chat_toggles & CHAT_PULLR)) + C << "PR: [announcement]" +#undef CHAT_PULLR + #define WORLD_REBOOT(X) log_world("World rebooted at [time_stamp()]"); ..(X); return; /world/Reboot(var/reason, var/feedback_c, var/feedback_r, var/time) if (reason == 1) //special reboot, do none of the normal stuff From 7fa53c5ce44451fcdacd79632c2416e9dddbaf7c Mon Sep 17 00:00:00 2001 From: kevinz000 Date: Sat, 6 May 2017 21:36:15 -0700 Subject: [PATCH 3/3] Delete world.dm.rej --- code/world.dm.rej | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 code/world.dm.rej diff --git a/code/world.dm.rej b/code/world.dm.rej deleted file mode 100644 index 70f208ed4d..0000000000 --- a/code/world.dm.rej +++ /dev/null @@ -1,10 +0,0 @@ -diff a/code/world.dm b/code/world.dm (rejected hunks) -@@ -184,7 +184,7 @@ - return - - #define CHAT_PULLR 64 //defined in preferences.dm, but not available here at compilation time -- for(var/client/C in clients) -+ for(var/client/C in GLOB.clients) - if(C.prefs && (C.prefs.chat_toggles & CHAT_PULLR)) - C << "PR: [announcement]" - #undef CHAT_PULLR