SVN: toys/stbr/stbr.tcl

shadzik shadzik at pld-linux.org
Sun Nov 8 03:12:45 CET 2009


Author: shadzik
Date: Sun Nov  8 03:12:45 2009
New Revision: 10964

Modified:
   toys/stbr/stbr.tcl
Log:
- try to be semi-inteligent and unbind 'more' after 120 of inactivity or after 'more' was called once, bind it when another user calls for help


Modified: toys/stbr/stbr.tcl
==============================================================================
--- toys/stbr/stbr.tcl	(original)
+++ toys/stbr/stbr.tcl	Sun Nov  8 03:12:45 2009
@@ -20,6 +20,7 @@
 set queueparser "./scripts/queue_parser.pl"
 set queuechan "#pld"
 set actconfig "stbr.conf"
+set bindedmh 0
 
 ############ DO NOT CHANGE ANYTHING BELOW UNLESS YOU KNOW WHAT YOU"RE DOING ###############
 
@@ -64,18 +65,21 @@
 }
 
 proc help {nick} {
-	global usage
+	global usage bindedmh
 	putserv "privmsg $nick :$usage"
 	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 :Type 'more' for more help and examples"
+	putserv "privmsg $nick :Type 'more' for more help and examples (you've got 120 seconds to do that)"
+	bind msg - more msg:more_help
+	set bindedmh 1
+	utimer 120 "if {$bindedmh==1} {unbind msg - more msg:more_help; set bindedmh 0}"
 }
 
-bind msg - more msg:more_help
 
 proc msg:more_help {nick uhost hand text} {
+	global bindedmh
 	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"
@@ -84,6 +88,10 @@
 	putserv "privmsg $nick :!stat spec \[BRANCH\] - checks if spec exists on BRANCH, if BRANCH is not set HEAD is taken"
 	putserv "privmsg $nick :!del spec date time - (for admins only) removes request and sends cancelation email"
 	putserv "privmsg $nick :Visit http://stbr.pld-linux.org/ to see the status of your request."
+	if {$bindedmh==1} {
+		unbind msg - more msg:more_help
+		set bindedmh 0
+	}
 }
 
 proc url {nick} {
@@ -135,7 +143,7 @@
 random $reqbook
 }
 
-bind time - "0 * * * *" checkunfilled
+bind time - "00 * * * *" checkunfilled
 
 proc checkunfilled {nick host hand chan arg} {
 	global unfilled resend queuechan


More information about the pld-cvs-commit mailing list