diff options
Diffstat (limited to 'Swiften/Parser')
4 files changed, 45 insertions, 0 deletions
diff --git a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp b/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp index 9865a1e..86ea1c6 100644 --- a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp +++ b/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp @@ -47,6 +47,7 @@ #include <Swiften/Parser/PayloadParsers/MUCAdminPayloadParser.h> #include <Swiften/Parser/PayloadParsers/MUCOwnerPayloadParser.h> #include <Swiften/Parser/PayloadParsers/MUCDestroyPayloadParser.h> +#include <Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.h> #include <Swiften/Parser/PayloadParsers/MUCOwnerPayloadParserFactory.h> #include <Swiften/Parser/PayloadParsers/NicknameParser.h> #include <Swiften/Parser/PayloadParsers/ReplaceParser.h> @@ -105,6 +106,10 @@ FullPayloadParserFactoryCollection::FullPayloadParserFactoryCollection() { factories_.push_back(boost::make_shared<ChatStateParserFactory>()); factories_.push_back(boost::make_shared<MUCUserPayloadParserFactory>(this)); factories_.push_back(boost::make_shared<MUCOwnerPayloadParserFactory>(this)); + factories_.push_back(shared_ptr<PayloadParserFactory>(new GenericPayloadParserFactory<MUCAdminPayloadParser>("query", "http://jabber.org/protocol/muc#admin"))); + factories_.push_back(shared_ptr<PayloadParserFactory>(new GenericPayloadParserFactory<MUCInvitationPayloadParser>("x", "jabber:x:conference"))); + factories_.push_back(shared_ptr<PayloadParserFactory>(new GenericPayloadParserFactory<MUCDestroyPayloadParser>("destroy", "http://jabber.org/protocol/muc#user"))); + factories_.push_back(shared_ptr<PayloadParserFactory>(new GenericPayloadParserFactory<MUCDestroyPayloadParser>("destroy", "http://jabber.org/protocol/muc#owner"))); factories_.push_back(boost::make_shared<GenericPayloadParserFactory<MUCAdminPayloadParser> >("query", "http://jabber.org/protocol/muc#admin")); factories_.push_back(boost::make_shared<GenericPayloadParserFactory<MUCDestroyPayloadParser> >("destroy", "http://jabber.org/protocol/muc#user")); factories_.push_back(boost::make_shared<GenericPayloadParserFactory<MUCDestroyPayloadParser> >("destroy", "http://jabber.org/protocol/muc#owner")); diff --git a/Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.cpp b/Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.cpp new file mode 100644 index 0000000..fa95af7 --- /dev/null +++ b/Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.cpp @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2011 Kevin Smith + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.h> + + + +namespace Swift { + +void MUCInvitationPayloadParser::handleTree(ParserElement::ref root) { + MUCInvitationPayload::ref invite = getPayloadInternal(); + invite->setIsContinuation(root->getAttributes().getBoolAttribute("continue", false)); + invite->setJID(JID(root->getAttributes().getAttribute("jid"))); + invite->setPassword(root->getAttributes().getAttribute("password")); + invite->setReason(root->getAttributes().getAttribute("reason")); + invite->setThread(root->getAttributes().getAttribute("thread")); +} + +} diff --git a/Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.h b/Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.h new file mode 100644 index 0000000..2cd3535 --- /dev/null +++ b/Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.h @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2011 Kevin Smith + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Elements/MUCInvitationPayload.h> +#include <Swiften/Parser/GenericPayloadTreeParser.h> + +namespace Swift { + class MUCInvitationPayloadParser : public GenericPayloadTreeParser<MUCInvitationPayload> { + public: + virtual void handleTree(ParserElement::ref root); + }; +} diff --git a/Swiften/Parser/SConscript b/Swiften/Parser/SConscript index 1cef02c..e1ec1d8 100644 --- a/Swiften/Parser/SConscript +++ b/Swiften/Parser/SConscript @@ -64,6 +64,7 @@ sources = [ "PayloadParsers/MUCAdminPayloadParser.cpp", "PayloadParsers/MUCOwnerPayloadParser.cpp", "PayloadParsers/MUCDestroyPayloadParser.cpp", + "PayloadParsers/MUCInvitationPayloadParser.cpp", "PayloadParsers/MUCItemParser.cpp", "PayloadParsers/NicknameParser.cpp", "PayloadParsers/ReplaceParser.cpp", |