#########################################################################
# KeYS-v1.0.TCL  By DarkElf et DirtyMac  ||  Eggdrop1.2.0               #
#                                                                       #         
# This little script adds two channel three dcc commands which allow    #
# for easy additon or removal of channel keys.                          #
#                                                                       #
# The +key and -key are available to channel masters and allow them to  #
# simply add or remove a channel key.                                   #
#                                                                       #
# The nokey command is available to bot owners and removes channel leys #
# from every channel the bot is on.                                     #
#                                                                       #
# IMPORTANT: (Not Really)                                               #
# There are three help files included in this archive: Pkey, _key, and  #
# key. These should be placed within help/dcc/ otherwise they will not  #
# load properly in dcc chat. If you do not receive these with this      #
# e|mail one me.                                                        #
#                                                                       #
# Questions, Comments, Bugs, Money: DarkElf <dtc3@Ra.MsState.Edu>       #
#                                   DirtyMac <whs3@Ra.MsState.Edu>      #
#########################################################################
# You might not want to change anything below here, but if you do, I    #
# really don't care.                                                    #
#########################################################################

bind dcc -|m +key dcc:pkey
proc dcc:pkey {hand idx text} {
   if {[llength $text] < 2} {
       putdcc $idx "Usage: .+key <channel> <key>"
       return 0
      }

set chan [lindex $text 0]
set key [lindex $text 1]
putserv "MODE $chan +k $key"
putlog "$hand added channel key || $key || on $chan"

}

bind dcc -|m -key dcc:mkey
proc dcc:mkey {hand idx text} {
   if {[llength $text] < 1} {
       putdcc $idx "Usage: .-key <channel>"
       return 0
      }

set chan [lindex $text 0]

set key [lindex [getchanmode $chan] 1]
putserv "MODE $chan -k $key"
putlog "$hand removed channel key || $key || on $chan"

}

bind dcc n nokey dcc:nokey
proc dcc:nokey {hand idx text} {
set list [channels]
foreach i [channels] {
   set key [lindex [getchanmode $i] 1]
     putserv "MODE $i -k $key"
putlog "$hand removed channel key || $key || on $i"
  }
}

putlog "Keys-v1.0.tcl locked and loaded..."
