##########  nasty.tcl v1.0
##########  pete@undernet
##########
##########  Three partyline commands:  .mop, .mdop, and .mkick
##########  Pretty self explanitory really..
##########      .mop <chan> : ops all non ops on the chan
##########      .mdop <chan> : deops everyone apart from you and the bot
##########      .mkick <chan> : sets the channel +i, then kicks all non-ops
##########  
##########   You must be +n to use these commands


bind dcc +n mdop mdop 
bind dcc +n mop mop 
bind dcc +n mkick mkick 

proc mdop {h id arse} {
 
     global botnick
     set members [chanlist $arse]

  foreach who $members {
    if {[isop $who $arse] && $who != [hand2nick $h] && $who != $botnick } { lappend deopnicks $who }
     }

  set dumps [expr {[llength $deopnicks]  / 6} ]
  putdcc $id "massdeoping $arse"
   
  set i 0
  while { $i < [llength $deopnicks]} {
    
   putquick "MODE $arse -oooooo [lrange $deopnicks $i [expr {$i + 5} ]]"
   set i [expr {$i +6}]
   
 }
}



proc mop {h id arse} {
 
     global botnick
     set members [chanlist $arse]
     putdcc $id $members

  foreach who $members {
    if {![isop $who $arse] } { lappend opnicks $who }
     }
  set dumps [expr {[llength $opnicks]  / 6} ]
  putdcc $id "massoping $arse"
   
  set i 0
  while { $i < [llength $opnicks]} {
    
   putquick "MODE $arse +oooooo [lrange $opnicks $i [expr {$i + 5} ]]"
   set i [expr {$i +6}]
   
 }
}






proc mkick {h id arse} {
 
     global botnick
     
     set members [chanlist $arse]
     putdcc $id "masskicking non ops in  $arse"
     putserv "MODE $arse +i"
  foreach who $members {
    if {![isop $who $arse] && $who != [hand2nick $h]} { 
       putkick $arse $who gimp
}
}
}    





putlog "-= nasty loaded =-"