[Tkabber-dev] r306 - trunk/plugins/reminder

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Mon Feb 22 09:25:54 MSK 2010


Author: bigote
Date: 2010-02-22 09:25:54 +0300 (Mon, 22 Feb 2010)
New Revision: 306

Modified:
   trunk/plugins/reminder/reminder.tcl
Log:
Added a possibility to execute a user specified tcl script at an arbitrary time.
Just start your message with "cmd" keyword (separated with a space):
/remind 10 min
cmd set a "Hello world"
puts $a

Nobody prohibits you to call Tkabber commands or even to execute script files from disk:
/remind 3 hours
cmd ::muc::unban ::xmpp::1 foo at conference.jabber.ru pupkin at jabber.ru

/remind 01/31/2011 12:00:00
cmd source /home/myself/bin/test.tcl


Modified: trunk/plugins/reminder/reminder.tcl
===================================================================
--- trunk/plugins/reminder/reminder.tcl	2010-02-21 11:15:27 UTC (rev 305)
+++ trunk/plugins/reminder/reminder.tcl	2010-02-22 06:25:54 UTC (rev 306)
@@ -1,4 +1,4 @@
-# "Reminder" plugin for Tkabber. 2010-02-11 v. 0.9.1
+# "Reminder" plugin for Tkabber. 2010-02-22 v. 0.9.2
 # Written by Serge Yudin xmpp:bigote at jabber.ru
 # Its purpose is to remind about your contact birthdays automatically
 # and about some tasks that you assign by means of "/remind" command.
@@ -183,6 +183,10 @@
     if {[winfo exists $w]} {
         destroy $w
     }
+    if {[string match cmd\ * $msg]} {
+        set cmd [string trimleft $msg cmd\ ]
+        eval $cmd
+    }
     if {$options(play_sound)} {
         ::sound::play $::sound::options(plugin_reminder_sound)
     }
@@ -322,6 +326,20 @@
         \n\tSets an absolute date and time for a reminder.\
         \n\tPlease note the date must be in the format MM/DD/YYYY HH:MM:SS\
         \n\tOtherwise, there could be errors or wrong timing calculation.\
+        \n/remind 10 min\
+        \ncmd if {\[expr rand\(\)\] < 0.5} {\
+        \nputs \"Hello world\"\
+        \n} else {\
+        \nputs \"Goodbye world\"\
+        \n}\
+        \n\
+        \n/remind 3 hours\
+        \ncmd ::muc::unban ::xmpp::1 foo at conference.jabber.ru pupkin at jabber.ru\
+        \n\
+        \n/remind 01/31/2011 12:00:00\
+        \ncmd source /home/myself/bin/test.tcl\
+        \n\tIf your message starts with a \"cmd\" keyword, the text that follows it\
+        \n\twill be considered as a tcl script and executed when its clock strikes.\
         \n\n/listrems\
         \n\tThis will show you a list of all running reminders you have set.\
         \n\n/delrem 1\



More information about the Tkabber-dev mailing list