summaryrefslogtreecommitdiff
path: root/louloulibs/xmpp
diff options
context:
space:
mode:
Diffstat (limited to 'louloulibs/xmpp')
-rw-r--r--louloulibs/xmpp/xmpp_stanza.cpp6
-rw-r--r--louloulibs/xmpp/xmpp_stanza.hpp1
2 files changed, 7 insertions, 0 deletions
diff --git a/louloulibs/xmpp/xmpp_stanza.cpp b/louloulibs/xmpp/xmpp_stanza.cpp
index 3ba8483..4c0f5c7 100644
--- a/louloulibs/xmpp/xmpp_stanza.cpp
+++ b/louloulibs/xmpp/xmpp_stanza.cpp
@@ -178,6 +178,12 @@ XmlNode* XmlNode::add_child(XmlNode&& child)
return this->add_child(std::move(new_node));
}
+XmlNode* XmlNode::add_child(const XmlNode& child)
+{
+ auto new_node = std::make_unique<XmlNode>(child);
+ return this->add_child(std::move(new_node));
+}
+
XmlNode* XmlNode::get_last_child() const
{
return this->children.back().get();
diff --git a/louloulibs/xmpp/xmpp_stanza.hpp b/louloulibs/xmpp/xmpp_stanza.hpp
index 4a54379..9cf7d8d 100644
--- a/louloulibs/xmpp/xmpp_stanza.hpp
+++ b/louloulibs/xmpp/xmpp_stanza.hpp
@@ -87,6 +87,7 @@ public:
*/
XmlNode* add_child(std::unique_ptr<XmlNode> child);
XmlNode* add_child(XmlNode&& child);
+ XmlNode* add_child(const XmlNode& child);
/**
* Returns the last of the children. If the node doesn't have any child,
* the behaviour is undefined. The user should make sure this is the case