[Tkabber-dev] [tclxmpp] r173 committed - * xmpp/sasl.tcl: Send XMPP session IQ only if it's present in the...

tclxmpp at googlecode.com tclxmpp at googlecode.com
Thu Jan 30 18:37:28 MSK 2014


Revision: 173
Author:   sgolovan
Date:     Thu Jan 30 14:37:15 2014 UTC
Log:      	* xmpp/sasl.tcl: Send XMPP session IQ only if it's present in the
	  stream features list.

http://code.google.com/p/tclxmpp/source/detail?r=173

Modified:
  /trunk/ChangeLog
  /trunk/xmpp/sasl.tcl

=======================================
--- /trunk/ChangeLog	Tue Jan 28 18:18:05 2014 UTC
+++ /trunk/ChangeLog	Thu Jan 30 14:37:15 2014 UTC
@@ -1,3 +1,8 @@
+2014-01-30  Sergei Golovan  <sgolovan at nes.ru>
+
+	* xmpp/sasl.tcl: Send XMPP session IQ only if it's present in the
+	  stream features list.
+
  2014-01-28  Sergei Golovan  <sgolovan at nes.ru>

  	* doc/xmpp_xml.man: Fixed header (Fixes issue 3).
=======================================
--- /trunk/xmpp/sasl.tcl	Tue Dec  3 11:10:12 2013 UTC
+++ /trunk/xmpp/sasl.tcl	Thu Jan 30 14:37:15 2014 UTC
@@ -794,7 +794,9 @@
                  set state(id) \
                      [::xmpp::sendIQ $xlib set \
                              -query $data \
-                            -command [namespace code [list SendSession  
$token]]]
+                            -command [namespace code [list SendSession \
+                                                           $token \
+                                                           $featuresList]]]
                  return
              }
          }
@@ -829,7 +831,7 @@

  ##########################################################################

-proc ::xmpp::sasl::SendSession {token status xmlData} {
+proc ::xmpp::sasl::SendSession {token featuresList status xmlData} {
      variable $token
      upvar 0 $token state
      set xlib $state(xlib)
@@ -849,14 +851,23 @@
                      }
                  }
              }
-            # Establish the session.
-            set data [::xmpp::xml::create session \
-                              -xmlns urn:ietf:params:xml:ns:xmpp-session]
+            foreach feature $featuresList {
+                ::xmpp::xml::split $feature tag xmlns attrs cdata subels
+
+                if {[string equal $xmlns  
urn:ietf:params:xml:ns:xmpp-session] &&
+                        [string equal $tag session]} {
+                    # Establish the session.
+                    set data [::xmpp::xml::create session \
+                                    -xmlns  
urn:ietf:params:xml:ns:xmpp-session]

-            set state(id) \
-                [::xmpp::sendIQ $xlib set \
-                        -query $data \
-                        -command [namespace code [list Finish $token]]]
+                    set state(id) \
+                        [::xmpp::sendIQ $xlib set \
+                                -query $data \
+                                -command [namespace code [list Finish  
$token]]]
+                    return
+                }
+            }
+            Finish $token ok $xmlData
          }
          default {
              Finish $token $status $xmlData


More information about the Tkabber-dev mailing list