diff options
Diffstat (limited to 'Swiften')
-rw-r--r-- | Swiften/Component/ComponentXMLTracer.h | 34 | ||||
-rw-r--r-- | Swiften/SConscript | 2 | ||||
-rw-r--r-- | Swiften/Serializer/ComponentHandshakeSerializer.cpp | 2 |
3 files changed, 36 insertions, 2 deletions
diff --git a/Swiften/Component/ComponentXMLTracer.h b/Swiften/Component/ComponentXMLTracer.h new file mode 100644 index 0000000..512e69c --- /dev/null +++ b/Swiften/Component/ComponentXMLTracer.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <boost/bind.hpp> + +#include "Swiften/Component/Component.h" + +namespace Swift { + class ComponentXMLTracer { + public: + ComponentXMLTracer(Component* component) { + component->onDataRead.connect(boost::bind(&ComponentXMLTracer::printData, '<', _1)); + component->onDataWritten.connect(boost::bind(&ComponentXMLTracer::printData, '>', _1)); + } + + private: + static void printData(char direction, const String& data) { + printLine(direction); + std::cerr << data << std::endl; + } + + static void printLine(char c) { + for (unsigned int i = 0; i < 80; ++i) { + std::cerr << c; + } + std::cerr << std::endl; + } + }; +} diff --git a/Swiften/SConscript b/Swiften/SConscript index ca4f91a..fb79963 100644 --- a/Swiften/SConscript +++ b/Swiften/SConscript @@ -257,7 +257,7 @@ if env["SCONS_STAGE"] == "build" : # Generate the Swiften header swiften_header = "#pragma once\n" top_path = env.Dir("..").abspath - public_dirs = ["Queries", "Client", "Elements"] + public_dirs = ["Queries", "Client", "Component", "Elements"] for public_dir in public_dirs : for root, dirs, files in os.walk(env.Dir(public_dir).abspath) : if root.endswith("UnitTest") : diff --git a/Swiften/Serializer/ComponentHandshakeSerializer.cpp b/Swiften/Serializer/ComponentHandshakeSerializer.cpp index de1958e..011d59e 100644 --- a/Swiften/Serializer/ComponentHandshakeSerializer.cpp +++ b/Swiften/Serializer/ComponentHandshakeSerializer.cpp @@ -15,7 +15,7 @@ ComponentHandshakeSerializer::ComponentHandshakeSerializer() { String ComponentHandshakeSerializer::serialize(boost::shared_ptr<Element> element) const { boost::shared_ptr<ComponentHandshake> handshake(boost::dynamic_pointer_cast<ComponentHandshake>(element)); - return "<handshake>" + handshake->getData() + "</challenge>"; + return "<handshake>" + handshake->getData() + "</handshake>"; } } |