Pages

Sunday, August 28, 2011

dont repeat.tcl

#######################
##  Proteksi Repeat  ##
#######################

set repeat-kick 1       ;# kick on 3 repeated lines

bind pubm - !whois* repeat_pubm
bind notc - * repeat_pubm
bind ctcp - ACTION repeat_pubm
proc repeat_pubm {nick uhost hand chan text} {
  if [matchattr $hand f] {return 0}
  global repeat_last repeat_num repeat-kick
  if [info exists repeat_last([set n [string tolower $nick]])] {
    if {[string compare [string tolower $repeat_last($n)] \
        [string tolower $text]] == 0} {
      if {[incr repeat_num($n)] >= ${repeat-kick}} {
        putserv "KICK $chan $nick :4Ga Usah Diulang-ulang Donk ah,  baca kok..."
        unset repeat_last($n)
        unset repeat_num($n)
      }
      return
    }
  }
  set repeat_num($n) 1
  set repeat_last($n) $text
}

bind nick - * repeat_nick
proc repeat_nick {nick uhost hand chan newnick} {
  if [matchattr $hand f] {return 0}
  global repeat_last repeat_num
  catch {set repeat_last([set nn [string tolower $newnick]]) \
         $repeat_last([set on [string tolower $nick]])}
  catch {unset repeat_last($on)}
  catch {set repeat_num($nn) $repeat_num($on)}
  catch {unset repeat_num($on)}
}

proc repeat_timr {} {
  global repeat_last
  catch {unset repeat_last}
  catch {unset repeat_num}
  timer 1 repeat_timr
}

if ![regexp repeat_timr [timers]] {
  timer 1 repeat_timr
}

No comments:

Post a Comment