Advertisement
outsider

Simple mute

Apr 23rd, 2013
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 1.73 KB | None | 0 0
  1. set mutedhosts ""
  2. setudef flag muting
  3.  
  4. bind join -|- * myavoice
  5. bind pub -|- !mute mymute
  6. bind pub -|- !demute demute2
  7. bind pub n !mute mutetrigger
  8.  
  9. proc myavoice {n u h c} {
  10.   if {![channel get $c muting]} {return}
  11.   global mutedhosts
  12.   if {[lsearch -exact $mutedhosts $u] == -1} {
  13.     pushmode $c +v $n
  14.   } else { puthelp "PRIVMSG $n  :\002$n\002 (\002*!*$u\002) have been muted for 10 mins." }
  15. }
  16.  
  17. proc mymute {n u h c a} {
  18.   if {![channel get $c muting] || ![isop $n $c]} {return}
  19.   global mutedhosts
  20.   foreach v [split $a] {
  21.     if {[onchan $v $c]} {
  22.       lappend mutedhosts [set uh [getchanhost $v $c]]
  23.       pushmode $c -v $v
  24.       utimer 600 [list demute $v $uh $c]
  25.     }
  26.   }
  27. }
  28.  
  29. proc demute2 {n u h c a} {
  30.   if {![channel get $c muting] || ![isop $n $c] || ![onchan $a $c]} {return}
  31.   foreach v [split $a] {
  32.   demute $v [getchanhost $v $c] $c
  33.   }
  34. }
  35.  
  36. proc demute {n h c} {
  37.   global mutedhosts
  38.   if {[set pos [lsearch -exact $mutedhosts $h]] == -1} {return}
  39.   while {[set pos [lsearch -exact $mutedhosts $h]] != -1} {
  40.     set mutedhosts [lreplace $mutedhosts $pos $pos]]
  41.   }
  42.   if {[onchan $n $c]} {
  43.     pushmode $c +v $n
  44.     } {
  45.     foreach curuser [chanlist $c] {
  46.       if {[getchanhost $curuser] == $h && ![isvoice $curuser $c]} {pushmode $c +v $curuser}
  47.     }
  48.   }
  49. }
  50.  
  51. proc mutetrigger {n u h c a} {
  52.   global lastbind
  53.   switch -- $a {
  54.     "on" {
  55.       channel set $c +muting
  56.       puthelp "PRIVMSG $n :\002$n\002 muting system enabled on $c."
  57.     }
  58.     "off" {
  59.       channel set $c -muting
  60.       puthelp "PRIVMSG $n :\002$n\002 muting system disabled on $c."
  61.     }
  62.     default {
  63.       puthelp "PRIVMSG $n :\002$n\002 usage: $lastbind \[on|off\]."
  64.     }
  65.   }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement