How To :: Handle Banned Users and Resend Banned Messages
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

How To :: Handle Banned Users and Resend Banned Messages

Started by Corayzon, 12 May, 2004, 05:33:07

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Corayzon

heya guys...just figured something good...dont know y i didnt pick up on it earlier but...

u know when a user is banned from a hub they get the default ban message '<-cSlave-> Your nick is banned!'...

well here is how to handle it so u can add your own ban messages and skip this one...


if strsub(data, 1, 13) == "$ValidateNick" then
	if checkBanned(user.sName, user.sIP) then
		local sReason = getBanReason(user.sName, user.sIP)
		user:SendData(sBot, "*** you were banned from here because: " .. sReason or "none")
		DisconnectByName(user.sName)
		return 1
	end
	return
end

now this isnt a working example but im sure u get the flow...

checkBanned() checks the ban list for the username
getBanReason() gets the extra text added to the ban reason

-=NozaroK=-

kp

might be good for when having a small hub but nothing for big hubs would only use more memory, or if you read from file will always read from disc each time a user that is banned connects.

Corayzon

it also loops twice in this example but anways...

this doesnt work for ip bans due to ptokax seems to check the ban on socket_connect so if it matchs a ip, bang...but for nick bans it also check $ValNick so...

so cant get hold of the process for a ip ban even tring $key, the first thing a client might send...

so this class's it as quiet ineffective unless u want to bother basicly rewriting the perm banning system to accomindate...

one thing i would like to see though, is a empty server, that only has the socket events and the socket class with a main and exit function...

u could then write a application server for anything, i mainly think this cause i like working with lua...

anyways, im lost :P

kp

good to know that ptokax disconnects on socket.
A dc server with minimum of function and maximum of script support, sounds nice indeed.

If you stop using ptokax functions, then actually it only, also checks the $MyINFO if the the first letters from the nick correspond to the curUser.sName and the stats, so it is almost only the server.

As you like LUA a lot you should also check out BCDC++
it is a client that supports lua 5 scripts.

Corayzon

ive heard about bcdc++ but havnt really come across anything to complex about it...i guess i should just download it and see...

anyways...i came across this the other day and have been just writing up mi own little server (but vb syntax suks for handling strings!)...and its helped me alot with when i should be checking what client info and where...

and as u said...checking the info string username matchs the user object username is a good idea =]

http://wza.digitalbrains.com/DC/doc/Command_Types_(client_to_server).html

SMF spam blocked by CleanTalk