[Tkabber-dev] r2103 - trunk/tkabber

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sun Jan 26 21:03:59 MSK 2014


Author: sergei
Date: 2014-01-26 21:03:59 +0400 (Sun, 26 Jan 2014)
New Revision: 2103

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/hooks.tcl
Log:
	* hooks.tcl: Ensure that hook flags variable exists.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2014-01-26 15:54:13 UTC (rev 2102)
+++ trunk/tkabber/ChangeLog	2014-01-26 17:03:59 UTC (rev 2103)
@@ -28,6 +28,8 @@
 	* ifacetk/systray.tcl: Added option not to change the systray icon
 	  when a groupchat message which is not highlighted is received.
 
+	* hooks.tcl: Ensure that hook flags variable exists.
+
 2014-01-22  Sergei Golovan  <sgolovan at nes.ru>
 
 	* gpgme.tcl, chats.tcl: Adjusted priority of rewrite_message_hook

Modified: trunk/tkabber/hooks.tcl
===================================================================
--- trunk/tkabber/hooks.tcl	2014-01-26 15:54:13 UTC (rev 2102)
+++ trunk/tkabber/hooks.tcl	2014-01-26 17:03:59 UTC (rev 2103)
@@ -33,12 +33,22 @@
 
 proc hook::set_flag {hook flag} {
     variable F
+
+    if {![info exists F(flags,$hook)]} {
+	set F(flags,$hook) {}
+    }
+
     set idx [lsearch -exact $F(flags,$hook) $flag]
     set F(flags,$hook) [lreplace $F(flags,$hook) $idx $idx]
 }
 
 proc hook::unset_flag {hook flag} {
     variable F
+
+    if {![info exists F(flags,$hook)]} {
+	set F(flags,$hook) {}
+    }
+
     if {[lsearch -exact $F(flags,$hook) $flag] < 0} {
 	lappend F(flags,$hook) $flag
     }
@@ -46,6 +56,11 @@
 
 proc hook::is_flag {hook flag} {
     variable F
+
+    if {![info exists F(flags,$hook)]} {
+	set F(flags,$hook) {}
+    }
+
     return [expr {[lsearch -exact $F(flags,$hook) $flag] < 0}]
 }
 



More information about the Tkabber-dev mailing list