[Tkabber-dev] r1724 - trunk/tkabber

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Fri Mar 13 20:21:40 MSK 2009


Author: sergei
Date: 2009-03-13 20:21:40 +0300 (Fri, 13 Mar 2009)
New Revision: 1724

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/custom.tcl
Log:
	* custom.tcl: Remove variable traces before creating or recreating it.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2009-03-13 17:20:47 UTC (rev 1723)
+++ trunk/tkabber/ChangeLog	2009-03-13 17:21:40 UTC (rev 1724)
@@ -11,6 +11,8 @@
 	* plugins/general/captcha.tcl: Added id attribute to sent CAPTCHA form
 	  because id is mandatory for an IQ.
 
+	* custom.tcl: Remove variable traces before creating or recreating it.
+
 2009-03-12  Sergei Golovan  <sgolovan at nes.ru>
 
 	* plugins/general/bob.tcl: Added two procedures which collect Bits of

Modified: trunk/tkabber/custom.tcl
===================================================================
--- trunk/tkabber/custom.tcl	2009-03-13 17:20:47 UTC (rev 1723)
+++ trunk/tkabber/custom.tcl	2009-03-13 17:21:40 UTC (rev 1724)
@@ -51,18 +51,23 @@
 
     set fullname [uplevel 1 {namespace current}]::$vname
 
-    if {![info exists $fullname]} {
-	set $fullname $value
+    if {[info exists $fullname]} {
+	set v [set $fullname]
 
-	trace variable $fullname w \
-	    [list [namespace current]::on_var_change $fullname]
-    } elseif {![info exists var(default,$fullname)]} {
-	set var(config,$fullname) $value
+	if {![info exists var(default,$fullname)]} {
+	    set var(config,$fullname) $v
+	}
 
-	trace variable $fullname w \
-	    [list [namespace current]::on_var_change $fullname]
+	# Removing any existing trace
+	unset $fullname
+	set $fullname $v
+    } else {
+	set $fullname $value
     }
 
+    trace variable $fullname w \
+	  [list [namespace current]::on_var_change $fullname]
+
     set var(default,$fullname) $value
     set var(doc,$fullname) $doc
     set var(type,$fullname) string



More information about the Tkabber-dev mailing list