Stanza:get_name() only returns the name of the tag, without the namespace

This commit is contained in:
Florent Le Coz
2014-05-15 00:32:31 +02:00
parent 12c8b1ae0b
commit bafde1af9f
3 changed files with 13 additions and 8 deletions
+7 -2
View File
@@ -1,6 +1,7 @@
#include <xmpp/xmpp_stanza.hpp>
#include <utils/encoding.hpp>
#include <utils/split.hpp>
#include <stdexcept>
#include <iostream>
@@ -183,9 +184,13 @@ XmlNode* XmlNode::get_parent() const
return this->parent;
}
const std::string& XmlNode::get_name() const
const std::string XmlNode::get_name() const
{
return this->name;
const std::vector<std::string> splited = utils::split(this->name, ':', false);
if (splited.empty())
return "";
const std::string res = splited.back();
return res;
}
std::string XmlNode::to_string() const