egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Some Addition for +enforcebans

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
i.m.offline
Halfop


Joined: 02 Mar 2006
Posts: 74

PostPosted: Fri Mar 03, 2006 5:32 am    Post subject: Some Addition for +enforcebans Reply with quote

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
View user's profile Send private message
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Fri Mar 03, 2006 12:14 pm    Post subject: Reply with quote

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
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Fri Mar 03, 2006 2:54 pm    Post subject: Reply with quote

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
View user's profile Send private message
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Fri Mar 03, 2006 3:50 pm    Post subject: Reply with quote

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
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Sat Mar 04, 2006 3:28 am    Post subject: Reply with quote

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
View user's profile Send private message
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Sat Mar 04, 2006 5:41 am    Post subject: Reply with quote

He checks banmasks, thus checks nicknamess too.

I've seen nicknames with [ in it. Smile
Back to top
View user's profile Send private message
i.m.offline
Halfop


Joined: 02 Mar 2006
Posts: 74

PostPosted: Sat Mar 04, 2006 6:39 am    Post subject: Reply with quote

It works charm MeTroiD. Thanks a million Very Happy.
Back to top
View user's profile Send private message
i.m.offline
Halfop


Joined: 02 Mar 2006
Posts: 74

PostPosted: Sat Mar 04, 2006 7:59 am    Post subject: Reply with quote

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
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Sat Mar 04, 2006 10:11 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
i.m.offline
Halfop


Joined: 02 Mar 2006
Posts: 74

PostPosted: Sat Mar 04, 2006 9:57 pm    Post subject: Reply with quote

Now it look most perfect. Thanks Alchera Very Happy
Back to top
View user's profile Send private message
i.m.offline
Halfop


Joined: 02 Mar 2006
Posts: 74

PostPosted: Wed Sep 13, 2006 5:40 am    Post subject: Reply with quote

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
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Wed Sep 13, 2006 2:38 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber