All pastes #1403361 Raw Edit

Unnamed

public text v1 · immutable
#1403361 ·published 2009-04-26 17:39 UTC
rendered paste body
bind pub o !trac puturl

proc definetopic {nick uhost hand chan args} { 
  set ticURL "http://trac.xbmc.org/ticket/"
  set revURL "http://trac.xbmc.org/changeset/"

  # check permission
  if [ ! regexp -nocase {.*@xbmc/staff/.*] $uhost ] then {
      puthelp "NOTICE $nick : You don't have permission to use !trac"
      return
  }
	# Usage Details
	if {[lindex $args 0] == "" } {
		puthelp "NOTICE $nick : Usage: !trac [#NNNN|rNNNNN]"
		return
	}
  # parse request
  set URL ""
  if [ regexp {r(\d+)} $args[0] match rev ] then {
    set URL $revURL+$rev
  } else {
    if [ regexp {#(\d+)} $args[0] match ticket ] then {
      set URL $ticURL+$ticket
    }
  }
  # print result
  if [ $URL != "" ] then {
    puthelp "NOTICE $nick : "+$URL
  }
  return
}