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

codesite-noreply at google.com codesite-noreply at google.com
Thu Feb 12 23:36:51 MSK 2009


Author: sgolovan
Date: Thu Feb 12 11:03:56 2009
New Revision: 77

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

Log:
	* xmpp/metacontacts.tcl: Made interface to retrieve/store procedures
	  more convenient.


Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	(original)
+++ trunk/ChangeLog	Thu Feb 12 11:03:56 2009
@@ -1,3 +1,8 @@
+2009-02-12  Sergei Golovan  <sgolovan at nes.ru>
+
+	* xmpp/metacontacts.tcl: Made interface to retrieve/store procedures
+	  more convenient.
+
  2009-02-11  Sergei Golovan  <sgolovan at nes.ru>

  	* xmpp/private.tcl: Added simple interface to private XML storage

Modified: trunk/xmpp/metacontacts.tcl
==============================================================================
--- trunk/xmpp/metacontacts.tcl	(original)
+++ trunk/xmpp/metacontacts.tcl	Thu Feb 12 11:03:56 2009
@@ -52,8 +52,6 @@
          uplevel #0 [lindex $commands 0] [list $status $xml]
      }

-    set contacts {}
-
      foreach xmldata $xml {
          ::xmpp::xml::split $xmldata tag xmlns attrs cdata subels

@@ -64,13 +62,22 @@
                  set jid   [::xmpp::xml::getAttr $sattrs jid]
                  set tag   [::xmpp::xml::getAttr $sattrs tag]
                  set order [::xmpp::xml::getAttr $sattrs order]
+                if {![string is integer -strict $order]} {
+                    set order 0
+                }

-                lappend contacts [list jid $jid tag $tag order $order]
+                lappend contacts($tag) [list $jid $order]
              }
          }
      }

-    uplevel #0 [lindex $commands 0] [list ok $contacts]
+    foreach tag [array names contacts] {
+        foreach jo [lsort -integer -index 1 $contacts($tag)] {
+            lappend result($tag) [lindex $jo 0]
+        }
+    }
+
+    uplevel #0 [lindex $commands 0] [list ok [array get result]]
      return
  }

@@ -94,14 +101,14 @@
      }

      set tags {}
-    foreach meta $contacts {
-        array unset n
-        array set n $meta
-
-        set attrs [list jid $n(jid) tag $n(tag) order $n(order)]
+    foreach {tag jids} $contacts {
+        set order 1
+        foreach jid $jids {
+            set attrs [list jid $jid tag $tag order $order]

-        lappend tags [::xmpp::xml::create meta \
-                                          -attrs $vars]
+            lappend tags [::xmpp::xml::create meta -attrs $attrs]
+            incr order
+        }
      }

      set id \


More information about the Tkabber-dev mailing list