diff options
author | Kevin Smith <git@kismith.co.uk> | 2011-10-02 17:38:56 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2011-10-03 07:02:37 (GMT) |
commit | 4ea336d9d124f1c761b22943eaf6771e16a61e58 (patch) | |
tree | 7bcb7ac4366cf31a2f98654a5859de0b32fb318a /Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.cpp | |
parent | 123502d97dc20357ea03fd7f238f117aeb2d05c3 (diff) | |
download | swift-contrib-4ea336d9d124f1c761b22943eaf6771e16a61e58.zip swift-contrib-4ea336d9d124f1c761b22943eaf6771e16a61e58.tar.bz2 |
Simple MUC invites.
Resolves: #152
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.cpp')
-rw-r--r-- | Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.cpp new file mode 100644 index 0000000..24e30e6 --- /dev/null +++ b/Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2011 Kevin Smith + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.h> + +#include <boost/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp> + +#include <Swiften/Base/foreach.h> +#include <Swiften/Serializer/XML/XMLElement.h> +#include <Swiften/Serializer/XML/XMLTextNode.h> +#include <Swiften/Serializer/PayloadSerializers/MUCItemSerializer.h> + + +namespace Swift { + +MUCInvitationPayloadSerializer::MUCInvitationPayloadSerializer() : GenericPayloadSerializer<MUCInvitationPayload>() { +} + +std::string MUCInvitationPayloadSerializer::serializePayload(boost::shared_ptr<MUCInvitationPayload> payload) const { + XMLElement mucElement("x", "jabber:x:conference"); + if (payload->getIsContinuation()) { + mucElement.setAttribute("continue", "true"); + } + if (payload->getJID().isValid()) { + mucElement.setAttribute("jid", payload->getJID().toString()); + } + if (!payload->getPassword().empty()) { + mucElement.setAttribute("password", payload->getPassword()); + } + if (!payload->getReason().empty()) { + mucElement.setAttribute("reason", payload->getReason()); + } + if (!payload->getThread().empty()) { + mucElement.setAttribute("thread", payload->getThread()); + } + return mucElement.serialize(); +} + + +} |