TCL vHost Relay

By Get_A_Fix on Jan 14, 2008

This is just a simple relay snippet designed to output text to #vhost.

This only works for Anope IRC Services package, or any network that supports output from Global and with logchan enabled. The script will match text sent to #services (or whatever logchan you have set within services.conf) and output it to #vhost, effectively informing the user their vhost was requested/activated/rejected.

To Load: Paste code to new or already loaded TCL file, and rehash bot.

##
# vHost Relay - istok (DALnet/GameSurge/FreeNODE/IRCSpeed)
##

# Feel free to edit these settings, inside the ""
set vhostchan "#vhost"
set debugchan "#services"
set debugnick "Global"

# No need to edit further, unless you know what you're doing.
bind pubm - * vhost:output
proc vhost:output {nick uhost hand chan arg} {
  global vhostchan debugchan debugnick
  if {$chan != $debugchan} {return}
  if {[string tolower $debugnick] != [string tolower $nick]} {return}

  if {[string match -nocase "*vhost*" $arg] && [string match -nocase "*requested*" $arg]} {
    set requester [join [lrange [split $arg] 2 end]]
    putquick "PRIVMSG $vhostchan :\002New vHost\002: $requester"
    return 0
  }

  if {[string match -nocase "*request*" $arg] && [string match -nocase "*activated*" $arg]} {
    set requester [lindex [split $arg] 3]
    set activeoper [lindex [split $arg] 6]
    putquick "PRIVMSG $vhostchan :\002vHost Activation\002: $requester - Activated by: $activeoper"
    putquick "NOTICE $requester :$requester, your vHost has been activated by: $activeoper. - Thank you, $::network Staff."
    return 0
  }

  if {[string match -nocase "*request*" $arg] && [string match -nocase "*rejected*" $arg]} {
    set requester [lindex [split $arg] 3]
    set requested [join [lrange [split $arg] 4 end]]
    putquick "PRIVMSG $vhostchan :\002vHost Rejected\002: $requester - $requested"
    putquick "NOTICE $requester :$requester, vHost $requested"
    return 0
  }

  if {[string match -nocase "*vhost*" $arg] && [string match -nocase "*user*" $arg] && [string match -nocase "*set*" $arg]} {
    set hostset [join [lrange [split $arg] 0 end]]
    putquick "PRIVMSG $vhostchan :$hostset"
    return 0
  }

  if {[string match -nocase "*vhost*" $arg] && [string match -nocase "*user*" $arg] && [string match -nocase "*deleted*" $arg]} {
    set hostdel [join [lrange [split $arg] 0 end]]
    putquick "PRIVMSG $vhostchan :$hostdel"
    return 0
  }
}

putlog "Loaded: vHost Relay Module..."

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.