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

codesite-noreply at google.com codesite-noreply at google.com
Sat Nov 1 20:11:29 MSK 2008


Author: sgolovan
Date: Sat Nov  1 10:11:03 2008
New Revision: 53

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

Log:
	* xmpp/data.tcl: Return form type when searching for a data form.
	  Parse field elements in result forms.


Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	(original)
+++ trunk/ChangeLog	Sat Nov  1 10:11:03 2008
@@ -3,6 +3,9 @@
  	* xmpp/xdata.tcl, xmpp/pkgIndex.tcl: Added a new package for working
  	  with data forms (XEP-0004).

+	* xmpp/data.tcl: Return form type when searching for a data form.
+	  Parse field elements in result forms.
+
  2008-10-31  Sergei Golovan  <sgolovan at nes.ru>

  	* xmpp/xmpp.tcl: Protected unsetting of a variable which stores abort

Modified: trunk/xmpp/data.tcl
==============================================================================
--- trunk/xmpp/data.tcl	(original)
+++ trunk/xmpp/data.tcl	Sat Nov  1 10:11:03 2008
@@ -22,10 +22,11 @@
      foreach xmlElement $xmlElements {
          ::xmpp::xml::split $xmlElement tag xmlns attrs cdata subels
          if {[string equal $xmlns jabber:x:data]} {
-            return $xmlElement
+            set type [::xmpp::xml::getAttr $attrs type]
+            return [list $type $xmlElement]
          }
      }
-    return {}
+    return {{} {}}
  }

  # ::xmpp::data::parseForm --
@@ -130,6 +131,21 @@
                      }
                  }
                  lappend res item [list $var $values]
+            }
+            field {
+                set type  [::xmpp::xml::getAttr $sattrs type]
+                set var   [::xmpp::xml::getAttr $sattrs var]
+                set label [::xmpp::xml::getAttr $sattrs label]
+                set values {}
+                foreach ssubel $ssubels {
+                    ::xmpp::xml::split $ssubel \
+                                       sstag ssxmlns ssattrs sscdata  
sssubels
+
+                    if {[string equal $sstag value]} {
+                        lappend values $sscdata
+                    }
+                }
+                lappend res field [list $var $type $label $values]
              }
          }
      }


More information about the Tkabber-dev mailing list