[Tkabber-dev] [tclxmpp commit] r91 - * xmpp/disco.tcl: Cache negative answers to info and items queries

codesite-noreply at google.com codesite-noreply at google.com
Tue Mar 17 09:21:06 MSK 2009


Author: sgolovan
Date: Mon Mar 16 23:20:36 2009
New Revision: 91

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

Log:
	* xmpp/disco.tcl: Cache negative answers to info and items queries
	  also.


Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	(original)
+++ trunk/ChangeLog	Mon Mar 16 23:20:36 2009
@@ -1,3 +1,8 @@
+2009-03-17  Sergei Golovan  <sgolovan at nes.ru>
+
+	* xmpp/disco.tcl: Cache negative answers to info and items queries
+	  also.
+
  2009-03-15  Sergei Golovan  <sgolovan at nes.ru>

  	* xmpp/data.tcl: Parse data forms media items.

Modified: trunk/xmpp/disco.tcl
==============================================================================
--- trunk/xmpp/disco.tcl	(original)
+++ trunk/xmpp/disco.tcl	Mon Mar 16 23:20:36 2009
@@ -30,7 +30,7 @@

      set state(xlib) $xlib
      set state(cache) {}
-    set state(size) 200
+    set state(size) 500

      foreach {key val} $args {
          switch -- $key {
@@ -150,6 +150,14 @@
      if {![info exists state(xlib)]} return

      if {![string equal $status ok]} {
+        if {$cache} {
+            lappend state(cache) [list [list info $jid $node] $status $xml]
+
+            if {[llength $state(cache)] > $state(size)} {
+                set state(cache) [lrange $state(cache) 1 end]
+            }
+        }
+
          if {[llength $commands] > 0} {
              uplevel #0 [lindex $commands 0] [list $status $xml]
          }
@@ -275,6 +283,14 @@
      if {![info exists state(xlib)]} return

      if {![string equal $status ok]} {
+        if {$cache} {
+            lappend state(cache) [list [list items $jid $node] $status  
$xml]
+
+            if {[llength $state(cache)] > $state(size)} {
+                set state(cache) [lrange $state(cache) 1 end]
+            }
+        }
+
          if {[llength $commands] > 0} {
              uplevel #0 [lindex $commands 0] [list $status $xml]
          }


More information about the Tkabber-dev mailing list