SVN: toys/stbr/stbr.tcl

shadzik shadzik at pld-linux.org
Wed Oct 7 00:14:02 CEST 2009


Author: shadzik
Date: Wed Oct  7 00:14:02 2009
New Revision: 10712

Modified:
   toys/stbr/stbr.tcl
Log:
- add version function
- you need now global +S to !del or send request while in maintenance mode


Modified: toys/stbr/stbr.tcl
==============================================================================
--- toys/stbr/stbr.tcl	(original)
+++ toys/stbr/stbr.tcl	Wed Oct  7 00:14:02 2009
@@ -1,5 +1,7 @@
 # Send To Builder Request TCL by shadzik at pld-linux.org
 
+set versionstr "Send To Builder Request TCL v0.9 by shadzik"
+
 set cmdbook "./scripts/cmdbook.txt"
 set logfile "/home/users/stbr/db/stbrlog.db"
 set script "./scripts/cvslog.sh"
@@ -8,7 +10,7 @@
 set back &
 set cntr 0
 set cvsroot ":pserver:cvs at cvs.pld-linux.org:/cvsroot"
-set usage "Usage: !stbr \[help\] \[url\] th\|ti \[no\]upgrade spec1\[:BRANCH\]\[+bcond+...\]\[-bcond-...\]\[%kernel%...\] spec2\[:BRANCH\]\[+bcond+...\]\[-bcond-...\]\[%kernel%...\] ..."
+set usage "Usage: !stbr \[help\] \[url\] \[version\] th\|ti \[no\]upgrade spec1\[:BRANCH\]\[+bcond+...\]\[-bcond-...\]\[%kernel%...\] spec2\[:BRANCH\]\[+bcond+...\]\[-bcond-...\]\[%kernel%...\] ..."
 set nickpass "stbr-bot"
 set cmdtxt "./scripts/cmd.txt"
 set maintenance "./scripts/maintenance.txt"
@@ -38,6 +40,7 @@
 	putserv "privmsg $nick :Options:"
 	putserv "privmsg $nick :!stbr help - shows this help"
 	putserv "privmsg $nick :!stbr url - shows main URL on private chat"
+	putserv "privmsg $nick :!stbr version - shows version on public channel"
 	putserv "privmsg $nick :Examples:"
 	putserv "privmsg $nick :!stbr th upgrade spec1 spec2:DEVEL - sends upgrade request for spec1 on branch HEAD and spec2 on branch DEVEL to TH developers"
 	putserv "privmsg $nick :!stbr ti noupgrade spec1 - sends noupgrade request for spec1 on branch HEAD directly to Titanium builders"
@@ -47,6 +50,11 @@
 	putserv "privmsg $nick :Visit http://stbr.pld-linux.org/ to see the status of your request."
 }
 
+proc version {chan nick} {
+	global versionstr
+	putserv "privmsg $chan :$nick: $versionstr"
+}
+
 proc random {book} {
 	set file [open $book r]
 	gets $file hands
@@ -87,7 +95,7 @@
 
 proc pub:stat {nick host hand chan arg} {
 global cvsroot maintenance
-if {([file exists $maintenance]) && (![matchattr $hand n|m])} {
+if {([file exists $maintenance]) && (![matchattr $hand S])} {
 	set plik [open $maintenance r]
 	gets $plik reason
 	close $plik
@@ -132,7 +140,7 @@
 
 proc pub:del {nick host hand chan arg} {
 global logfile cancellation
-	if {([matchattr $hand n|m])} {
+	if {([matchattr $hand S])} {
 		set usage "Usage: !del spec date time"
 		set spec [lindex $arg 0]
 		set day [lindex $arg 1]
@@ -153,12 +161,12 @@
 
 proc pub:stbr {nick host hand chan arg} {
 global script back cntr logfile usage makereq cmdbook cmdtxt maintenance
-if {([file exists $maintenance]) && (![matchattr $hand n|m])} {
+if {([file exists $maintenance]) && (![matchattr $hand S])} {
 	set plik [open $maintenance r]
 	gets $plik reason
 	close $plik
 	putcmdlog "Maintenance mode active"
-	putserv "privmsg $chan :$nick: I'm now in maintenance mode (reason: $reason). Only owners may perform real actions."
+	putserv "privmsg $chan :$nick: I'm now in maintenance mode (reason: $reason). Only privileged users may perform real actions."
 	return 0
 }
 putcmdlog "#$hand# Noticed Send To Build Request Mail command";
@@ -167,6 +175,7 @@
 set first [lindex $arg 0]
 if {([string match help $first])} {help $nick; return 0}
 if {([string match url $first])} {url $nick; return 0}
+if {([string match version $first])} {version $chan $nick; return 0}
 if {([string match dzieki $first]) || ([string match dziekuje $first]) || ([string match thx $first]) || ([string match tx $first]) || ([string match thnx $first]) || ([string match dzięki $first]) || ([string match dziękuję $first])} {
 	set answ [rthx]; putserv "privmsg $chan :$nick: $answ"; return 0
 }
@@ -319,4 +328,4 @@
 if {$cntr<1} {incr cntr} {utimer 30 "set cntr 0"; return 1}
 }
 
-putlog "Send To Builder Request TCL v0.9 by shadzik loaded."
+putlog "$versionstr loaded."


More information about the pld-cvs-commit mailing list