diff options
author | Mateusz Piekos <mateuszpiekos@gmail.com> | 2012-08-09 16:15:17 (GMT) |
---|---|---|
committer | Mateusz Piekos <mateuszpiekos@gmail.com> | 2012-08-09 16:15:17 (GMT) |
commit | 1e6683a04a71ab00139fcf17fccbccae7b925c48 (patch) | |
tree | a6d9c8a558eda19e5b6d3f9c74746abfcf068bf1 | |
parent | 13fea1ac6f8af3da7b3bce8974f3b0f6b49d75d1 (diff) | |
download | swift-contrib-1e6683a04a71ab00139fcf17fccbccae7b925c48.zip swift-contrib-1e6683a04a71ab00139fcf17fccbccae7b925c48.tar.bz2 |
Availability check on closing whiteboard session
-rw-r--r-- | Swiften/Whiteboard/WhiteboardSession.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Swiften/Whiteboard/WhiteboardSession.cpp b/Swiften/Whiteboard/WhiteboardSession.cpp index 10b5e51..cffcf07 100644 --- a/Swiften/Whiteboard/WhiteboardSession.cpp +++ b/Swiften/Whiteboard/WhiteboardSession.cpp @@ -7,6 +7,7 @@ #include <Swiften/Whiteboard/WhiteboardSession.h> #include <boost/smart_ptr/make_shared.hpp> +#include <Swiften/Queries/IQRouter.h> #include <Swiften/Elements/WhiteboardPayload.h> #include <Swiften/Elements/ErrorPayload.h> @@ -52,9 +53,11 @@ namespace Swift { } void WhiteboardSession::cancel() { - boost::shared_ptr<WhiteboardPayload> payload = boost::make_shared<WhiteboardPayload>(WhiteboardPayload::SessionTerminate); - boost::shared_ptr<GenericRequest<WhiteboardPayload> > request = boost::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_); - request->send(); + if (router_->isAvailable()) { + boost::shared_ptr<WhiteboardPayload> payload = boost::make_shared<WhiteboardPayload>(WhiteboardPayload::SessionTerminate); + boost::shared_ptr<GenericRequest<WhiteboardPayload> > request = boost::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_); + request->send(); + } onSessionTerminated(toJID_); } |