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

codesite-noreply at google.com codesite-noreply at google.com
Sat Oct 18 10:46:48 MSD 2008


Author: sgolovan
Date: Fri Oct 17 23:45:40 2008
New Revision: 31

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

Log:
	* xmpp/sasl.tcl: Use jid procedure instead of directly concatenating
	  user and server names.

	* xmpp/xmpp.tcl: Added packetID command which returns the next free
	  packet ID. Also, removed packet ID resetting on disconnect.


Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	(original)
+++ trunk/ChangeLog	Fri Oct 17 23:45:40 2008
@@ -2,6 +2,12 @@

  	* xmpp/jid.tcl: Added default resource value (empty string).

+	* xmpp/sasl.tcl: Use jid procedure instead of directly concatenating
+	  user and server names.
+
+	* xmpp/xmpp.tcl: Added packetID command which returns the next free
+	  packet ID. Also, removed packet ID resetting on disconnect.
+
  2008-10-17  Sergei Golovan  <sgolovan at nes.ru>

  	* xmpp/streamerror.tcl: Added error condition to the call of error

Modified: trunk/xmpp/sasl.tcl
==============================================================================
--- trunk/xmpp/sasl.tcl	(original)
+++ trunk/xmpp/sasl.tcl	Fri Oct 17 23:45:40 2008
@@ -528,7 +528,8 @@
              # authzid
              if {[info exists state(-username)]} {
                  return [encoding convertto utf-8 \
-                                 $state(-username)@$state(-server)]
+                                 [::xmpp::jid::jid $state(-username) \
+                                                   $state(-server)]]
              } else {
                  return [encoding convertto utf-8 $state(-domain)]
              }
@@ -573,7 +574,8 @@
              # authzid
              if {[info exists state(-username)]} {
                  return [encoding convertto utf-8 \
-                                 $state(-username)@$state(-server)]
+                                 [::xmpp::jid::jid $state(-username) \
+                                                   $state(-server)]]
              } else {
                  return [encoding convertto utf-8 $state(-domain)]
              }

Modified: trunk/xmpp/xmpp.tcl
==============================================================================
--- trunk/xmpp/xmpp.tcl	(original)
+++ trunk/xmpp/xmpp.tcl	Fri Oct 17 23:45:40 2008
@@ -1033,7 +1033,9 @@
                                     -cdata [::msgcat::mc "Disconnected"]]]
      }

-    set state(id) 0
+    # Don't reset ID counter because the higher level application may
+    # still use the old values.
+    #set state(id) 0
      set state(status) disconnected

      # connect
@@ -1653,7 +1655,7 @@

                  # Only the last -command takes effect
                  if {![info exists attrs(id)] || ![info exists cmd]} {
-                    set attrs(id) [incr state(id)]
+                    set attrs(id) [packetID $xlib]
                  }
                  set cmd $val
              }
@@ -1737,6 +1739,26 @@
          uplevel #0 $cmd [list $status $error]
      }
      return
+}
+
+# ::xmpp::packetID --
+#
+#       Return the next free packet ID.
+#
+# Arguments:
+#       xlib            XMPP token.
+#
+# Result:
+#       Packet ID.
+#
+# Side effects:
+#       The next ID value is increased by one.
+
+proc ::xmpp::packetID {xlib} {
+    variable $xlib
+    upvar 0 $xlib state
+
+    return [incr state(id)]
  }

  # ::xmpp::CallBack --


More information about the Tkabber-dev mailing list