summaryrefslogtreecommitdiff
path: root/src/xmpp/xmpp_stanza.cpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2014-05-30 03:52:22 +0200
committerFlorent Le Coz <louiz@louiz.org>2014-05-30 04:00:29 +0200
commitd33a3b7d3587c22d54761e3ed04c85452d7ec550 (patch)
tree7b8a376dd06ce27a2bbfad78313d809c1f18b86d /src/xmpp/xmpp_stanza.cpp
parent6bde78b5743d6b323b9af14d434927fd175175c3 (diff)
downloadbiboumi-d33a3b7d3587c22d54761e3ed04c85452d7ec550.tar.gz
biboumi-d33a3b7d3587c22d54761e3ed04c85452d7ec550.tar.bz2
biboumi-d33a3b7d3587c22d54761e3ed04c85452d7ec550.tar.xz
biboumi-d33a3b7d3587c22d54761e3ed04c85452d7ec550.zip
XmlNode::get_children, to get a list of matching children instead of the first
Diffstat (limited to 'src/xmpp/xmpp_stanza.cpp')
-rw-r--r--src/xmpp/xmpp_stanza.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/xmpp/xmpp_stanza.cpp b/src/xmpp/xmpp_stanza.cpp
index c964c64..4290fc7 100644
--- a/src/xmpp/xmpp_stanza.cpp
+++ b/src/xmpp/xmpp_stanza.cpp
@@ -162,6 +162,17 @@ XmlNode* XmlNode::get_child(const std::string& name, const std::string& xmlns) c
return nullptr;
}
+std::vector<XmlNode*> XmlNode::get_children(const std::string& name, const std::string& xmlns) const
+{
+ std::vector<XmlNode*> res;
+ for (auto& child: this->children)
+ {
+ if (child->name == name && child->get_tag("xmlns") == xmlns)
+ res.push_back(child);
+ }
+ return res;
+}
+
XmlNode* XmlNode::add_child(XmlNode* child)
{
child->parent = this;