summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/Whiteboard/OutgoingWhiteboardSession.cpp8
-rw-r--r--Swiften/Whiteboard/OutgoingWhiteboardSession.h3
-rw-r--r--Swiften/Whiteboard/WhiteboardSessionManager.cpp2
3 files changed, 12 insertions, 1 deletions
diff --git a/Swiften/Whiteboard/OutgoingWhiteboardSession.cpp b/Swiften/Whiteboard/OutgoingWhiteboardSession.cpp
index 585a689..2de4ec4 100644
--- a/Swiften/Whiteboard/OutgoingWhiteboardSession.cpp
+++ b/Swiften/Whiteboard/OutgoingWhiteboardSession.cpp
@@ -6,6 +6,7 @@
#include <Swiften/Whiteboard/OutgoingWhiteboardSession.h>
+#include <boost/smart_ptr/make_shared.hpp>
#include <boost/bind.hpp>
#include <Swiften/Elements/WhiteboardPayload.h>
@@ -19,10 +20,17 @@ namespace Swift {
void OutgoingWhiteboardSession::startSession() {
boost::shared_ptr<WhiteboardPayload> payload = boost::make_shared<WhiteboardPayload>(WhiteboardPayload::SessionRequest);
boost::shared_ptr<GenericRequest<WhiteboardPayload> > request = boost::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_);
+ request->onResponse.connect(boost::bind(&OutgoingWhiteboardSession::handleRequestResponse, this, _1, _2));
request->send();
}
std::string OutgoingWhiteboardSession::getClientID() const {
return "a";
}
+
+ void OutgoingWhiteboardSession::handleRequestResponse(boost::shared_ptr<WhiteboardPayload> payload, ErrorPayload::ref error) {
+ if (error) {
+ onSessionCancelled(toJID_);
+ }
+ }
}
diff --git a/Swiften/Whiteboard/OutgoingWhiteboardSession.h b/Swiften/Whiteboard/OutgoingWhiteboardSession.h
index 3d0dd1a..5cc0f42 100644
--- a/Swiften/Whiteboard/OutgoingWhiteboardSession.h
+++ b/Swiften/Whiteboard/OutgoingWhiteboardSession.h
@@ -21,5 +21,8 @@ namespace Swift {
virtual ~OutgoingWhiteboardSession();
void startSession();
std::string getClientID() const;
+
+ private:
+ void handleRequestResponse(boost::shared_ptr<WhiteboardPayload> payload, ErrorPayload::ref error);
};
}
diff --git a/Swiften/Whiteboard/WhiteboardSessionManager.cpp b/Swiften/Whiteboard/WhiteboardSessionManager.cpp
index 3cb1cc3..2e519e0 100644
--- a/Swiften/Whiteboard/WhiteboardSessionManager.cpp
+++ b/Swiften/Whiteboard/WhiteboardSessionManager.cpp
@@ -47,8 +47,8 @@ namespace Swift {
WhiteboardSession::ref session = getSession(to);
if (!session) {
OutgoingWhiteboardSession::ref outgoingSession = createOutgoingSession(to);
- outgoingSession->startSession();
onSessionRequest(to, true);
+ outgoingSession->startSession();
return outgoingSession;
} else {
return session;