diff options
author | Mateusz Piekos <mateuszpiekos@gmail.com> | 2012-07-02 11:23:59 (GMT) |
---|---|---|
committer | Mateusz Piekos <mateuszpiekos@gmail.com> | 2012-07-02 11:23:59 (GMT) |
commit | abd00de4a4bb395fd2b66c53c150471e7d8ed8b6 (patch) | |
tree | 48bd48eb820e66198715146c5d9b57ee6bee8a0a /Swiften | |
parent | 975435c14b61b241a8e5890c21c60a5be48c2116 (diff) | |
download | swift-contrib-abd00de4a4bb395fd2b66c53c150471e7d8ed8b6.zip swift-contrib-abd00de4a4bb395fd2b66c53c150471e7d8ed8b6.tar.bz2 |
Added handling of responses from request IQ
Fixed bug with hanging session requests after one of client crash
Diffstat (limited to 'Swiften')
-rw-r--r-- | Swiften/Whiteboard/OutgoingWhiteboardSession.cpp | 8 | ||||
-rw-r--r-- | Swiften/Whiteboard/OutgoingWhiteboardSession.h | 3 | ||||
-rw-r--r-- | Swiften/Whiteboard/WhiteboardSessionManager.cpp | 2 |
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; |