diff options
Diffstat (limited to 'Swiften/Session/SessionTracer.h')
-rw-r--r-- | Swiften/Session/SessionTracer.h | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/Swiften/Session/SessionTracer.h b/Swiften/Session/SessionTracer.h index cce45eb..72c93b4 100644 --- a/Swiften/Session/SessionTracer.h +++ b/Swiften/Session/SessionTracer.h @@ -6,29 +6,18 @@ #pragma once -#include <iostream> - -#include "Swiften/Session/Session.h" #include <string> -#include "Swiften/Base/ByteArray.h" + +#include <Swiften/Session/Session.h> +#include <Swiften/Base/SafeByteArray.h> namespace Swift { class SessionTracer { public: - SessionTracer(boost::shared_ptr<Session> session) : session(session) { - session->onDataRead.connect(boost::bind(&SessionTracer::printData, this, '<', _1)); - session->onDataWritten.connect(boost::bind(&SessionTracer::printData, this, '>', _1)); - } + SessionTracer(boost::shared_ptr<Session> session); private: - void printData(char direction, const ByteArray& data) { - std::cerr << direction << direction << " " << session->getLocalJID() << " "; - for (unsigned int i = 0; i < 72 - session->getLocalJID().toString().size() - session->getRemoteJID().toString().size(); ++i) { - std::cerr << direction; - } - std::cerr << " " << session->getRemoteJID()<< " " << direction << direction << std::endl; - std::cerr << data.toString() << std::endl; - } + void printData(char direction, const SafeByteArray& data); boost::shared_ptr<Session> session; }; |