PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: Ubikk on 07 August, 2005, 17:57:53

Title: tempban with reason script
Post by: Ubikk on 07 August, 2005, 17:57:53
Right now if I tempban a user like this:

Quote!tempban testuser 2h because this_is_a_test
[/size]

the message this_is_a_test
will ony be displayed once like this:

Quote[15:11] You had been temp banned to: 2 min because: test
[15:11] *** Disconnected
[15:12] *** Connecting to 192.168.240.31...
[15:12] *** Connected
[15:12] You are temporarily banned for 2 min!
[15:12] *** Disconnected
[15:12] *** Connecting to 192.168.240.31...
[15:12] *** Connected
[15:12] You are temporarily banned for 2 min!
[15:12] *** Disconnected
[15:12] *** Connecting to 192.168.240.31...
[15:12] *** Connected
[15:12] You are temporarily banned for 2 min!
[15:12] *** Disconnected
[/size]

is it possible to show the ban message each time the user tries to connect?

.. something like this:

Quote[15:12] *** Connected
[15:12] You are temporarily banned for hr : mins , by user for this reason: Reason would be entered here (if given)
[/size]

Thanks in advance :)
Title:
Post by: bastya_elvtars on 08 August, 2005, 00:02:34
Either the XML files need update, or (and this is better) the whole ban thing should be stored in a database either standalone, or compiled into PtokaX). Scripted solution would kill the hub, since it should run through the banlist every minute to check whether the ban has expired. Imagine a banlist with 1000 people.
Title:
Post by: Madman on 08 August, 2005, 06:13:08
QuoteOriginally posted by bastya_elvtars
Scripted solution would kill the hub, since it should run through the banlist every minute to check whether the ban has expired. Imagine a banlist with 1000 people.
Would it?
Cant GetTempBannedItemTime(IP) be used for that?
Use Serialize to create a file...with needed info...
In NewUserConnected, check if tempbanned, and then read from file for op and reason and use GetTempBannedItemTime(IP) to get the time?
Title:
Post by: Ubikk on 08 August, 2005, 13:14:00
My hub is very small... i only have one or two bans in my list ;)
Title:
Post by: bastya_elvtars on 09 August, 2005, 00:13:05
"Cant GetTempBannedItemTime(IP) be used for that?
Use Serialize to create a file...with needed info...
In NewUserConnected, check if tempbanned, and then read from file for op and reason and use GetTempBannedItemTime(IP) to get the time?"

But what about banlist clearing after a loooooooong hub downtime?
Title:
Post by: bastya_elvtars on 09 August, 2005, 11:17:28
But as tempban is parsed before user starts to log in, if an user is banned, there is no user object created.
Title:
Post by: Dessamator on 09 August, 2005, 11:23:27
well u can use SupportsArrival.

btw heres a nice way to find out which arrivals are used when a user tries to login , and the order in which they are processed :

-- ParseArrivals by Dessamator
t ={}

function SupportsArrival(User, Data)
table.insert(t,{os.clock(),"SupportsArrival"})
end

function KeyArrival(User, Data)
table.insert(t,{os.clock(),"KeyArrival"})

end

function ValidateNickArrival(User, Data)
table.insert(t,{os.clock(),"ValidateNickArrival"})
end

function PasswordArrival(User, Data)
table.insert(t,{os.clock(),"PasswordArrival"})
end

function VersionArrival(User, Data)
table.insert(t,{os.clock(),"VersionArrival"})
end

function GetNickListArrival(User, Data)
table.insert(t,{os.clock(),"GetNickListArrival"})
end

function MyINFOArrival(User, Data)
table.insert(t,{os.clock(),"MyINFOArrival"})
end

function GetINFOArrival(User, Data)
table.insert(t,{os.clock(),"GetINFOArrival"})
end

function UserIPArrival(User, Data)
table.insert(t,{os.clock(),"UserIPArrival"})
end

function UnknownArrival(User, Data)
table.insert(t,{os.clock(),"UnknownArrival"})
end

function NewUserConnected(User,Data)
table.insert(t,{os.clock(),"NewUserConnected"})
end

function OpConnected(User,data)
table.insert(t,{os.clock(),"OPConnected"})
end

function SearchArrival(User, Data)
table.insert(t,{os.clock(),"SearchArrival"})
end

function SRArrival(User, Data)
table.insert(t,{os.clock(),"Search Responce Arrival"})
end

function ChatArrival(user,data)
data=string.sub(data,1,-2)
local s,e,cmd = string.find(data,"%b<>%s+(%S+)")
local temp ="\r\n"

if cmd=="!view" then
table.sort(t, function(a, b) return (a[1] < b[1]) end)
for i in ipairs(t) do
temp=temp.."Time taken : "..t[i][1].."  --> Name : "..t[i][2].."\r\n"
end
t =nil
t ={}
user:SendData(temp)
return 1
end
end

Title:
Post by: bastya_elvtars on 09 August, 2005, 11:59:41
Easier to view the PtokaX CMDs window. :P
However $Supports cannot be discarded anyway, and therefore it's stil processed by PtokaX. It needs a database, making it easier to process banned users and to store more information. This is something that should not be done by script.
Title:
Post by: Dessamator on 09 August, 2005, 12:35:52
Indeed, but the cmd in ptokax is a bit confusing, that script simplifies it by only showing the arrival which was used, either way it was written for a previous version of ptokax.
But i do agree with you, a database is needed !