####################################################
# by wiebe @ QuakeNet
#
####################################################


####################################################
# logout:help:msg
####################################################
bind msgm fvlomn|fvlomn "help logout" logout:help:msgm
proc logout:help:msgm { n u h t } {
  if {[matchattr $h bkZ]} { return 0 }
  lappend o "logout: usage logout"
  lappend o "logout: attempts to log you out from the bot. only works when you logged in with the login command. if you were recognized by Q account logging out may only be temporary."
  if {[string equal [info procs cnotice] ""]} { foreach l $o { puthelp "NOTICE $n :$l" }
  } else { foreach l $o { cnotice $n $l puthelp "logout: " } }
  putcmdlog "($n!$u) !$h! help logout"
  return 1
}


####################################################
# logout:msg
####################################################
bind msg -|- logout logout:msg
proc logout:msg { n u h t } {
  set o ""; if {[validuser $h] && ![matchattr $h bkZ]} { set o [logout:logout $n $u $h] }
  if {[string equal [info procs cnotice] ""]} { foreach l $o { puthelp "NOTICE $n :$l" }
  } else { foreach l $o { cnotice $n $l puthelp "logout: " } }
  return 1
}


####################################################
# logout:logout
####################################################
proc logout:logout { n u h } {
  set o ""
  if {![string equal [info procs unsethand] ""] && [unsethand $n]} {
    lappend o "logout: succesfully logged out as $h"
  } else { lappend o "logout: failed to log you out" }
  return $o
}


set scriptdb(logout) {
  "provides logout command"
}


