[Tkabber-dev] r2102 - in trunk/tkabber-plugins: . spy

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sun Jan 26 19:54:13 MSK 2014


Author: sergei
Date: 2014-01-26 19:54:13 +0400 (Sun, 26 Jan 2014)
New Revision: 2102

Modified:
   trunk/tkabber-plugins/ChangeLog
   trunk/tkabber-plugins/spy/spy.tcl
Log:
	* spy/spy.tcl, spy/msgs/ru.msg: Added sound notification.


Modified: trunk/tkabber-plugins/ChangeLog
===================================================================
--- trunk/tkabber-plugins/ChangeLog	2014-01-26 15:38:44 UTC (rev 2101)
+++ trunk/tkabber-plugins/ChangeLog	2014-01-26 15:54:13 UTC (rev 2102)
@@ -21,6 +21,8 @@
 	  and in Unix buttons 2 and 3 correspond to different mous buttons
 	  (thanks to Vitaly Takmazov).
 
+	* spy/spy.tcl, spy/msgs/ru.msg: Added sound notification.
+
 2014-01-25  Sergei Golovan <sgolovan at nes.ru>
 
 	* otr/key.tcl, otr/tclotr/crypto.tcl: Code cleanup, made DSA key

Modified: trunk/tkabber-plugins/spy/spy.tcl
===================================================================
--- trunk/tkabber-plugins/spy/spy.tcl	2014-01-26 15:38:44 UTC (rev 2101)
+++ trunk/tkabber-plugins/spy/spy.tcl	2014-01-26 15:54:13 UTC (rev 2102)
@@ -34,6 +34,12 @@
     custom::defvar options(timestamp_format) {[%m/%d %R]} \
 	[::msgcat::mc "Format of timestamp in Spy Presence window."] \
 	-type string -group Spy
+
+    custom::defvar options(plugin_spy_sound) \
+	[fullpath sounds default chat_their_message.wav] \
+	[::msgcat::mc "Play this sound file"] \
+	-command [list ::sound::load_sound_file plugin_spy] \
+	-type file -group Spy
 }
 
 proc spy::load {} {
@@ -200,6 +206,11 @@
 
     set [namespace current]::spy_alerts($watch_id) 0
 
+    checkbutton $w.watches.$watch_id.sound -text [::msgcat::mc "Sound when available"] \
+	-variable [namespace current]::spy_alerts($watch_id.sound)
+
+    set [namespace current]::spy_alerts($watch_id.sound) 0
+
     pack $w.watches.$watch_id.remove \
       $w.watches.$watch_id.regex \
       $w.watches.$watch_id.timestamp \
@@ -207,6 +218,7 @@
       $w.watches.$watch_id.jid \
       $w.watches.$watch_id.presence -side left
     pack $w.watches.$watch_id.alert -side right
+    pack $w.watches.$watch_id.sound -side right
     pack $w.watches.$watch_id.reason -side left -fill x
     pack $w.watches.$watch_id -side bottom -fill x
 
@@ -236,9 +248,12 @@
     $w.presence configure -text $type
     $w.reason configure -text $reason
 
-    if { $spy_alerts($watch_id) && $type=="available" } {
+    if {$spy_alerts($watch_id) && $type=="available"} {
         alert_dialog $xlib $watch_id $nick $jid
     }
+    if {$spy_alerts($watch_id.sound) && $type=="available" } {
+        ::sound::play $options(plugin_spy_sound)
+    }
 }
 
 proc spy::alert_dialog {xlib watch_id nick jid} {



More information about the Tkabber-dev mailing list