[Tkabber-dev] [tclxmpp commit] r106 - * xmpp/https.tcl: Fixed typo in status message.

codesite-noreply at google.com codesite-noreply at google.com
Fri Apr 17 20:32:48 MSD 2009


Author: sgolovan
Date: Fri Apr 17 09:21:15 2009
New Revision: 106

Modified:
    trunk/ChangeLog
    trunk/xmpp/disco.tcl
    trunk/xmpp/https.tcl

Log:
	* xmpp/https.tcl: Fixed typo in status message.

	* xmpp/disco.tcl: Do not cache certain error conditions which may be
	  temporary.


Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	(original)
+++ trunk/ChangeLog	Fri Apr 17 09:21:15 2009
@@ -1,3 +1,10 @@
+2009-04-17  Sergei Golovan  <sgolovan at nes.ru>
+
+	* xmpp/https.tcl: Fixed typo in status message.
+
+	* xmpp/disco.tcl: Do not cache certain error conditions which may be
+	  temporary.
+
  2009-04-07  Sergei Golovan  <sgolovan at nes.ru>

  	* xmpp/sasl.tcl: Do encode username and password into UTF-8 charset

Modified: trunk/xmpp/disco.tcl
==============================================================================
--- trunk/xmpp/disco.tcl	(original)
+++ trunk/xmpp/disco.tcl	Fri Apr 17 09:21:15 2009
@@ -13,7 +13,13 @@

  package provide xmpp::disco 0.1

-namespace eval ::xmpp::disco {}
+namespace eval ::xmpp::disco {
+    variable NonCachable {internal-server-error
+                          item-not-found
+                          remote-server-not-found
+                          remote-server-timeout
+                          resource-constraint}
+}

  # ::xmpp::disco::new --

@@ -144,12 +150,20 @@
  # ::xmpp::disco::ParseInfo --

  proc ::xmpp::disco::ParseInfo {token jid node cache commands status xml} {
+    variable NonCachable
      variable $token
      upvar 0 $token state

      if {![info exists state(xlib)]} return

-    if {![string equal $status ok]} {
+    if {[string equal $status error]} {
+        set condition [::xmpp::stanzaerror::condition $xml]
+        if {[lsearch -exact $NonCachable $condition] >= 0} {
+            # Do not cache certain error conditions
+
+            return
+        }
+
          if {$cache && [lsearch -glob $state(cache) \
                                       [list [list info $jid $node] *]] < 0}  
{
              lappend state(cache) [list [list info $jid $node] $status $xml]
@@ -163,6 +177,10 @@
              uplevel #0 [lindex $commands 0] [list $status $xml]
          }
          return
+    } elseif {![string equal $status ok]} {
+        # Do not cache the answer if status is 'abort'
+
+        return
      }

      set identities {}
@@ -279,12 +297,20 @@
  # ::xmpp::disco::ParseItems --

  proc ::xmpp::disco::ParseItems {token jid node cache commands status xml} {
+    variable NonCachable
      variable $token
      upvar 0 $token state

      if {![info exists state(xlib)]} return

-    if {![string equal $status ok]} {
+    if {[string equal $status error]} {
+        set condition [::xmpp::stanzaerror::condition $xml]
+        if {[lsearch -exact $NonCachable $condition] >= 0} {
+            # Do not cache certain error conditions
+
+            return
+        }
+
          if {$cache && [lsearch -glob $state(cache) \
                                       [list [list items $jid $node] *]] <  
0} {
              lappend state(cache) [list [list items $jid $node] $status  
$xml]
@@ -297,6 +323,10 @@
          if {[llength $commands] > 0} {
              uplevel #0 [lindex $commands 0] [list $status $xml]
          }
+        return
+    } elseif {![string equal $status ok]} {
+        # Do not cache the answer if status is 'abort'
+
          return
      }


Modified: trunk/xmpp/https.tcl
==============================================================================
--- trunk/xmpp/https.tcl	(original)
+++ trunk/xmpp/https.tcl	Fri Apr 17 09:21:15 2009
@@ -82,12 +82,12 @@
          catch {close $sock}
          if {$state(async)} {
              after idle $state(-command) \
-                  [list error [::msgcat::mc "Failed to conect to HTTPS  
proxy"]]
+                  [list error [::msgcat::mc "Failed to connect to HTTPS  
proxy"]]
              Free $token
              return $token
          } else {
              Free $token
-            return -code error [::msgcat::mc "Failed to conect to HTTPS  
proxy"]
+            return -code error [::msgcat::mc "Failed to connect to HTTPS  
proxy"]
          }
      }



More information about the Tkabber-dev mailing list