SVN: toys/stbr/stbr.tcl

shadzik shadzik at pld-linux.org
Sun Oct 26 15:55:15 CET 2008


Author: shadzik
Date: Sun Oct 26 15:55:15 2008
New Revision: 9923

Modified:
   toys/stbr/stbr.tcl
Log:
- add !del, a rudementary function for deleting mistaken requests


Modified: toys/stbr/stbr.tcl
==============================================================================
--- toys/stbr/stbr.tcl	(original)
+++ toys/stbr/stbr.tcl	Sun Oct 26 15:55:15 2008
@@ -81,6 +81,25 @@
 bind pub * !stbr pub:stbr
 bind pub * stbr: pub:stbr
 bind pub * stbr, pub:stbr
+bind pub * !del pub:del
+
+proc pub:del {nick host hand chan arg} {
+global logfile
+	if {([matchattr $hand n|m])} {
+		set usage "Usage: !del spec date time"
+		set spec [lindex $arg 0]
+		set day [lindex $arg 1]
+		set hour [lindex $arg 2]
+		if {([string length $spec]<2)} {putserv "privmsg $chan :$nick: $usage"; return 0}
+		if {([string length $day]!=10)} {putserv "privmsg $chan :$nick: $usage"; return 0}
+		if {([string length $hour]!=8)} {putserv "privmsg $chan :$nick: $usage"; return 0}
+		set date ""; append date $day; append date " "; append date $hour
+		putcmdlog "Deleting entry for: $spec on $date"
+		exec sqlite $logfile "DELETE FROM application where spec='$spec' and date='$date';"
+		exec sqlite $logfile "DELETE FROM stbr where date='$date';"
+		putserv "privmsg $chan :$nick: Done."
+	}
+}
 
 proc pub:stbr {nick host hand chan arg} {
 global script back cntr logfile usage makereq cmdbook cmdtxt maintenance


More information about the pld-cvs-commit mailing list