TG: Ban moved into IsBanned so that people whom are banned can actually see -why-

they are banned. Another perk of using IsBanned and not client/New() is that we
now disconnect potential clients before they are given a client object and start
downloading any resources...which is like a 30Mb saving per failed login (after
each server update).

Tidied up the Login and Logout procs for mobs. Moved the sandbox buildmode stuff
to mob/living/login.dm so you shouldn't have to log-out and back in to enable
build mode.

Removed the logged_in variable for mobs as it was the most pointless thing ever.

Made the multikeying checks a separate proc. People are checked the second they
get a new_player mob. Its notices are also less spammy.

Changed AllowUpload from the default. It now restricts uploads of over 1Mb to
prevent admins uploading massive .Oggs and lagging the server to hell whilst it
sends the ogg to 40+ players. Feel free to change the limit.

Moved some of the core client procs into one folder; they should really be
together and not in /modules/mob/mob.dm and various other places. I will be
giving the client stuff a belated spring-clean over the next few commits, just
got to iron out some of the kinks.
Revision: r3694
Author: 	 elly1...@rocketmail.com
This commit is contained in:
Erthilo
2012-06-03 01:09:26 +01:00
parent 813d43e1d5
commit 86feaac9c2
19 changed files with 761 additions and 717 deletions

View File

@@ -0,0 +1,19 @@
//Blocks an attempt to connect before even creating our client datum thing.
world/IsBanned(key,address,computer_id)
if(ckey(key) in admins)
return ..()
//Guest Checking
if( !guests_allowed && IsGuestKey(key) )
log_access("Failed Login: [key] - Guests not allowed")
message_admins("\blue Failed Login: [key] - Guests not allowed")
return list("reason"="guest", "desc"="\nReason: Guests not allowed.brb")
//Ban Checking
. = CheckBan( ckey(key), computer_id, address )
if(.)
log_access("Failed Login: [key] [computer_id] [address] - Banned [.["reason"]]")
message_admins("\blue Failed Login: [key] id:[computer_id] ip:[address] - Banned [.["reason"]]")
return .
return ..() //default pager ban stuff

View File

@@ -1,86 +1,82 @@
var/CMinutes = null
var/savefile/Banlist
/proc/LoadBans()
Banlist = new("data/banlist.bdb")
log_admin("Loading banlist.")
if (!length(Banlist.dir)) log_admin("Banlist is empty.")
if (!Banlist.dir.Find("base"))
log_admin("Banlist missing base dir.")
Banlist.dir.Add("base")
Banlist.cd = "/base"
ClearTempbans()
return 1
/proc/CheckBan(var/client/clientvar)
var/id = clientvar.computer_id
var/key = clientvar.ckey
/proc/CheckBan(var/ckey, var/id, var/address)
if(!Banlist) // if Banlist cannot be located for some reason
LoadBans() // try to load the bans
if(!Banlist) // uh oh, can't find bans!
return 0 // ABORT ABORT ABORT
. = list()
var/appeal
if(config && config.banappeals)
appeal = "\nFor more information on your ban, or to appeal, head to <a href='[config.banappeals]'>[config.banappeals]</a>"
Banlist.cd = "/base"
if (Banlist.dir.Find("[key][id]"))
Banlist.cd = "[key][id]"
if( "[ckey][id]" in Banlist.dir )
Banlist.cd = "[ckey][id]"
if (Banlist["temp"])
if (!GetBanExp(Banlist["minutes"]))
ClearTempbans()
return 0
else
log_access("Failed Login: [clientvar] - Banned")
message_admins("\blue Failed Login: [clientvar] - Banned")
alert(clientvar,"You have been banned.\nReason : [Banlist["reason"]]\n(This ban will be automatically removed in [GetBanExp(Banlist["minutes"])].)[config.appeal_address ? "\nYou may try to appeal this at [config.appeal_address]" : ""]","Ban","Ok")
return 1
.["desc"] = "\nReason: [Banlist["reason"]]\nExpires: [GetBanExp(Banlist["minutes"])]\nBy: [Banlist["bannedby"]][appeal]"
else
Banlist.cd = "/base/[key][id]"
log_access("Failed Login: [clientvar] - Banned")
message_admins("\blue Failed Login: [clientvar] - Banned")
alert(clientvar,"You have been banned.\nReason : [Banlist["reason"]]\n(This is a permanent ban.)[config.appeal_address ? "\nYou may try to appeal this at [config.appeal_address]" : ""]","Ban","Ok")
return 1
Banlist.cd = "/base/[ckey][id]"
.["desc"] = "\nReason: [Banlist["reason"]]\nExpires: <B>PERMENANT</B>\nBy: [Banlist["bannedby"]][appeal]"
.["reason"] = "ckey/id"
return .
else
for (var/A in Banlist.dir)
Banlist.cd = "/base/[A]"
var/matches
if( ckey == Banlist["key"] )
matches += "ckey"
if( id == Banlist["id"] && Banlist["skipIdCheck"] == 0)
if(matches)
matches += "/"
matches += "id"
// if( address == Banlist["ip"] )
// if(matches)
// matches += "/"
// matches += "ip"
Banlist.cd = "/base"
for (var/A in Banlist.dir)
Banlist.cd = "/base/[A]"
if ( key == Banlist["key"] || (id == Banlist["id"] && Banlist["skipIdCheck"] == 0) )
if(Banlist["temp"])
if (!GetBanExp(Banlist["minutes"]))
ClearTempbans()
return 0
else
if(key != Banlist["key"])
log_access("Failed Login: [clientvar] - Banned as [Banlist["key"]]")
message_admins("\blue Failed Login: [clientvar] - Banned as [Banlist["key"]]")
if(matches)
if(Banlist["temp"])
if (!GetBanExp(Banlist["minutes"]))
ClearTempbans()
return 0
else
log_access("Failed Login: [clientvar] - Banned")
message_admins("\blue Failed Login: [clientvar] - Banned")
alert(clientvar,"You have been banned.\nReason : [Banlist["reason"]]\n(This ban will be automatically removed in [GetBanExp(Banlist["minutes"])].)[config.appeal_address ? "\nYou may try to appeal this at [config.appeal_address]" : ""]","Ban","Ok")
return 1
else
if(key != Banlist["key"])
log_access("Failed Login: [clientvar] - Banned as [Banlist["key"]]")
message_admins("\blue Failed Login: [clientvar] - Banned as [Banlist["key"]]")
.["desc"] = "\nReason: [Banlist["reason"]]\nExpires: [GetBanExp(Banlist["minutes"])]\nBy: [Banlist["bannedby"]][appeal]"
else
log_access("Failed Login: [clientvar] - Banned")
message_admins("\blue Failed Login: [clientvar] - Banned")
alert(clientvar,"You have been banned.\nReason : [Banlist["reason"]]\n(This is a permanent ban.)[config.appeal_address ? "\nYou may try to appeal this at [config.appeal_address]" : ""]","Ban","Ok")
return 1
.["desc"] = "\nReason: [Banlist["reason"]]\nExpires: <B>PERMENANT</B>\nBy: [Banlist["bannedby"]][appeal]"
.["reason"] = matches
return .
return 0
/proc/UpdateTime()
/proc/UpdateTime() //No idea why i made this a proc.
CMinutes = (world.realtime / 10) / 60
return 1
/proc/LoadBans()
Banlist = new("data/banlist.bdb")
log_admin("Loading Banlist")
if (!length(Banlist.dir)) log_admin("Banlist is empty.")
if (!Banlist.dir.Find("base"))
log_admin("Banlist missing base dir.")
Banlist.dir.Add("base")
Banlist.cd = "/base"
else if (Banlist.dir.Find("base"))
Banlist.cd = "/base"
ClearTempbans()
return 1
/proc/ClearTempbans()
UpdateTime()
@@ -171,6 +167,7 @@ var/savefile/Banlist
/obj/admins/proc/unbanpanel()
var/count = 0
var/dat
//var/dat = "<HR><B>Unban Player:</B> \blue(U) = Unban , (E) = Edit Ban\green (Total<HR><table border=1 rules=all frame=void cellspacing=0 cellpadding=3 >"
Banlist.cd = "/base"
for (var/A in Banlist.dir)
count++