summaryrefslogtreecommitdiff
path: root/louloulibs/xmpp/xmpp_component.cpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2016-02-22 17:01:10 +0100
committerFlorent Le Coz <louiz@louiz.org>2016-02-22 17:03:15 +0100
commit37fd6ff18a6e51ee5c4127b7e1269e3944d71b44 (patch)
tree6aaced2b9801514758a917a8f9e27ea716aba2ff /louloulibs/xmpp/xmpp_component.cpp
parent6ee80ad26858eeee9a99b448320025ca439eee55 (diff)
downloadbiboumi-37fd6ff18a6e51ee5c4127b7e1269e3944d71b44.tar.gz
biboumi-37fd6ff18a6e51ee5c4127b7e1269e3944d71b44.tar.bz2
biboumi-37fd6ff18a6e51ee5c4127b7e1269e3944d71b44.tar.xz
biboumi-37fd6ff18a6e51ee5c4127b7e1269e3944d71b44.zip
log the handshake + stream opening/close in a more consistent way
Diffstat (limited to 'louloulibs/xmpp/xmpp_component.cpp')
-rw-r--r--louloulibs/xmpp/xmpp_component.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/louloulibs/xmpp/xmpp_component.cpp b/louloulibs/xmpp/xmpp_component.cpp
index a82892d..c5906e5 100644
--- a/louloulibs/xmpp/xmpp_component.cpp
+++ b/louloulibs/xmpp/xmpp_component.cpp
@@ -89,9 +89,10 @@ void XmppComponent::on_connected()
{
log_info("connected to XMPP server");
this->first_connection_try = true;
- this->send_data("<stream:stream to='");
- this->send_data(std::string{this->served_hostname});
- this->send_data("' xmlns:stream='http://etherx.jabber.org/streams' xmlns='" COMPONENT_NS "'>");
+ auto data = "<stream:stream to='"s + this->served_hostname + \
+ "' xmlns:stream='http://etherx.jabber.org/streams' xmlns='" COMPONENT_NS "'>";
+ log_debug("XMPP SENDING: " << data);
+ this->send_data(std::move(data));
this->doc_open = true;
// We may have some pending data to send: this happens when we try to send
// some data before we are actually connected. We send that data right now, if any
@@ -124,7 +125,7 @@ void XmppComponent::parse_in_buffer(const size_t size)
void XmppComponent::on_remote_stream_open(const XmlNode& node)
{
- log_debug("XMPP DOCUMENT OPEN: " << node.to_string());
+ log_debug("XMPP RECEIVING: " << node.to_string());
this->stream_id = node.get_tag("id");
if (this->stream_id.empty())
{
@@ -145,14 +146,14 @@ void XmppComponent::on_remote_stream_open(const XmlNode& node)
sprintf(digest + (i*2), "%02x", result[i]);
digest[HASH_LENGTH * 2] = '\0';
- this->send_data("<handshake xmlns='" COMPONENT_NS "'>");
- this->send_data(digest);
- this->send_data("</handshake>");
+ auto data = "<handshake xmlns='" COMPONENT_NS "'>"s + digest + "</handshake>";
+ log_debug("XMPP SENDING: " << data);
+ this->send_data(std::move(data));
}
void XmppComponent::on_remote_stream_close(const XmlNode& node)
{
- log_debug("XMPP DOCUMENT CLOSE " << node.to_string());
+ log_debug("XMPP RECEIVING: " << node.to_string());
this->doc_open = false;
}