[Tkabber-dev] r2063 - in trunk/tkabber-plugins: . otr otr/tclotr

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sun Jan 19 17:55:55 MSK 2014


Author: sergei
Date: 2014-01-19 17:55:55 +0400 (Sun, 19 Jan 2014)
New Revision: 2063

Modified:
   trunk/tkabber-plugins/ChangeLog
   trunk/tkabber-plugins/otr/otr.tcl
   trunk/tkabber-plugins/otr/tclotr/message.tcl
   trunk/tkabber-plugins/otr/tclotr/otr.tcl
Log:
	* otr/otr.tcl, otr/tclotr/message.tcl: Got rid of eval and uplevel
	  calls.


Modified: trunk/tkabber-plugins/ChangeLog
===================================================================
--- trunk/tkabber-plugins/ChangeLog	2014-01-19 13:16:11 UTC (rev 2062)
+++ trunk/tkabber-plugins/ChangeLog	2014-01-19 13:55:55 UTC (rev 2063)
@@ -13,6 +13,9 @@
 	* otr/*: SMP protocol is now working, but its outcome isn't utilised
 	  anywhere.
 
+	* otr/otr.tcl, otr/tclotr/message.tcl: Got rid of eval and uplevel
+	  calls.
+
 2014-01-18  Sergei Golovan <sgolovan at nes.ru>
 
 	* otr/*: Better error reporting. Continue implementing peer
@@ -29,11 +32,11 @@
 	* otr/tclotr/crypto.tcl: Added procedure which computes binary
 	  DSA public key fingerprint.
 
-	* otr/tclotr/otr.tcl: Don't compute DSA key fingerprint directly, but convert
-	  the one computed in the otr::crypto package.
+	* otr/tclotr/otr.tcl: Don't compute DSA key fingerprint directly, but
+	  convert the one computed in the otr::crypto package.
 
-	* otr/tclotr/smp.tcl: Initially implemented parsing, creating and verifying
-	  OTR SMP messages.
+	* otr/tclotr/smp.tcl: Initially implemented parsing, creating and
+	  verifying OTR SMP messages.
 
 2014-01-01  Sergei Golovan <sgolovan at nes.ru>
 
@@ -124,7 +127,8 @@
 
 2010-11-11  Konstantin Khomoutov <flatworm at users.sourceforge.net>
 
-	* singularity/singularity.tcl: Make singularity plugin dynamically loadable.
+	* singularity/singularity.tcl: Make singularity plugin dynamically
+	  loadable.
 
 2010-11-10  Konstantin Khomoutov <flatworm at users.sourceforge.net>
 

Modified: trunk/tkabber-plugins/otr/otr.tcl
===================================================================
--- trunk/tkabber-plugins/otr/otr.tcl	2014-01-19 13:16:11 UTC (rev 2062)
+++ trunk/tkabber-plugins/otr/otr.tcl	2014-01-19 13:55:55 UTC (rev 2063)
@@ -704,7 +704,7 @@
 	    if {[info exists type]} {
 		lappend command -type $type
 	    } 
-	    eval $command
+	    {*}$command
 	}
     }
 

Modified: trunk/tkabber-plugins/otr/tclotr/message.tcl
===================================================================
--- trunk/tkabber-plugins/otr/tclotr/message.tcl	2014-01-19 13:16:11 UTC (rev 2062)
+++ trunk/tkabber-plugins/otr/tclotr/message.tcl	2014-01-19 13:55:55 UTC (rev 2063)
@@ -201,7 +201,7 @@
                 # There's no point to continue SMP if any in progress
                 set msgstate MSGSTATE_FINISHED
                 set smpstate SMPSTATE_EXPECT1
-                uplevel #0 $smpcommand clear
+                {*}$smpcommand clear
                 return [list msgstate $msgstate \
                              smpstate $smpstate \
                              {*}$msg]
@@ -221,29 +221,29 @@
                 # Don't process it immediately, just store and go
                 # after the user will supply the shared secret
 
-                uplevel #0 $smpcommand set data1     [list $value]
-                uplevel #0 $smpcommand set dhpubkey  [list $gy1]
-                uplevel #0 $smpcommand set dhprivkey [list $x]
+                {*}$smpcommand set data1     $value
+                {*}$smpcommand set dhpubkey  $gy1
+                {*}$smpcommand set dhprivkey $x
 
                 return [list nextkey $gy interaction smp]
             }
             3 {
                 # SMP message 2
 
-                set x  [uplevel #0 $smpcommand get x]
-                set a2 [uplevel #0 $smpcommand get a2]
-                set a3 [uplevel #0 $smpcommand get a3]
+                set x  [{*}$smpcommand get x]
+                set a2 [{*}$smpcommand get a2]
+                set a3 [{*}$smpcommand get a3]
                 lassign [::otr::smp::processSMPMessage2 \
                                     $smpstate $value $x $a2 $a3] \
                         smpstate tlv payload g3b PaPb QaQb Ra
                 if {$tlv == 6} {
-                    uplevel #0 $smpcommand clear
+                    {*}$smpcommand clear
                     set answer SMP_CHEATING
                 } else {
-                    uplevel #0 $smpcommand set g3b  $g3b
-                    uplevel #0 $smpcommand set PaPb $PaPb
-                    uplevel #0 $smpcommand set QaQb $QaQb
-                    uplevel #0 $smpcommand set Ra   $Ra
+                    {*}$smpcommand set g3b  $g3b
+                    {*}$smpcommand set PaPb $PaPb
+                    {*}$smpcommand set QaQb $QaQb
+                    {*}$smpcommand set Ra   $Ra
                     set answer SMP_PROGRESS
                 }
                 return [list msgstate $msgstate \
@@ -256,17 +256,17 @@
             4 {
                 # SMP message 3
 
-                set g3a [uplevel #0 $smpcommand get g3a]
-                set g2  [uplevel #0 $smpcommand get g2]
-                set g3  [uplevel #0 $smpcommand get g3]
-                set b3  [uplevel #0 $smpcommand get b3]
-                set Pb  [uplevel #0 $smpcommand get Pb]
-                set Qb  [uplevel #0 $smpcommand get Qb]
+                set g3a [{*}$smpcommand get g3a]
+                set g2  [{*}$smpcommand get g2]
+                set g3  [{*}$smpcommand get g3]
+                set b3  [{*}$smpcommand get b3]
+                set Pb  [{*}$smpcommand get Pb]
+                set Qb  [{*}$smpcommand get Qb]
                 lassign [::otr::smp::processSMPMessage3 \
                                 $smpstate $value $g3a $g2 $g3 $b3 $Pb $Qb] \
                         smpstate tlv payload res
                 if {$tlv == 6} {
-                    uplevel #0 $smpcommand clear
+                    {*}$smpcommand clear
                     set answer SMP_CHEATING
                 } else {
                     if {$res} {
@@ -285,16 +285,16 @@
             5 {
                 # SMP message 4
 
-                set a3   [uplevel #0 $smpcommand get a3]
-                set g3b  [uplevel #0 $smpcommand get g3b]
-                set PaPb [uplevel #0 $smpcommand get PaPb]
-                set QaQb [uplevel #0 $smpcommand get QaQb]
-                set Ra   [uplevel #0 $smpcommand get Ra]
+                set a3   [{*}$smpcommand get a3]
+                set g3b  [{*}$smpcommand get g3b]
+                set PaPb [{*}$smpcommand get PaPb]
+                set QaQb [{*}$smpcommand get QaQb]
+                set Ra   [{*}$smpcommand get Ra]
                 lassign [::otr::smp::processSMPMessage4 \
                                 $smpstate $value $a3 $g3b $PaPb $QaQb $Ra] \
                         smpstate tlv payload res
                 
-                uplevel #0 $smpcommand clear
+                {*}$smpcommand clear
                 if {$tlv == 6} {
                     set answer SMP_CHEATING
                     set tlvp [list $tlv $payload]
@@ -317,7 +317,7 @@
                 # SMP abort message
 
                 set smpstate SMPSTATE_EXPECT1
-                uplevel #0 $smpcommand clear
+                {*}$smpcommand clear
                 return [list msgstate $msgstate \
                              smpstate $smpstate \
                              nextkey  $gy \
@@ -332,7 +332,7 @@
                 set idx [string first \x00 $value]
                 if {$idx < 0} {
                     set smpstate SMPSTATE_EXPECT1
-                    uplevel #0 $smpcommand clear
+                    {*}$smpcommand clear
                     return [list msgstate $msgstate \
                                  smpstate $smpstate \
                                  nextkey  $gy \
@@ -344,9 +344,9 @@
                                        [string range $value 0 [expr {$idx-1}]]]
                 set value [string range $value [expr {$idx+1}] end]
 
-                uplevel #0 $smpcommand set data1     [list $value]
-                uplevel #0 $smpcommand set dhpubkey  [list $gy1]
-                uplevel #0 $smpcommand set dhprivkey [list $x]
+                {*}$smpcommand set data1     $value
+                {*}$smpcommand set dhpubkey  $gy1
+                {*}$smpcommand set dhprivkey $x
 
                 return [list nextkey $gy interaction smp question $question]
             }

Modified: trunk/tkabber-plugins/otr/tclotr/otr.tcl
===================================================================
--- trunk/tkabber-plugins/otr/tclotr/otr.tcl	2014-01-19 13:16:11 UTC (rev 2062)
+++ trunk/tkabber-plugins/otr/tclotr/otr.tcl	2014-01-19 13:55:55 UTC (rev 2063)
@@ -622,9 +622,11 @@
             state(PublicKey) gy keyidy
 
     if {$message eq ""} {
+        # Failure
         return [list authstate $state(AuthState) \
                      msgstate  $state(MsgState)]
     } else {
+        # Success
         UpdatePeerDHKeysAfterAKE $token $gy $keyidy
         StoreSSID $token
 
@@ -652,6 +654,8 @@
             state(AuthState) state(MsgState) message state(PublicKey) keyidy
 
     if {$keyidy ne ""} {
+        # Success
+
         UpdatePeerDHKeysAfterAKE $token $state(gy) $keyidy
         StoreSSID $token
 



More information about the Tkabber-dev mailing list