[Tkabber-dev] [tclxmpp commit] r42 - in trunk: . xmpp

codesite-noreply at google.com codesite-noreply at google.com
Mon Oct 20 23:48:38 MSD 2008


Author: sgolovan
Date: Mon Oct 20 12:47:36 2008
New Revision: 42

Modified:
    trunk/ChangeLog
    trunk/xmpp/starttls.tcl
    trunk/xmpp/tls.tcl

Log:
	* xmpp/starttls.tcl, xmpp/tls.tcl: Changed -callback option to
	  -verifycommand and added -infocommand option which specifies
	  command to call upon successfully established TLS connection with
	  socket TLS status.


Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	(original)
+++ trunk/ChangeLog	Mon Oct 20 12:47:36 2008
@@ -7,6 +7,11 @@

  	* doc/xmpp.man: Added preliminary manual page for xmpp package.

+	* xmpp/starttls.tcl, xmpp/tls.tcl: Changed -callback option to
+	  -verifycommand and added -infocommand option which specifies
+	  command to call upon successfully established TLS connection with
+	  socket TLS status.
+
  2008-10-19  Sergei Golovan  <sgolovan at nes.ru>

  	* xmpp/xmpp.tcl: Fixed race condition where transport was already

Modified: trunk/xmpp/starttls.tcl
==============================================================================
--- trunk/xmpp/starttls.tcl	(original)
+++ trunk/xmpp/starttls.tcl	Mon Oct 20 12:47:36 2008
@@ -33,8 +33,11 @@
  #                               arguments: status ("ok", "error", "abort"  
or
  #                               "timeout") and either new stream session  
ID if
  #                               status is "ok", or error stanza otherwise.
-#       -callback               TLS callback (it turns into -command option
+#       -verifycommand          TLS callback (it turns into -command option
  #                               for ::tls::import).
+#       -infocommand            Callback to get status of an established
+#                               TLS connection. It is calles wit a list of
+#                               key-value pairs returned from tls::status.
  #       -castore                If this option points to a file then it's
  #                               equivalent to -cafile, if it points to a
  #                               directory then it's equivalent to -cadir.
@@ -82,21 +85,20 @@

      foreach {key val} $args {
          switch -- $key {
-            -castore  -
-            -cadir    -
-            -cafile   -
-            -certfile -
-            -keyfile  -
-            -ssl2     -
-            -ssl3     -
-            -tls1     -
-            -request  -
-            -require  -
-            -password {
+            -castore       -
+            -cadir         -
+            -cafile        -
+            -certfile      -
+            -keyfile       -
+            -ssl2          -
+            -ssl3          -
+            -tls1          -
+            -request       -
+            -require       -
+            -password      -
+            -verifycommand -
+            -infocommand   {
                  lappend state(tlsArgs) $key $val
-            }
-            -callback {
-                lappend state(tlsArgs) -command $val
              }
              -command {
                  set state($key) $val

Modified: trunk/xmpp/tls.tcl
==============================================================================
--- trunk/xmpp/tls.tcl	(original)
+++ trunk/xmpp/tls.tcl	Mon Oct 20 12:47:36 2008
@@ -57,14 +57,17 @@
  #       -stanzacommand        cmd3  Command to call when XMPP stanza is
  #                                   received.
  #       -eofcommand           cmd4  End-of-file callback.
-#       -callback               TLS callback (it turns into -command option
-#                               for ::tls::import).
-#       -castore                If this option points to a file then it's
-#                               equivalent to -cafile, if it points to a
-#                               directory then it's equivalent to -cadir.
+#       -verifycommand              TLS callback (it turns into -command  
option
+#                                   for ::tls::import).
+#       -infocommand                Callback to get status of an  
established
+#                                   TLS connection. It is calles wit a  
list of
+#                                   key-value pairs returned from  
tls::status.
+#       -castore                    If this option points to a file then  
it's
+#                                   equivalent to -cafile, if it points to  
a
+#                                   directory then it's equivalent to  
-cadir.
  #
-#       -cadir                  Options for ::tls::import procedure (see
-#       -cafile                 tls package manual for details).
+#       -cadir                      Options for ::tls::import procedure  
(see
+#       -cafile                     tls package manual for details).
  #       -certfile
  #       -keyfile
  #       -ssl2
@@ -131,8 +134,9 @@
              -tls1                 -
              -request              -
              -require              -
-            -password             {lappend tlsArgs $key $val}
-            -callback             {lappend tlsArgs -command $val}
+            -password             -
+            -verifycommand        -
+            -infocommand          {lappend tlsArgs $key $val}
              default               {lappend newArgs $key $val}
          }
      }
@@ -223,6 +227,11 @@
  #
  # Arguments:
  #       token                   Transport control token.
+#       -verifycommand          TLS callback (it turns into -command option
+#                               for ::tls::import).
+#       -infocommand            Callback to get status of an established
+#                               TLS connection. It is calles wit a list of
+#                               key-value pairs returned from tls::status.
  #       -castore                If this option points to a file then it's
  #                               equivalent to -cafile, if it points to a
  #                               directory then it's equivalent to -cadir.
@@ -237,7 +246,6 @@
  #       -request
  #       -require
  #       -password
-#       -command
  #
  # Result:
  #       Empty string.
@@ -259,6 +267,12 @@
                      lappend newArgs -cafile $val
                  }
              }
+            -verifycommand {
+                lappend newArgs -command $val
+            }
+            -infocommand {
+                set infoCmd $val
+            }
              default {lappend newArgs $key $val}
          }
      }
@@ -285,6 +299,10 @@
      fileevent $state(sock) readable [namespace code [list InText $token]]

      set state(transport) tls
+
+    if {[info exists infoCmd]} {
+        eval $infoCmd [::tls::status $state(sock)]
+    }

      return $token
  }


More information about the Tkabber-dev mailing list