This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

huh?

Old posts that have not been replied to for several years.
Locked
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

huh?

Post by caesar »

Code: Select all

# binds
bind pubm - "% *\\\?\\\?\\\?\\\?*" pub:questions
bind pubm - {* *#*} spam:pub

# flags
setudef flag spam
setudef flag annoy

# channel spam
proc spam:pub {nick uhost hand chan text} {
  if {[channel get $chan spam] && [mytests $nick $hand $chan $text] != 0} {
    set mask "*!*@[lindex [split $uhost @] 1]"
    newchanban $chan $mask Spam "\00224\002 hours ban for spaming within $chan" 1440
  }
}

# annoy - questions
proc pub:questions {nick uhost hand chan text} {
  if {[channel get $chan annoy] && [mytests $nick $hand $chan $text] != 0} {
    putlog "banned"
    return
  }
  putlog "passed"
}

# my tests
proc mytests {nick hand chan text} {
 if {[matchattr $hand of|fo $chan] || [isop $nick $chan] || ![string match "*#*" $text] || [string match "#" $text] || [validchan $text]} {
   return 0
 }
 return 1
}
If an known user types in channel #bla he is not banned, and if an unknown user that types #bla his ass is banned. Till now this is correct. If an known user uses to many ? in channel he will not banned but if an unknown user to the bot uses to many ? he is not banned also. Why is this happening? This two procs call the same "mytest" do to the checkings and one works and the otherone dosen't. Any ideea why?
Once the game is over, the king and the pawn go back in the same box.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Rather complex for a simple operation.

There are notibly a few niggles with the code.

1: Look at this whole if statment

Code: Select all

if {[matchattr $hand of|fo $chan] || [isop $nick $chan] || ![string match "*#*" $text] || [string match "#" $text] || [validchan $text]} { 
These are all OR operations, so any single one of them, will return and prevent a ban.

1: If they are channel or global, friend or op in the channel.

2: If they are currently set +o on the channel (non-userfile)

3: There is no # in the text

4: If # if the first and only character in the text

5: If the text is a valid eggdrop monitored channel name (doesn't care for spaces here!).

These seem perfectly fine. However, have you tested to see what each variable contains? IE, have you sent there values to the log (putlog) to see what could cause this behaviour?

This is all presuming you are actualy seeing "passed" or "banned" in the log when the ??? is used?

The bind is fine, with one minor point. You don't need three slashes, only the two.

Slashes 1 and 2 escape each other (Tcl escape) so they are read correctly. The third slash is escaping the ?. The ? doesn't need escaping, as Tcl will not interpret it.

Have you also sent the value of "[channel get annoy]" to the log? AKA, have you made sure the channel is +annoy?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Anyway, I've decided to remove this extra proc and do the checks for each proc ash I should be use it in the first place. Seems that I've forgot to add an [split $text] at the [validchan], also, your point about changing it to "% *\\????*" seems to be correct. Thanks! I'll add checks to each code as I've said. Thank you anyway..

PS: I had +annoy on channel, I'm not that dumb :)
Once the game is over, the king and the pawn go back in the same box.
Locked