diff options
author | Mateusz Piekos <mateuszpiekos@gmail.com> | 2012-06-08 13:37:12 (GMT) |
---|---|---|
committer | Mateusz Piekos <mateuszpiekos@gmail.com> | 2012-06-08 13:37:12 (GMT) |
commit | 6e9fb4e4a3aeee8c40617a4dda6e5e0892ceebad (patch) | |
tree | fd2c0a48c6f5d033fe742790fb2e640d7e13ba91 /Swiften/Whiteboard/WhiteboardSession.cpp | |
parent | 13ededd86bfb5dc5115af69d79810122313273b5 (diff) | |
download | swift-contrib-6e9fb4e4a3aeee8c40617a4dda6e5e0892ceebad.zip swift-contrib-6e9fb4e4a3aeee8c40617a4dda6e5e0892ceebad.tar.bz2 |
Added handling of whiteboard session requests
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; + } } |