diff options
author | fiaxh <git@mx.ax.lt> | 2017-05-30 22:17:41 +0200 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2017-05-30 22:28:36 +0200 |
commit | 3a8df2069eba3a5a4174749fc46a6698c1877ec1 (patch) | |
tree | b39cffc773f3984acaa7dab92d0eb160faa48e32 /xmpp-vala/src/core | |
parent | 142257a544b36e60b738e55e5f9f096f1169c389 (diff) | |
download | dino-3a8df2069eba3a5a4174749fc46a6698c1877ec1.tar.gz dino-3a8df2069eba3a5a4174749fc46a6698c1877ec1.zip |
MUC config form (data forms), MUC room info
Diffstat (limited to 'xmpp-vala/src/core')
-rw-r--r-- | xmpp-vala/src/core/stanza_node.vala | 16 | ||||
-rw-r--r-- | xmpp-vala/src/core/stanza_reader.vala | 11 |
2 files changed, 14 insertions, 13 deletions
diff --git a/xmpp-vala/src/core/stanza_node.vala b/xmpp-vala/src/core/stanza_node.vala index fd44c925..026b8ddb 100644 --- a/xmpp-vala/src/core/stanza_node.vala +++ b/xmpp-vala/src/core/stanza_node.vala @@ -45,8 +45,8 @@ public abstract class StanzaEntry { } public class StanzaNode : StanzaEntry { - public ArrayList<StanzaNode> sub_nodes = new ArrayList<StanzaNode>(); - public ArrayList<StanzaAttribute> attributes = new ArrayList<StanzaAttribute>(); + public Gee.List<StanzaNode> sub_nodes = new ArrayList<StanzaNode>(); + public Gee.List<StanzaAttribute> attributes = new ArrayList<StanzaAttribute>(); public bool has_nodes = false; public bool pseudo = false; @@ -129,7 +129,7 @@ public class StanzaNode : StanzaEntry { return null; } - public ArrayList<StanzaAttribute> get_attributes_by_ns_uri(string ns_uri) { + public Gee.List<StanzaAttribute> get_attributes_by_ns_uri(string ns_uri) { ArrayList<StanzaAttribute> ret = new ArrayList<StanzaAttribute> (); foreach (var attr in attributes) { if (attr.ns_uri == ns_uri) ret.add(attr); @@ -181,7 +181,7 @@ public class StanzaNode : StanzaEntry { return null; } - public ArrayList<StanzaNode> get_subnodes(string name, string? ns_uri = null, bool recurse = false) { + public Gee.List<StanzaNode> get_subnodes(string name, string? ns_uri = null, bool recurse = false) { ArrayList<StanzaNode> ret = new ArrayList<StanzaNode>(); string _name = name; string? _ns_uri = ns_uri; @@ -220,12 +220,12 @@ public class StanzaNode : StanzaEntry { return node; } - public ArrayList<StanzaNode> get_deep_subnodes(...) { + public Gee.List<StanzaNode> get_deep_subnodes(...) { va_list l = va_list(); return get_deep_subnodes_(va_list.copy(l)); } - public ArrayList<StanzaNode> get_deep_subnodes_(va_list l) { + public Gee.List<StanzaNode> get_deep_subnodes_(va_list l) { StanzaNode node = this; string? subnode_name = l.arg(); if (subnode_name == null) return new ArrayList<StanzaNode>(); @@ -240,11 +240,11 @@ public class StanzaNode : StanzaEntry { return node.get_subnodes((!)subnode_name); } - public ArrayList<StanzaNode> get_all_subnodes() { + public Gee.List<StanzaNode> get_all_subnodes() { return sub_nodes; } - public ArrayList<StanzaNode> get_deep_all_subnodes(...) { + public Gee.List<StanzaNode> get_deep_all_subnodes(...) { va_list l = va_list(); StanzaNode? node = get_deep_subnode_(va_list.copy(l)); if (node != null) return ((!)node).get_all_subnodes(); diff --git a/xmpp-vala/src/core/stanza_reader.vala b/xmpp-vala/src/core/stanza_reader.vala index f1ce5c19..dd284fa6 100644 --- a/xmpp-vala/src/core/stanza_reader.vala +++ b/xmpp-vala/src/core/stanza_reader.vala @@ -230,13 +230,13 @@ public class StanzaReader { skip_single(); if (desc.contains(":")) { var split = desc.split(":"); - assert(split[0] == ns_state.find_name((!)res.ns_uri)); - assert(split[1] == res.name); + if (split[0] != ns_state.find_name((!)res.ns_uri)) throw new XmlError.BAD_XML(""); + if (split[1] != res.name) throw new XmlError.BAD_XML(""); } else { - assert(ns_state.current_ns_uri == res.ns_uri); - assert(desc == res.name); + if (ns_state.current_ns_uri != res.ns_uri) throw new XmlError.BAD_XML(""); + if (desc != res.name) throw new XmlError.BAD_XML(""); } - return res; + finishNodeSeen = true; } else { res.sub_nodes.add(read_stanza_node(ns_state.clone())); ns_state = baseNs ?? new NamespaceState.for_stanza(); @@ -245,6 +245,7 @@ public class StanzaReader { res.sub_nodes.add(read_text_node()); } } while (!finishNodeSeen); + if (res.sub_nodes.size == 0) res.has_nodes = false; } return res; } |