diff options
Diffstat (limited to 'Swiften/Whiteboard/WhiteboardSession.cpp')
-rw-r--r-- | Swiften/Whiteboard/WhiteboardSession.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Swiften/Whiteboard/WhiteboardSession.cpp b/Swiften/Whiteboard/WhiteboardSession.cpp index 7d95af0..859f2cd 100644 --- a/Swiften/Whiteboard/WhiteboardSession.cpp +++ b/Swiften/Whiteboard/WhiteboardSession.cpp @@ -6,9 +6,10 @@ #include <Swiften/Whiteboard/WhiteboardSession.h> +#include <boost/bind.hpp> #include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Elements/WhiteboardPayload.h> -#include <Swiften/Queries/GenericRequest.h> +#include <Swiften/Elements/ErrorPayload.h> #include <iostream> @@ -26,4 +27,18 @@ namespace Swift { boost::shared_ptr<GenericRequest<WhiteboardPayload> > request = boost::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_); request->send(); } + + void WhiteboardSession::sendSessionRequest() { + boost::shared_ptr<WhiteboardPayload> payload = boost::make_shared<WhiteboardPayload>(WhiteboardPayload::SessionRequest); + sessionRequest = new GenericRequest<WhiteboardPayload>(IQ::Set, toJID_, payload, router_); + sessionRequest->onResponse.connect(boost::bind(&WhiteboardSession::handleSessionRequestResponse, this, _1, _2)); + sessionRequest->send(); + } + + void WhiteboardSession::handleSessionRequestResponse(boost::shared_ptr<WhiteboardPayload> whiteboardPayload, boost::shared_ptr<ErrorPayload> errorPayload) { + if (errorPayload.get() == 0) { + onRequestAccepted(toJID_, this); + } + delete sessionRequest; + } } |