diff options
Diffstat (limited to 'Swiften/Client')
-rw-r--r-- | Swiften/Client/ClientXMLTracer.cpp | 6 | ||||
-rw-r--r-- | Swiften/Client/ClientXMLTracer.h | 3 | ||||
-rw-r--r-- | Swiften/Client/CoreClient.cpp | 4 | ||||
-rw-r--r-- | Swiften/Client/CoreClient.h | 9 |
4 files changed, 13 insertions, 9 deletions
diff --git a/Swiften/Client/ClientXMLTracer.cpp b/Swiften/Client/ClientXMLTracer.cpp index a26ce66..441da9b 100644 --- a/Swiften/Client/ClientXMLTracer.cpp +++ b/Swiften/Client/ClientXMLTracer.cpp @@ -9,6 +9,8 @@ #include <iostream> #include <boost/bind.hpp> +#include <Swiften/Base/SafeString.h> + namespace Swift { ClientXMLTracer::ClientXMLTracer(CoreClient* client) { @@ -16,9 +18,9 @@ ClientXMLTracer::ClientXMLTracer(CoreClient* client) { client->onDataWritten.connect(boost::bind(&ClientXMLTracer::printData, '>', _1)); } -void ClientXMLTracer::printData(char direction, const std::string& data) { +void ClientXMLTracer::printData(char direction, const SafeByteArray& data) { printLine(direction); - std::cerr << data << std::endl; + std::cerr << byteArrayToString(ByteArray(data.begin(), data.end())) << std::endl; } void ClientXMLTracer::printLine(char c) { diff --git a/Swiften/Client/ClientXMLTracer.h b/Swiften/Client/ClientXMLTracer.h index 617c53f..dd94e0e 100644 --- a/Swiften/Client/ClientXMLTracer.h +++ b/Swiften/Client/ClientXMLTracer.h @@ -7,6 +7,7 @@ #pragma once #include <Swiften/Client/CoreClient.h> +#include <Swiften/Base/SafeByteArray.h> namespace Swift { class ClientXMLTracer { @@ -14,7 +15,7 @@ namespace Swift { ClientXMLTracer(CoreClient* client); private: - static void printData(char direction, const std::string& data); + static void printData(char direction, const SafeByteArray& data); static void printLine(char c); }; } diff --git a/Swiften/Client/CoreClient.cpp b/Swiften/Client/CoreClient.cpp index 9907f5d..9eec7ca 100644 --- a/Swiften/Client/CoreClient.cpp +++ b/Swiften/Client/CoreClient.cpp @@ -260,11 +260,11 @@ void CoreClient::handleNeedCredentials() { } } -void CoreClient::handleDataRead(const std::string& data) { +void CoreClient::handleDataRead(const SafeByteArray& data) { onDataRead(data); } -void CoreClient::handleDataWritten(const std::string& data) { +void CoreClient::handleDataWritten(const SafeByteArray& data) { onDataWritten(data); } diff --git a/Swiften/Client/CoreClient.h b/Swiften/Client/CoreClient.h index 9806d35..841c32c 100644 --- a/Swiften/Client/CoreClient.h +++ b/Swiften/Client/CoreClient.h @@ -15,6 +15,7 @@ #include <Swiften/Client/ClientError.h> #include <Swiften/Client/ClientOptions.h> #include <Swiften/Base/SafeString.h> +#include <Swiften/Base/SafeByteArray.h> namespace Swift { class ChainedConnector; @@ -156,7 +157,7 @@ namespace Swift { * This signal is emitted before the XML data is parsed, * so this data is unformatted. */ - boost::signal<void (const std::string&)> onDataRead; + boost::signal<void (const SafeByteArray&)> onDataRead; /** * Emitted when the client sends data. @@ -164,7 +165,7 @@ namespace Swift { * This signal is emitted after the XML was serialized, and * is unformatted. */ - boost::signal<void (const std::string&)> onDataWritten; + boost::signal<void (const SafeByteArray&)> onDataWritten; /** * Emitted when a message is received. @@ -194,8 +195,8 @@ namespace Swift { void handleStanzaChannelAvailableChanged(bool available); void handleSessionFinished(boost::shared_ptr<Error>); void handleNeedCredentials(); - void handleDataRead(const std::string&); - void handleDataWritten(const std::string&); + void handleDataRead(const SafeByteArray&); + void handleDataWritten(const SafeByteArray&); void handlePresenceReceived(boost::shared_ptr<Presence>); void handleMessageReceived(boost::shared_ptr<Message>); void handleStanzaAcked(boost::shared_ptr<Stanza>); |