diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-07-18 19:04:32 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-07-18 20:40:56 (GMT) |
commit | 4457bc810a326de8d7895b3f2ff36ade5f1ae1a0 (patch) | |
tree | 1556c4b0190453897d4799d23b05e651b0bb8a32 /Swiften/Parser | |
parent | 4052a822acd9da9dab6a8e2343c6170fb08dd8d6 (diff) | |
download | swift-contrib-4457bc810a326de8d7895b3f2ff36ade5f1ae1a0.zip swift-contrib-4457bc810a326de8d7895b3f2ff36ade5f1ae1a0.tar.bz2 |
Implement incoming linklocal connections.
Diffstat (limited to 'Swiften/Parser')
-rw-r--r-- | Swiften/Parser/UnitTest/XMPPParserTest.cpp | 5 | ||||
-rw-r--r-- | Swiften/Parser/XMPPParser.cpp | 8 | ||||
-rw-r--r-- | Swiften/Parser/XMPPParserClient.h | 8 |
3 files changed, 13 insertions, 8 deletions
diff --git a/Swiften/Parser/UnitTest/XMPPParserTest.cpp b/Swiften/Parser/UnitTest/XMPPParserTest.cpp index a8b805e..ecdd565 100644 --- a/Swiften/Parser/UnitTest/XMPPParserTest.cpp +++ b/Swiften/Parser/UnitTest/XMPPParserTest.cpp @@ -2,6 +2,7 @@ #include <cppunit/extensions/TestFactoryRegistry.h> #include <vector> +#include "Swiften/Elements/ProtocolHeader.h" #include "Swiften/Base/String.h" #include "Swiften/Parser/XMPPParser.h" #include "Swiften/Parser/ElementParser.h" @@ -165,8 +166,8 @@ class XMPPParserTest : public CppUnit::TestFixture Client() {} - void handleStreamStart(const String& from, const String& to, const String& id) { - events.push_back(Event(StreamStart, from, to, id)); + void handleStreamStart(const ProtocolHeader& header) { + events.push_back(Event(StreamStart, header.getFrom(), header.getTo(), header.getID())); } void handleElement(boost::shared_ptr<Element> element) { diff --git a/Swiften/Parser/XMPPParser.cpp b/Swiften/Parser/XMPPParser.cpp index 0f04cca..f97bed8 100644 --- a/Swiften/Parser/XMPPParser.cpp +++ b/Swiften/Parser/XMPPParser.cpp @@ -3,6 +3,7 @@ #include <iostream> #include <cassert> +#include "Swiften/Elements/ProtocolHeader.h" #include "Swiften/Base/String.h" #include "Swiften/Parser/XMLParser.h" #include "Swiften/Parser/PlatformXMLParserFactory.h" @@ -54,7 +55,12 @@ bool XMPPParser::parse(const String& data) { void XMPPParser::handleStartElement(const String& element, const String& ns, const AttributeMap& attributes) { if (!inStream()) { if (element == "stream" && ns == "http://etherx.jabber.org/streams") { - client_->handleStreamStart(attributes.getAttribute("from"), attributes.getAttribute("to"), attributes.getAttribute("id")); + ProtocolHeader header; + header.setFrom(attributes.getAttribute("from")); + header.setTo(attributes.getAttribute("to")); + header.setID(attributes.getAttribute("id")); + header.setVersion(attributes.getAttribute("version")); + client_->handleStreamStart(header); } else { parseErrorOccurred_ = true; diff --git a/Swiften/Parser/XMPPParserClient.h b/Swiften/Parser/XMPPParserClient.h index fb81df8..b8f8e46 100644 --- a/Swiften/Parser/XMPPParserClient.h +++ b/Swiften/Parser/XMPPParserClient.h @@ -1,5 +1,4 @@ -#ifndef SWIFTEN_XMPPPARSERCLIENT_H -#define SWIFTEN_XMPPPARSERCLIENT_H +#pragma once #include <boost/shared_ptr.hpp> @@ -7,15 +6,14 @@ namespace Swift { class String; + class ProtocolHeader; class XMPPParserClient { public: virtual ~XMPPParserClient(); - virtual void handleStreamStart(const String& from, const String& to, const String& id) = 0; + virtual void handleStreamStart(const ProtocolHeader&) = 0; virtual void handleElement(boost::shared_ptr<Element>) = 0; virtual void handleStreamEnd() = 0; }; } - -#endif |