        |_    _| /     \    |  ___| |    \  |  | |_    _|                #
#            |  |   |  |  |    |  ___| |  |  | |  |   |  |                  #
#            |__|   \_____/    |_____| |____/  |__|   |__|                  #
#             _____   _____   __      _____   __    __                      #
#            |  __ \ |  ___| |  |    /     \ |  |/\|  |                     #
#            |  __ < |  ___| |  |__  |  |  | |        |                     #
#            |_____/ |_____| |_____| \_____/  \__/\__/                      #
#                                                                           #
#############################################################################


############################### PROCEDUREZ ##################################
proc pub:onjoin {nick uhost hand chan} {
  if {[matchattr $hand 1]} {putserv "MODE $chan +v $nick"}
  return 1
}
################################ add ########################################
proc pub:addvoice {nick uhost hand chan arg} {
  global botnick
  if {![matchattr $hand o]} {
    putserv "NOTICE $nick :You don't have access to add VOICE's."
    return 0
  }
  set who [lindex $arg 0]
  set who2 [string range $who 0 8]
  set userhost [maskhost [getchanhost $who $chan]]
  if {$who ==""} {
    putserv "NOTICE $nick :\002U\002sage\037:\037 !add <nick>"
    return 0
  }
  if {![onchan $who $chan]} {
    putserv "NOTICE $nick :\002$who\002 isn't on the channel."
    return 0
  }
  if {[validuser $who2]} {
        if {![matchattr $who +v $chan]} {
          chattr $who2 |+gv $chan
          putserv "privmsg chanserv :VOP $chan ADD $who"
          putserv "MODE $chan +v $who"
          putserv "NOTICE $nick :alltough $who is already on my userlist. I have added $who to the v
oice list in $chan"
          putserv "privmsg $informops :^C11$who has been added to the voice list in $chan by $nick"
          save
          return 0
           }
    putserv "NOTICE $nick :\002$who\002 is already on my userlist."
    return 0
  }
  if {![adduser $who $userhost]} {
    putserv "NOTICE $nick :Couldn't add \"$who\" to the Voice list."
     return 0
        }
        adduser $who $userhost
        chattr $who2 |+gv $chan
        putserv "privmsg chanserv :VOP $chan ADD $who"
        putserv "MODE $chan +v $who"
        putserv "NOTICE $who :You have been Added to the voice list in $chan with autovoice."
        putserv "NOTICE $nick :\002$who\002 has been added to the voice list in $chan with autovoice
."
        putserv "privmsg $informops :^C11$who has been added to the voice list in $chan by $nick"
        save
     return 1
}
############################### delete #########################################
proc pub:delvoice {nick uhost hand chan arg} {
  global botnick
  if {![matchattr $hand o]} {
    putserv "NOTICE $nick :You don't have access to delete VOICE's."
    return 0
  }
  set who [lindex $arg 0]
  set who2 [string range $who 0 8]
  if {[matchattr $who o]} {
    putserv "NOTICE $nick :You can't do that stupid $who is an op!"
    return 0
  }

  if {$who ==""} {
    putserv "NOTICE $nick :\002U\002sage\037:\037 @add <nick>"
    return 0
  }
  chattr $who2 |-gv $chan
  putserv "privmsg chanserv :VOP $chan del $who"
  putserv "MODE $chan -v $who"
  putserv "NOTICE $who :You have been deleted from the voice list in $chan with autovoice."
  putserv "NOTICE $nick :\002$who\002 has been deleted from the voice list in $chan with autovoice."
  putserv "privmsg #informops :^C11$who has been deleted from the voice list in $chan by $nick"
  save
  return 1
}
putlog "\002AutoVoice v2.0 TCL (c) 2004\002 by \002t00nie & NoZparker\002 has successfully loaded."
(END)
