From b2f92cd41544bc005506e0899f5b06913f9c5336 Mon Sep 17 00:00:00 2001 From: FlattestGuitar Date: Fri, 10 Mar 2017 19:42:56 +0100 Subject: [PATCH 1/3] Adds a jobban checking verb. Useful! --- code/modules/admin/banjob.dm | 57 ++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/code/modules/admin/banjob.dm b/code/modules/admin/banjob.dm index f95d5094446..2c984019b41 100644 --- a/code/modules/admin/banjob.dm +++ b/code/modules/admin/banjob.dm @@ -140,3 +140,60 @@ DEBUG jobban_savebanfile() return 1 return 0 + +/mob/verb/displayjobbans() + set category = "OOC" + set name = "Display Current Jobbans" + set desc = "Displays all of your current jobbans." + + if(!client || !ckey) + return + if(config.ban_legacy_system) + if(!ckey in jobban_keylist) + to_chat(src, "You have no active jobbans!") + return + for(var/J in jobban_assoclist[ckey]) + to_chat(src, "[J]: [jobban_assoclist[ckey][J]]") + else + + //permas + var/DBQuery/select_query = dbcon.NewQuery("SELECT bantype, reason, job, a_ckey , bantime FROM [format_table_name("ban")] WHERE ckey like '[ckey]' AND bantype like 'JOB_PERMABAN' AND isnull(unbanned) ORDER BY bantime DESC LIMIT 100") + select_query.Execute() + + var/is_actually_banned = 0 + + while(select_query.NextRow()) + + var/bantype = select_query.item[1] + var/reason = select_query.item[2] + var/job = select_query.item[3] + var/ackey = select_query.item[4] + var/bantime = select_query.item[5] + + if(bantype != null) + is_actually_banned = 1 + + var/output = "[bantype]: [bantime] [job] - [reason] by [ackey]" + to_chat(src, "[output]") + + //temps + select_query = dbcon.NewQuery("SELECT bantime, bantype, reason, job, duration, expiration_time, a_ckey FROM [format_table_name("ban")] WHERE ckey like '[ckey]' AND bantype like 'JOB_TEMPBAN' AND expiration_time > Now() AND isnull(unbanned) ORDER BY bantime DESC LIMIT 100") + select_query.Execute() + + while(select_query.NextRow()) + + var/bantime = select_query.item[1] + var/bantype = select_query.item[2] + var/reason = select_query.item[3] + var/job = select_query.item[4] + var/duration = select_query.item[5] + var/expiration = select_query.item[6] + var/ackey = select_query.item[7] + + if(bantype != null) + is_actually_banned = 1 + + to_chat(src, "[bantype]: [job] - [reason] by [ackey]; [bantime]; [duration]; expires [expiration]") + + if(!is_actually_banned) + to_chat(src, "You have no active jobbans!") From a1830cb8b9c47cea7a95246c920bf1205aefeb7d Mon Sep 17 00:00:00 2001 From: FlattestGuitar Date: Tue, 28 Mar 2017 15:20:12 +0200 Subject: [PATCH 2/3] Formatting tweaks --- code/modules/admin/banjob.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/admin/banjob.dm b/code/modules/admin/banjob.dm index 2c984019b41..bfcfe53eac6 100644 --- a/code/modules/admin/banjob.dm +++ b/code/modules/admin/banjob.dm @@ -173,7 +173,7 @@ DEBUG if(bantype != null) is_actually_banned = 1 - var/output = "[bantype]: [bantime] [job] - [reason] by [ackey]" + var/output = "[bantype]: [bantime] [job] - REASON: [reason], by [ackey]" to_chat(src, "[output]") //temps @@ -193,7 +193,7 @@ DEBUG if(bantype != null) is_actually_banned = 1 - to_chat(src, "[bantype]: [job] - [reason] by [ackey]; [bantime]; [duration]; expires [expiration]") + to_chat(src, "[bantype]: [job] - REASON: [reason], by [ackey]; [bantime]; [duration]; expires [expiration]") if(!is_actually_banned) to_chat(src, "You have no active jobbans!") From a25e3db39afce24de71452979c3d5c69f45ec88e Mon Sep 17 00:00:00 2001 From: FlattestGuitar Date: Tue, 28 Mar 2017 15:39:30 +0200 Subject: [PATCH 3/3] legacy bans, we hardly knew ye --- code/modules/admin/banjob.dm | 47 ++++++++++++------------------------ 1 file changed, 15 insertions(+), 32 deletions(-) diff --git a/code/modules/admin/banjob.dm b/code/modules/admin/banjob.dm index bfcfe53eac6..3dffd403caf 100644 --- a/code/modules/admin/banjob.dm +++ b/code/modules/admin/banjob.dm @@ -149,35 +149,13 @@ DEBUG if(!client || !ckey) return if(config.ban_legacy_system) - if(!ckey in jobban_keylist) - to_chat(src, "You have no active jobbans!") - return - for(var/J in jobban_assoclist[ckey]) - to_chat(src, "[J]: [jobban_assoclist[ckey][J]]") + //using the legacy .txt ban system + to_chat(src, "The server is using the legacy ban system. Ask an administrator for help!") + else - - //permas - var/DBQuery/select_query = dbcon.NewQuery("SELECT bantype, reason, job, a_ckey , bantime FROM [format_table_name("ban")] WHERE ckey like '[ckey]' AND bantype like 'JOB_PERMABAN' AND isnull(unbanned) ORDER BY bantime DESC LIMIT 100") - select_query.Execute() - - var/is_actually_banned = 0 - - while(select_query.NextRow()) - - var/bantype = select_query.item[1] - var/reason = select_query.item[2] - var/job = select_query.item[3] - var/ackey = select_query.item[4] - var/bantime = select_query.item[5] - - if(bantype != null) - is_actually_banned = 1 - - var/output = "[bantype]: [bantime] [job] - REASON: [reason], by [ackey]" - to_chat(src, "[output]") - - //temps - select_query = dbcon.NewQuery("SELECT bantime, bantype, reason, job, duration, expiration_time, a_ckey FROM [format_table_name("ban")] WHERE ckey like '[ckey]' AND bantype like 'JOB_TEMPBAN' AND expiration_time > Now() AND isnull(unbanned) ORDER BY bantime DESC LIMIT 100") + //using the SQL ban system + var/is_actually_banned = FALSE + var/DBQuery/select_query = dbcon.NewQuery("SELECT bantime, bantype, reason, job, duration, expiration_time, a_ckey FROM [format_table_name("ban")] WHERE ckey like '[ckey]' AND ((bantype like 'JOB_TEMPBAN' AND expiration_time > Now()) OR (bantype like 'JOB_PERMABAN')) AND isnull(unbanned) ORDER BY bantime DESC LIMIT 100") select_query.Execute() while(select_query.NextRow()) @@ -190,10 +168,15 @@ DEBUG var/expiration = select_query.item[6] var/ackey = select_query.item[7] - if(bantype != null) - is_actually_banned = 1 + if(bantype == "JOB_PERMABAN") + to_chat(src, "[bantype]: [job] - REASON: [reason], by [ackey]; [bantime]") + else if(bantype == "JOB_TEMPBAN") + to_chat(src, "[bantype]: [job] - REASON: [reason], by [ackey]; [bantime]; [duration]; expires [expiration]") - to_chat(src, "[bantype]: [job] - REASON: [reason], by [ackey]; [bantime]; [duration]; expires [expiration]") + is_actually_banned = TRUE - if(!is_actually_banned) + if(is_actually_banned) + if(config.banappeals) + to_chat(src, "You can appeal the bans at: [config.banappeals]") + else to_chat(src, "You have no active jobbans!")