summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-10-15 20:40:51 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-10-15 20:40:51 (GMT)
commita49ca97a7b2ad61385d0f6f22ec598a63d889ae7 (patch)
tree332ff85114c4bc6cea5a028a10c111786584be57 /Swiften
parent10d8877b9251d5408da9ac3a5eafb066de121bc6 (diff)
downloadswift-a49ca97a7b2ad61385d0f6f22ec598a63d889ae7.zip
swift-a49ca97a7b2ad61385d0f6f22ec598a63d889ae7.tar.bz2
Added EchoComponent.
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/Component/ComponentXMLTracer.h34
-rw-r--r--Swiften/SConscript2
-rw-r--r--Swiften/Serializer/ComponentHandshakeSerializer.cpp2
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>";
}
}