#by wiebe @ QuakeNet
#gseen module required
#load this script _after_ gseen module



#help seennick pub
bind pubm fvlomn|fvlomn "% ${botnet-nick} help seennick" c_seennick:help:pub

proc c_seennick:help:pub { nick uhost handle chan text } {
  if { ![string match *gseen* [modules]] } { return 0 }
  lappend output "Usage: seennick <nick>"
  lappend output "Returns seennick info for the given nick."
  if { [catch {set x [cnotice $nick $output]} error] || !$x } {
    foreach t $output { puthelp "NOTICE $nick :$t" }
  }
  putloglev c $chan "[lindex [split $text] 1]: $nick $uhost $handle $chan [join [lrange [split $text] 2 end]]"
}



#help seennick msg
bind msgm fvlomn|fvlomn "help seennick" c_seennick:help:msg

proc c_seennick:help:msg { nick uhost handle text } {
  if { ![string match *gseen* [modules]] } { return 0 }
  lappend output "Usage: seennick <nick>"
  lappend output "Returns seen info for the given nick."
  if { [catch {set x [cnotice $nick $output]} error] || !$x } {
    foreach t $output { puthelp "NOTICE $nick :$t" }
  }
  putcmdlog "($nick!$uhost) !$handle! $text"
}



#seennick
bind pubm fvlomn|fvlomn "% ${botnet-nick} seennick" c_seennick:pub
bind pubm fvlomn|fvlomn "% ${botnet-nick} seennick *" c_seennick:pub

proc c_seennick:pub { nick uhost handle chan text } {
  if { ![string match *gseen* [modules]] } { return 0 }
  set target [lindex [split $text] 2]
  if { ![string equal $target ""] } {
    *pub:!seennick $nick $uhost $handle $chan $target
  } else {
    lappend output "Usage: seennick <nick>"
    if { [catch {set x [cnotice $nick $output]} error] || !$x } {
      foreach t $output { puthelp "NOTICE $nick :$t" }
    }
  }
  putloglev c $chan "[lindex [split $text] 1]: $nick $uhost $handle $chan [join [lrange [split $text] 2 end]]"
}



#seen msg
bind msg fvlomn|fvlomn seennick c_seennick:msg

proc c_seennick:msg { nick uhost handle text } {
  if { ![string match *gseen* [modules]] } { return 0 }
  if { ![string equal $text ""] } {
    *msg:seennick $nick $uhost $handle $text
  } else {
    lappend output "Usage: seennick <nick>"
    if { [catch {set x [cnotice $nick $output]} error] || !$x } {
      foreach t $output { puthelp "NOTICE $nick :$t" }
    }
  }
  return 1
}

