diff options
-rw-r--r-- | Swiften/FileTransfer/IBBReceiveSession.cpp | 3 | ||||
-rw-r--r-- | Swiften/Queries/Responder.h | 16 |
2 files changed, 15 insertions, 4 deletions
diff --git a/Swiften/FileTransfer/IBBReceiveSession.cpp b/Swiften/FileTransfer/IBBReceiveSession.cpp index b4db9a6..ac58b34 100644 --- a/Swiften/FileTransfer/IBBReceiveSession.cpp +++ b/Swiften/FileTransfer/IBBReceiveSession.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -21,6 +21,7 @@ namespace Swift { class IBBReceiveSession::IBBResponder : public SetResponder<IBB> { public: IBBResponder(IBBReceiveSession* session, IQRouter* router) : SetResponder<IBB>(router), session(session), sequenceNumber(0), receivedSize(0) { + setFinal(false); } virtual bool handleSetRequest(const JID& from, const JID&, const std::string& id, IBB::ref ibb) { diff --git a/Swiften/Queries/Responder.h b/Swiften/Queries/Responder.h index 85b0589..84d232a 100644 --- a/Swiften/Queries/Responder.h +++ b/Swiften/Queries/Responder.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -23,7 +23,7 @@ namespace Swift { template<typename PAYLOAD_TYPE> class Responder : public IQHandler { public: - Responder(IQRouter* router) : router_(router) { + Responder(IQRouter* router) : router_(router), isFinalResonder_(true) { } ~Responder() { @@ -98,6 +98,10 @@ namespace Swift { return router_; } + void setFinal(bool isFinal) { + isFinalResonder_ = isFinal; + } + private: virtual bool handleIQ(boost::shared_ptr<IQ> iq) { if (iq->getType() == IQ::Set || iq->getType() == IQ::Get) { @@ -111,7 +115,12 @@ namespace Swift { result = handleGetRequest(iq->getFrom(), iq->getTo(), iq->getID(), payload); } if (!result) { - router_->sendIQ(IQ::createError(iq->getFrom(), iq->getID(), ErrorPayload::NotAllowed, ErrorPayload::Cancel)); + if (isFinalResonder_) { + router_->sendIQ(IQ::createError(iq->getFrom(), iq->getID(), ErrorPayload::NotAllowed, ErrorPayload::Cancel)); + } + else { + return false; + } } return true; } @@ -121,5 +130,6 @@ namespace Swift { private: IQRouter* router_; + bool isFinalResonder_; }; } |