diff options
Diffstat (limited to 'Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoPayloadSerializer.h')
-rw-r--r-- | Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoPayloadSerializer.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoPayloadSerializer.h b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoPayloadSerializer.h new file mode 100644 index 0000000..1b18be4 --- /dev/null +++ b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoPayloadSerializer.h @@ -0,0 +1,21 @@ +/* + * 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 <Swiften/Swiften.h> +#include "EchoPayload.h" + +using namespace Swift; + +class EchoPayloadSerializer : public GenericPayloadSerializer<EchoPayload> { + public: + String serializePayload(boost::shared_ptr<EchoPayload> payload) const { + XMLElement element("echo", "http://swift.im/protocol/echo"); + element.addNode(XMLTextNode::ref(new XMLTextNode(payload->getMessage()))); + return element.serialize(); + } +}; |