diff options
Diffstat (limited to 'Swiften/Client/ClientXMLTracer.cpp')
-rw-r--r-- | Swiften/Client/ClientXMLTracer.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/Swiften/Client/ClientXMLTracer.cpp b/Swiften/Client/ClientXMLTracer.cpp index 405e3d1..9bfa047 100644 --- a/Swiften/Client/ClientXMLTracer.cpp +++ b/Swiften/Client/ClientXMLTracer.cpp @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -10,10 +10,16 @@ #include <boost/bind.hpp> +#include <Swiften/Base/Platform.h> + namespace Swift { ClientXMLTracer::ClientXMLTracer(CoreClient* client, bool bosh) : bosh(bosh) { +#ifdef SWIFTEN_PLATFORM_WIN32 + beautifier = new XMLBeautifier(true, false); +#else beautifier = new XMLBeautifier(true, true); - client->onDataRead.connect(boost::bind(&ClientXMLTracer::printData, this, '<', _1)); - client->onDataWritten.connect(boost::bind(&ClientXMLTracer::printData, this, '>', _1)); +#endif + onDataReadConnection = client->onDataRead.connect(boost::bind(&ClientXMLTracer::printData, this, '<', _1)); + onDataWrittenConnection = client->onDataWritten.connect(boost::bind(&ClientXMLTracer::printData, this, '>', _1)); } @@ -26,12 +32,12 @@ void ClientXMLTracer::printData(char direction, const SafeByteArray& data) { if (bosh) { std::string line = byteArrayToString(ByteArray(data.begin(), data.end())); - size_t endOfHTTP = line.find("\r\n\r\n"); - if (false && endOfHTTP != std::string::npos) { - /* Disabled because it swallows bits of XML (namespaces, if I recall) */ - std::cerr << line.substr(0, endOfHTTP) << std::endl << beautifier->beautify(line.substr(endOfHTTP)) << std::endl; - } - else { +// Disabled because it swallows bits of XML (namespaces, if I recall) +// size_t endOfHTTP = line.find("\r\n\r\n"); +// if (false && endOfHTTP != std::string::npos) { +// std::cerr << line.substr(0, endOfHTTP) << std::endl << beautifier->beautify(line.substr(endOfHTTP)) << std::endl; +// } +// else { std::cerr << line << std::endl; - } +// } } else { |