From c4dc6fcb0bbd01dfd9ffc572e5bb105dc85e1e4c Mon Sep 17 00:00:00 2001 From: "elly1989@rocketmail.com" Date: Tue, 31 Jul 2012 20:14:21 +0000 Subject: [PATCH] Committing this because I just merged it into Facepunch code for like the 49548083603th time ;_; - Added the ability to ban somebody by IP-address when giving permabans. It's not quite as well done as I'd like it but it works and can be helpful. IP bans are kinda lame so please only use them for multikeyers/extreme-douchebags and such. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4255 316c924e-a436-60f5-8080-3fe189b3f50e --- code/modules/admin/NewBan.dm | 13 +++++++------ code/modules/admin/admin.dm | 7 ++++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/code/modules/admin/NewBan.dm b/code/modules/admin/NewBan.dm index 69252fd637..d9014fad01 100644 --- a/code/modules/admin/NewBan.dm +++ b/code/modules/admin/NewBan.dm @@ -36,10 +36,10 @@ var/savefile/Banlist if(matches) matches += "/" matches += "id" -// if( address == Banlist["ip"] ) -// if(matches) -// matches += "/" -// matches += "ip" + if( address == Banlist["ip"] ) + if(matches) + matches += "/" + matches += "ip" if(matches) if(Banlist["temp"]) @@ -93,7 +93,7 @@ var/savefile/Banlist return 1 -/proc/AddBan(ckey, computerid, reason, bannedby, temp, minutes) +/proc/AddBan(ckey, computerid, reason, bannedby, temp, minutes, address) var/bantimestamp @@ -110,6 +110,7 @@ var/savefile/Banlist Banlist.cd = "/base/[ckey][computerid]" Banlist["key"] << ckey Banlist["id"] << computerid + Banlist["ip"] << address Banlist["reason"] << reason Banlist["bannedby"] << bannedby Banlist["temp"] << temp @@ -140,7 +141,7 @@ var/savefile/Banlist usr.client.holder.DB_ban_unban( ckey(key), BANTYPE_ANY_FULLBAN) for (var/A in Banlist.dir) Banlist.cd = "/base/[A]" - if (key == Banlist["key"] || id == Banlist["id"]) + if (key == Banlist["key"] /*|| id == Banlist["id"]*/) Banlist.cd = "/base" Banlist.dir.Remove(A) continue diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 2bdc81693e..dcdad4f997 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -645,7 +645,12 @@ var/global/BSACooldown = 0 var/reason = input(usr,"Reason?","reason","Griefer") as text|null if(!reason) return - AddBan(M.ckey, M.computer_id, reason, usr.ckey, 0, 0) + switch(alert(usr,"IP ban?",,"Yes","No","Cancel")) + if("Cancel") return + if("Yes") + AddBan(M.ckey, M.computer_id, reason, usr.ckey, 0, 0, M.lastKnownIP) + if("No") + AddBan(M.ckey, M.computer_id, reason, usr.ckey, 0, 0) M << "\redYou have been banned by [usr.client.ckey].\nReason: [reason]." M << "\red This is a permanent ban." if(config.banappeals)