All pastes #269044 Raw Edit

Untitled

public text v1 · immutable
·published 2006-12-06 06:25 UTC
rendered paste body
setudef flag validate-private

set valtrig_1 "!v"
set valtrig_2 "!validate"

set validator "/home/tballard/v.rb"

bind pub - $valtrig_1 pub_validate
bind pub - $valtrig_2 pub_validate

proc pub_validate {nick uhost hand chan arg} {
  global validator
	if {[llength $arg]==0} {
		putnotc $nick  "Usage: !validate <url>"
	} elseif { [llength $arg] >= 2 } {
		putnotc $nick  "Usage: !validate <url>"
	} else {
		set url $arg
    set priv false

    set results [split [exec $validator $url] "\n"
    if {[lsearch -exact [channel info $chan] +validate-private] != -1} { set priv true }

    if {$priv} {
      foreach line [split $results \n] { 
				putserv "PRIVMSG $nick :$line"
			}
    } else {
      foreach line [split $results \n] { 
				putserv "PRIVMSG $chan :$line"
			}
    }
  }
}