diff --git a/include/Swiften/Elements/AttentionPayload.cpp b/include/Swiften/Elements/AttentionPayload.cpp new file mode 100644 index 0000000000000000000000000000000000000000..20599d5fa95e16e9bc7802561a4d6e2861d53b35 --- /dev/null +++ b/include/Swiften/Elements/AttentionPayload.cpp @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2011 Jan Kaluza + * Licensed under the Simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#include + +namespace Swift { + +AttentionPayload::AttentionPayload() { +} + +} diff --git a/include/Swiften/Elements/AttentionPayload.h b/include/Swiften/Elements/AttentionPayload.h new file mode 100644 index 0000000000000000000000000000000000000000..9901843f491f5e402b8343ceaa3618d7122c8b31 --- /dev/null +++ b/include/Swiften/Elements/AttentionPayload.h @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2011 Jan Kaluza + * Licensed under the Simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include +#include +#include + +#include + +namespace Swift { + class AttentionPayload : public Payload { + public: + typedef boost::shared_ptr ref; + + public: + AttentionPayload(); + }; +} diff --git a/include/Swiften/Parser/PayloadParsers/AttentionParser.cpp b/include/Swiften/Parser/PayloadParsers/AttentionParser.cpp new file mode 100644 index 0000000000000000000000000000000000000000..602bb435a8c686a375b9cab60aa84b91b3a65c1e --- /dev/null +++ b/include/Swiften/Parser/PayloadParsers/AttentionParser.cpp @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2011 Jan Kaluza + * Licensed under the Simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#include + +namespace Swift { + +AttentionParser::AttentionParser() /*: level_(0)*/ { +} + +void AttentionParser::handleStartElement(const std::string& /*element*/, const std::string& /*ns*/, const AttributeMap& /*attributes*/) { +} + +void AttentionParser::handleEndElement(const std::string&, const std::string&) { +} + +void AttentionParser::handleCharacterData(const std::string&) { + +} + +} diff --git a/include/Swiften/Parser/PayloadParsers/AttentionParser.h b/include/Swiften/Parser/PayloadParsers/AttentionParser.h new file mode 100644 index 0000000000000000000000000000000000000000..10d4ab830ae090c08b4af4d9ded56e9a772abc46 --- /dev/null +++ b/include/Swiften/Parser/PayloadParsers/AttentionParser.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2011 Jan Kaluza + * Licensed under the Simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include +#include + +namespace Swift { + class AttentionParser : public GenericPayloadParser { + public: + AttentionParser(); + + virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string&); + virtual void handleCharacterData(const std::string& data); + +// private: +// int level_; + }; +} diff --git a/include/Swiften/Serializer/PayloadSerializers/AttentionSerializer.cpp b/include/Swiften/Serializer/PayloadSerializers/AttentionSerializer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2c30531382dfc7ad9a0e0624a2f4a9e0b30f02db --- /dev/null +++ b/include/Swiften/Serializer/PayloadSerializers/AttentionSerializer.cpp @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2011 Jan Kaluza + * Licensed under the Simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#include + +#include + +#include +#include +#include + +namespace Swift { + +AttentionSerializer::AttentionSerializer() : GenericPayloadSerializer() { +} + +std::string AttentionSerializer::serializePayload(boost::shared_ptr attention) const { + XMLElement attentionElement("attention", "urn:xmpp:attention:0"); + + return attentionElement.serialize(); +} + +} diff --git a/include/Swiften/Serializer/PayloadSerializers/AttentionSerializer.h b/include/Swiften/Serializer/PayloadSerializers/AttentionSerializer.h new file mode 100644 index 0000000000000000000000000000000000000000..c067091b448e8177ad1b5e8e8dddd35bf79caa54 --- /dev/null +++ b/include/Swiften/Serializer/PayloadSerializers/AttentionSerializer.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2011 Jan Kaluza + * Licensed under the Simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include +#include + +namespace Swift { + class AttentionSerializer : public GenericPayloadSerializer { + public: + AttentionSerializer(); + + virtual std::string serializePayload(boost::shared_ptr) const; + }; +} diff --git a/src/transport.cpp b/src/transport.cpp index 932adb9316d885edc56cada33cbd495f8d67e29c..dce9bfc591e0f5cdfb364bb06af24f5eea1c899a 100644 --- a/src/transport.cpp +++ b/src/transport.cpp @@ -28,6 +28,8 @@ #include "Swiften/TLS/OpenSSL/OpenSSLServerContext.h" #include "Swiften/TLS/PKCS12Certificate.h" #include "Swiften/TLS/OpenSSL/OpenSSLServerContextFactory.h" +#include "Swiften/Parser/PayloadParsers/AttentionParser.h" +#include "Swiften/Serializer/PayloadSerializers/AttentionSerializer.h" #include "log4cxx/logger.h" #include "log4cxx/consoleappender.h" #include "log4cxx/patternlayout.h" @@ -101,6 +103,9 @@ Component::Component(Swift::EventLoop *loop, Config *config, Factory *factory) { m_iqRouter = m_server->getIQRouter(); m_server->addPayloadParserFactory(new GenericPayloadParserFactory("private", "jabber:iq:private")); + m_server->addPayloadParserFactory(new GenericPayloadParserFactory("attention", "urn:xmpp:attention:0")); + + m_server->addPayloadSerializer(new Swift::AttentionSerializer()); m_server->onDataRead.connect(bind(&Component::handleDataRead, this, _1)); m_server->onDataWritten.connect(bind(&Component::handleDataWritten, this, _1));