Stanza:get_name() only returns the name of the tag, without the namespace
This commit is contained in:
@@ -61,15 +61,15 @@ XmppComponent::XmppComponent(const std::string& hostname, const std::string& sec
|
|||||||
std::placeholders::_1));
|
std::placeholders::_1));
|
||||||
this->parser.add_stream_close_callback(std::bind(&XmppComponent::on_remote_stream_close, this,
|
this->parser.add_stream_close_callback(std::bind(&XmppComponent::on_remote_stream_close, this,
|
||||||
std::placeholders::_1));
|
std::placeholders::_1));
|
||||||
this->stanza_handlers.emplace(COMPONENT_NS":handshake",
|
this->stanza_handlers.emplace("handshake",
|
||||||
std::bind(&XmppComponent::handle_handshake, this,std::placeholders::_1));
|
std::bind(&XmppComponent::handle_handshake, this,std::placeholders::_1));
|
||||||
this->stanza_handlers.emplace(COMPONENT_NS":presence",
|
this->stanza_handlers.emplace("presence",
|
||||||
std::bind(&XmppComponent::handle_presence, this,std::placeholders::_1));
|
std::bind(&XmppComponent::handle_presence, this,std::placeholders::_1));
|
||||||
this->stanza_handlers.emplace(COMPONENT_NS":message",
|
this->stanza_handlers.emplace("message",
|
||||||
std::bind(&XmppComponent::handle_message, this,std::placeholders::_1));
|
std::bind(&XmppComponent::handle_message, this,std::placeholders::_1));
|
||||||
this->stanza_handlers.emplace(COMPONENT_NS":iq",
|
this->stanza_handlers.emplace("iq",
|
||||||
std::bind(&XmppComponent::handle_iq, this,std::placeholders::_1));
|
std::bind(&XmppComponent::handle_iq, this,std::placeholders::_1));
|
||||||
this->stanza_handlers.emplace(STREAM_NS":error",
|
this->stanza_handlers.emplace("error",
|
||||||
std::bind(&XmppComponent::handle_error, this,std::placeholders::_1));
|
std::bind(&XmppComponent::handle_error, this,std::placeholders::_1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include <xmpp/xmpp_stanza.hpp>
|
#include <xmpp/xmpp_stanza.hpp>
|
||||||
|
|
||||||
#include <utils/encoding.hpp>
|
#include <utils/encoding.hpp>
|
||||||
|
#include <utils/split.hpp>
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@@ -183,9 +184,13 @@ XmlNode* XmlNode::get_parent() const
|
|||||||
return this->parent;
|
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
|
std::string XmlNode::to_string() const
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
void close();
|
void close();
|
||||||
XmlNode* get_parent() const;
|
XmlNode* get_parent() const;
|
||||||
const std::string& get_name() const;
|
const std::string get_name() const;
|
||||||
/**
|
/**
|
||||||
* Serialize the stanza into a string
|
* Serialize the stanza into a string
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user