summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMateusz Piekos <mateuszpiekos@gmail.com>2012-06-06 10:04:59 (GMT)
committerMateusz Piekos <mateuszpiekos@gmail.com>2012-06-06 10:04:59 (GMT)
commit8f85ae770025fd13e8f39e5097964768396f5b6b (patch)
treeb4eadab32223577657dced8361c21358d6dbb24d /Swiften/Whiteboard/WhiteboardSession.cpp
parentfa2edf2f9dfa77129e749373d7045b98d1dcced5 (diff)
downloadswift-contrib-8f85ae770025fd13e8f39e5097964768396f5b6b.zip
swift-contrib-8f85ae770025fd13e8f39e5097964768396f5b6b.tar.bz2
Moved whiteboard data handling to WhiteboardSession
Diffstat (limited to 'Swiften/Whiteboard/WhiteboardSession.cpp')
-rw-r--r--Swiften/Whiteboard/WhiteboardSession.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/Swiften/Whiteboard/WhiteboardSession.cpp b/Swiften/Whiteboard/WhiteboardSession.cpp
new file mode 100644
index 0000000..7d95af0
--- /dev/null
+++ b/Swiften/Whiteboard/WhiteboardSession.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2012 Mateusz Piękos
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <Swiften/Whiteboard/WhiteboardSession.h>
+
+#include <boost/smart_ptr/make_shared.hpp>
+#include <Swiften/Elements/WhiteboardPayload.h>
+#include <Swiften/Queries/GenericRequest.h>
+
+#include <iostream>
+
+namespace Swift {
+ WhiteboardSession::WhiteboardSession(const JID& jid, IQRouter* router) : toJID_(jid), router_(router) {
+ }
+
+ void WhiteboardSession::handleIncomingAction(boost::shared_ptr<WhiteboardPayload> payload) {
+ onDataReceived(payload->getData());
+ }
+
+ void WhiteboardSession::sendData(const std::string& data) {
+ boost::shared_ptr<WhiteboardPayload> payload = boost::make_shared<WhiteboardPayload>();
+ payload->setData(data);
+ boost::shared_ptr<GenericRequest<WhiteboardPayload> > request = boost::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_);
+ request->send();
+ }
+}