This is the new home of the egghelp.org community forum. this announcement post . Click the X in the top right-corner of this box to dismiss this message. 
Help for those learning Tcl or writing their own scripts.
			
		
				
			
				
								i.m.offline 							 
						Halfop 			
		Posts:  74 Joined:  Thu Mar 02, 2006 11:47 am 
		
						
					
													
							
						
									
						Post 
					 
								by i.m.offline  Fri Mar 03, 2006 5:32 am 
			
			
			
			
			
			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: Select all 
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)"  
  }  
 }  
}
 
		 
				
		
		 
	 
				
		
				
			
				
								metroid 							 
						Owner 			
		Posts:  771 Joined:  Wed Jun 16, 2004 2:46 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by metroid  Fri Mar 03, 2006 12:14 pm 
			
			
			
			
			
			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: Select all 
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.
 
		 
				
		
		 
	 
				
		
				
			
				
								caesar 							 
						Mint Rubber 			
		Posts:  3778 Joined:  Sun Oct 14, 2001 8:00 pmLocation:  Mint Factory 
		
						
					
						 
													
							
						
									
						Post 
					 
								by caesar  Fri Mar 03, 2006 2:54 pm 
			
			
			
			
			
			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.
			
						 
		 
				
		
		 
	 
				
		
				
			
				
								metroid 							 
						Owner 			
		Posts:  771 Joined:  Wed Jun 16, 2004 2:46 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by metroid  Fri Mar 03, 2006 3:50 pm 
			
			
			
			
			
			No because string match does strange things with [ (i think \ too, not sure)
Try it yourself
Code: Select all 
% 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
 
		 
				
		
		 
	 
				
		
				
			
				
								caesar 							 
						Mint Rubber 			
		Posts:  3778 Joined:  Sun Oct 14, 2001 8:00 pmLocation:  Mint Factory 
		
						
					
						 
													
							
						
									
						Post 
					 
								by caesar  Sat Mar 04, 2006 3:28 am 
			
			
			
			
			
			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.
			
						 
		 
				
		
		 
	 
				
		
				
			
				
								metroid 							 
						Owner 			
		Posts:  771 Joined:  Wed Jun 16, 2004 2:46 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by metroid  Sat Mar 04, 2006 5:41 am 
			
			
			
			
			
			He checks banmasks, thus checks nicknamess too.
I've seen nicknames with [ in it. 
 
		 
				
		
		 
	 
				
		
				
			
				
								i.m.offline 							 
						Halfop 			
		Posts:  74 Joined:  Thu Mar 02, 2006 11:47 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by i.m.offline  Sat Mar 04, 2006 6:39 am 
			
			
			
			
			
			It works charm MeTroiD. Thanks a million 
.
 
		 
				
		
		 
	 
				
		
				
			
				
								i.m.offline 							 
						Halfop 			
		Posts:  74 Joined:  Thu Mar 02, 2006 11:47 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by i.m.offline  Sat Mar 04, 2006 7:59 am 
			
			
			
			
			
			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.
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
				
			
				
								Alchera 							 
						Revered One 			
		Posts:  3344 Joined:  Mon Aug 11, 2003 12:42 pmLocation:  Ballarat Victoria, Australia
				Contact: 
				
			 
				
		 
		
						
					
						 
													
							
						
									
						Post 
					 
								by Alchera  Sat Mar 04, 2006 10:11 am 
			
			
			
			
			
			
Add the above line before:
Add [SOLVED] to the thread title if your issue has been.
Search  | 
FAQ  | 
RTM  
		 
				
		
		 
	 
				
		
				
			
				
								i.m.offline 							 
						Halfop 			
		Posts:  74 Joined:  Thu Mar 02, 2006 11:47 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by i.m.offline  Sat Mar 04, 2006 9:57 pm 
			
			
			
			
			
			Now it look most perfect. Thanks Alchera 
 
		 
				
		
		 
	 
				
		
				
			
				
								i.m.offline 							 
						Halfop 			
		Posts:  74 Joined:  Thu Mar 02, 2006 11:47 am 
		
						
					
						 
													
							
						
									
						Post 
					 
								by i.m.offline  Wed Sep 13, 2006 5:40 am 
			
			
			
			
			
			Once again I need little more update in this, I did request in other post but got no response.
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
				
			
				
								caesar 							 
						Mint Rubber 			
		Posts:  3778 Joined:  Sun Oct 14, 2001 8:00 pmLocation:  Mint Factory 
		
						
					
						 
													
							
						
									
						Post 
					 
								by caesar  Wed Sep 13, 2006 2:38 pm 
			
			
			
			
			
			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.