| View previous topic :: View next topic |
| Author |
Message |
i.m.offline Halfop
Joined: 02 Mar 2006 Posts: 74
|
Posted: Fri Mar 03, 2006 5:32 am Post subject: Some Addition for +enforcebans |
|
|
I have a code for enforce ban (I want to use this instead of +enforcebans, as I want to show own kick msg etc).
I would request if some one can make it little more protected, i.e. it shouldn't kick if the ban mask is *!*@* & if ban mask matches bot's nick. if banmask is set to *!*@* then bot shall remove the unban the mask & deop the Nick and if banmask matches to bots nick then just release the ban. Thanks in advance.
| Code: |
bind mode - "* +b" enforcebans
proc enforcebans {nick uhost hand chan mc ban} {
foreach n [chanlist $chan] {
if {[string match -nocase $ban $n![getchanhost $n $chan]]} {
putkick $chan $n "Banned: Enforcing ban set by $nick 14($ban)"
}
}
}
|
|
|
| Back to top |
|
 |
metroid Owner
Joined: 16 Jun 2004 Posts: 771
|
Posted: Fri Mar 03, 2006 12:14 pm Post subject: |
|
|
Because string match is slightly gay, some banmasks would never match a user like that.
So we use a string map to get rid of \ and [ because string match will try to behave a little like regexp if you don't.
| Code: | bind mode - "* +b" enforcebans
proc enforcebans {nick uhost hand chan mc ban} {
if {![string match -nocase [string map {"\\" "\\\\" "\[" "\\["} $ban] $::botname]} {
foreach n [chanlist $chan] {
if {[string match -nocase [string map {"\\" "\\\\" "\[" "\\["} $ban] $n![getchanhost $n $chan]]} {
putkick $chan $n "Banned: Enforcing ban set by $nick 14($ban)"
}
}
} else {
pushmode $chan -o $nick
}
} |
This is the best i'm willing to do, the bot will unban any masks that match his nick/host anyway. |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Fri Mar 03, 2006 2:54 pm Post subject: |
|
|
what's with the "string map"? Only the 'string match -nocase' should do fine. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
metroid Owner
Joined: 16 Jun 2004 Posts: 771
|
Posted: Fri Mar 03, 2006 3:50 pm Post subject: |
|
|
No because string match does strange things with [ (i think \ too, not sure)
Try it yourself
| Code: | % string match -nocase \[moo\] \[moo\]
0
% string match \[moo\] \[moo\]
0
% string match *\[mo\]* moo
1
% |
This what i meant with string match acting like regexp |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sat Mar 04, 2006 3:28 am Post subject: |
|
|
I for one haven't seen a host that has a [ in it, have you? _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
metroid Owner
Joined: 16 Jun 2004 Posts: 771
|
Posted: Sat Mar 04, 2006 5:41 am Post subject: |
|
|
He checks banmasks, thus checks nicknamess too.
I've seen nicknames with [ in it.  |
|
| Back to top |
|
 |
i.m.offline Halfop
Joined: 02 Mar 2006 Posts: 74
|
Posted: Sat Mar 04, 2006 6:39 am Post subject: |
|
|
It works charm MeTroiD. Thanks a million . |
|
| Back to top |
|
 |
i.m.offline Halfop
Joined: 02 Mar 2006 Posts: 74
|
Posted: Sat Mar 04, 2006 7:59 am Post subject: |
|
|
| Can I request for little more update in it, it should check for bans only if OPed in channel. because else its causing error. Thanks in advance. |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Sat Mar 04, 2006 10:11 am Post subject: |
|
|
| Code: | | if {![botisop $chan]} {return} |
Add the above line before:
| Code: | | if {![string match ... |
_________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
i.m.offline Halfop
Joined: 02 Mar 2006 Posts: 74
|
Posted: Sat Mar 04, 2006 9:57 pm Post subject: |
|
|
Now it look most perfect. Thanks Alchera  |
|
| Back to top |
|
 |
i.m.offline Halfop
Joined: 02 Mar 2006 Posts: 74
|
Posted: Wed Sep 13, 2006 5:40 am Post subject: |
|
|
Once again I need little more update in this, I did request in other post but got no response.
Script works almost charm except I want to add one more option to make it more secured.
I should deop the nick & release the banmask, if the ban mask matchs more than x number of users. Just to prevent masskick in channel.
Thx again in advance. |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Wed Sep 13, 2006 2:38 pm Post subject: |
|
|
You've recived an answer on your other thread. Stick to one thread with the question on the same issue. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
|