Level-based Ban Protection

Platform:  mIRC
Published  Nov 26, 2011
Updated  Nov 26, 2011
I'm trying to work on this ban protection for my bot. The problem is, I can't get the script to work with wildcard matches. The bot only protects users that have access to the bot, but these users are only protected if a ban on channel is set specific to the hostmask of the user in Users.ini. I'd like some assisstance in modifying this script so that a bot user banned using any type of $address is protected.

Any help is greatly appreciated! ON *:BAN:*:{
if ($level($banmask) == 100 && $level($nick) != 100) {
mode $chan -b $banmask
}
}

Comments

Sign in to comment.
Jethro   -  Nov 28, 2011
Yeah, it didn't cross my mind to consider a code that way. Thank you.

I do know that $banmask by itself is wildcard prone. jaytea's example above should get the job done right.
 Respond  
jaytea   -  Nov 28, 2011
the problem is that 'if ($banmask iswm $ialchan($ulist(*,100,%?),#,1))' is only checking the banmask against the first matching address in the channel, when there could of course be several matching addresses.

the overall method, "for each level 100 address, check if it matches a user in the channel who is affected by the ban", is not efficient in general. a better method can be described as "for each person affected by the ban, check if they are matched by any level 100 address":

Code
 
 Respond  
LuminolBlue   -  Nov 27, 2011
Okay, thank you for all your help. I greatly appreciate it. I'll see if I can play around with it a little and get it to work how I want. :-)
 Respond  
Jethro   -  Nov 27, 2011
I have an idea. This may prevail to accomplish the wildcard match:
Code
 
You basically add the keyword of any variation of the wildcard addresses as shown under the rawmode event, divided with a pipe for each one. If the ban mask consists of the keyword, the script will then remove the ban for you.
 Respond  
Jethro   -  Nov 27, 2011
I'm not sure what can be done about that. The $ialchan() identifier will match mIRC's internal address list, which is merely able to identify nine address types stated above.
 Respond  
LuminolBlue   -  Nov 27, 2011
I would have thought "iswm" would do the trick since both "*!ident@*.isp.com" and "*!ident@*.some.weird.name.isp.com" are valid banmasks. The hash tables idea is great, but not practical because at this rate, I'll be adding variations of valid banmasks such as the ones above all day. There are at least 15 authorized users in my bot. :-)
 Respond  
Jethro   -  Nov 26, 2011
What I can think of at this moment is include an additional feature to add protected addresses in a hash table, along with the rawmode event to catch the wildcard match like so:
Code
 
To add those wildcard addresses, use:
Code
 
 Respond  
Jethro   -  Nov 26, 2011
The script will only recognize these ban types:
Code
 
 Respond  
LuminolBlue   -  Nov 26, 2011
Jethro: Sorry to trouble you, but I'm still running into a bit of a problem. - Using revised code.

The ban gets removed if set like this:
10:44pm * Mode Set: (new-nick123/#LuminolBlue) +b *!*@clue-306FE3BC.cpe.net.cable.rogers.com
10:44pm * Mode Set: (Cat/#LuminolBlue) -b *!*@clue-306FE3BC.cpe.net.cable.rogers.com

But it doesn't get removed if set like this:
10:46pm -!- Mode Set: (new-nick123/#LuminolBlue) +b *!cDn@*.cpe.net.cable.rogers.com
10:46pm -!- Mode Set: (new-nick123/#LuminolBlue) +b *!cDn@*.rogers.com

Or any other format for that matter.

Thanks for your continued help!
 Respond  
FordLawnmower   -  Nov 26, 2011
<>/<>><>/>
 Respond  
Jethro   -  Nov 26, 2011
My error. This one is tested should do it:
Code
 
 Respond  
LuminolBlue   -  Nov 26, 2011
Hmmm... doesn't seem to be working at all.

8:07pm -!- Mode Set: ┬źnew-nick123/#LuminolBlue┬╗ +b *!cDn@*.rogers.com

And my bot doesn't remove the ban like he's supposed to because I am level 100. Levels in my bot are entered like this: 100:Nick!*@*.isp.com. Perhaps this will help?
 Respond  
LuminolBlue   -  Nov 26, 2011
Thank you so much, Jethro. I greatly appreciate your help!
 Respond  
Jethro   -  Nov 26, 2011
Code
 
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.