diff options
Diffstat (limited to 'Swiften/Queries')
-rw-r--r-- | Swiften/Queries/GenericRequest.h | 9 | ||||
-rw-r--r-- | Swiften/Queries/IQRouter.cpp | 4 | ||||
-rw-r--r-- | Swiften/Queries/Request.cpp | 4 | ||||
-rw-r--r-- | Swiften/Queries/Request.h | 4 | ||||
-rw-r--r-- | Swiften/Queries/Requests/GetPrivateStorageRequest.h | 6 | ||||
-rw-r--r-- | Swiften/Queries/Requests/SetPrivateStorageRequest.h | 6 | ||||
-rw-r--r-- | Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp | 4 | ||||
-rw-r--r-- | Swiften/Queries/Responder.h | 6 | ||||
-rw-r--r-- | Swiften/Queries/Responders/DiscoInfoResponder.cpp | 2 | ||||
-rw-r--r-- | Swiften/Queries/Responders/UnitTest/DiscoInfoResponderTest.cpp | 2 | ||||
-rw-r--r-- | Swiften/Queries/UnitTest/IQRouterTest.cpp | 2 | ||||
-rw-r--r-- | Swiften/Queries/UnitTest/RequestTest.cpp | 2 |
12 files changed, 24 insertions, 27 deletions
diff --git a/Swiften/Queries/GenericRequest.h b/Swiften/Queries/GenericRequest.h index b4a1918..77dae52 100644 --- a/Swiften/Queries/GenericRequest.h +++ b/Swiften/Queries/GenericRequest.h @@ -1,5 +1,4 @@ -#ifndef SWIFTEN_GenericRequest_H -#define SWIFTEN_GenericRequest_H +#pragma once #include <boost/signal.hpp> @@ -17,13 +16,11 @@ namespace Swift { Request(type, receiver, payload, router) { } - virtual void handleResponse(boost::shared_ptr<Payload> payload, boost::optional<Error> error) { + virtual void handleResponse(boost::shared_ptr<Payload> payload, boost::optional<ErrorPayload> error) { onResponse(boost::dynamic_pointer_cast<PAYLOAD_TYPE>(payload), error); } public: - boost::signal<void (boost::shared_ptr<PAYLOAD_TYPE>, const boost::optional<Error>&)> onResponse; + boost::signal<void (boost::shared_ptr<PAYLOAD_TYPE>, const boost::optional<ErrorPayload>&)> onResponse; }; } - -#endif diff --git a/Swiften/Queries/IQRouter.cpp b/Swiften/Queries/IQRouter.cpp index ffed5f7..fdfa00b 100644 --- a/Swiften/Queries/IQRouter.cpp +++ b/Swiften/Queries/IQRouter.cpp @@ -6,7 +6,7 @@ #include "Swiften/Base/foreach.h" #include "Swiften/Queries/IQHandler.h" #include "Swiften/Queries/IQChannel.h" -#include "Swiften/Elements/Error.h" +#include "Swiften/Elements/ErrorPayload.h" namespace Swift { @@ -34,7 +34,7 @@ void IQRouter::handleIQ(boost::shared_ptr<IQ> iq) { } } if (!handled && (iq->getType() == IQ::Get || iq->getType() == IQ::Set) ) { - channel_->sendIQ(IQ::createError(iq->getFrom(), iq->getID(), Error::FeatureNotImplemented, Error::Cancel)); + channel_->sendIQ(IQ::createError(iq->getFrom(), iq->getID(), ErrorPayload::FeatureNotImplemented, ErrorPayload::Cancel)); } processPendingRemoves(); diff --git a/Swiften/Queries/Request.cpp b/Swiften/Queries/Request.cpp index 90aa295..18446ae 100644 --- a/Swiften/Queries/Request.cpp +++ b/Swiften/Queries/Request.cpp @@ -35,11 +35,11 @@ bool Request::handleIQ(boost::shared_ptr<IQ> iq) { bool handled = false; if (sent_ && iq->getID() == id_) { if (iq->getType() == IQ::Result) { - handleResponse(iq->getPayloadOfSameType(payload_), boost::optional<Error>()); + handleResponse(iq->getPayloadOfSameType(payload_), boost::optional<ErrorPayload>()); } else { // FIXME: Get proper error - handleResponse(boost::shared_ptr<Payload>(), boost::optional<Error>(Error::UndefinedCondition)); + handleResponse(boost::shared_ptr<Payload>(), boost::optional<ErrorPayload>(ErrorPayload::UndefinedCondition)); } router_->removeHandler(this); handled = true; diff --git a/Swiften/Queries/Request.h b/Swiften/Queries/Request.h index 8f7a1d1..cc4a58e 100644 --- a/Swiften/Queries/Request.h +++ b/Swiften/Queries/Request.h @@ -9,7 +9,7 @@ #include "Swiften/Queries/IQHandler.h" #include "Swiften/Elements/IQ.h" #include "Swiften/Elements/Payload.h" -#include "Swiften/Elements/Error.h" +#include "Swiften/Elements/ErrorPayload.h" #include "Swiften/JID/JID.h" namespace Swift { @@ -32,7 +32,7 @@ namespace Swift { payload_ = p; } - virtual void handleResponse(boost::shared_ptr<Payload>, boost::optional<Error>) = 0; + virtual void handleResponse(boost::shared_ptr<Payload>, boost::optional<ErrorPayload>) = 0; private: bool handleIQ(boost::shared_ptr<IQ>); diff --git a/Swiften/Queries/Requests/GetPrivateStorageRequest.h b/Swiften/Queries/Requests/GetPrivateStorageRequest.h index c5f8aef..5d6440e 100644 --- a/Swiften/Queries/Requests/GetPrivateStorageRequest.h +++ b/Swiften/Queries/Requests/GetPrivateStorageRequest.h @@ -5,7 +5,7 @@ #include "Swiften/Queries/Request.h" #include "Swiften/Elements/PrivateStorage.h" -#include "Swiften/Elements/Error.h" +#include "Swiften/Elements/ErrorPayload.h" namespace Swift { template<typename PAYLOAD_TYPE> @@ -14,7 +14,7 @@ namespace Swift { GetPrivateStorageRequest(IQRouter* router) : Request(IQ::Get, JID(), boost::shared_ptr<PrivateStorage>(new PrivateStorage(boost::shared_ptr<Payload>(new PAYLOAD_TYPE()))), router) { } - virtual void handleResponse(boost::shared_ptr<Payload> payload, boost::optional<Error> error) { + virtual void handleResponse(boost::shared_ptr<Payload> payload, boost::optional<ErrorPayload> error) { boost::shared_ptr<PrivateStorage> storage = boost::dynamic_pointer_cast<PrivateStorage>(payload); if (storage) { onResponse(boost::dynamic_pointer_cast<PAYLOAD_TYPE>(storage->getPayload()), error); @@ -25,6 +25,6 @@ namespace Swift { } public: - boost::signal<void (boost::shared_ptr<PAYLOAD_TYPE>, const boost::optional<Error>&)> onResponse; + boost::signal<void (boost::shared_ptr<PAYLOAD_TYPE>, const boost::optional<ErrorPayload>&)> onResponse; }; } diff --git a/Swiften/Queries/Requests/SetPrivateStorageRequest.h b/Swiften/Queries/Requests/SetPrivateStorageRequest.h index 63ac8dc..834ddd8 100644 --- a/Swiften/Queries/Requests/SetPrivateStorageRequest.h +++ b/Swiften/Queries/Requests/SetPrivateStorageRequest.h @@ -5,7 +5,7 @@ #include "Swiften/Queries/Request.h" #include "Swiften/Elements/PrivateStorage.h" -#include "Swiften/Elements/Error.h" +#include "Swiften/Elements/ErrorPayload.h" namespace Swift { template<typename PAYLOAD_TYPE> @@ -14,11 +14,11 @@ namespace Swift { SetPrivateStorageRequest(boost::shared_ptr<PAYLOAD_TYPE> payload, IQRouter* router) : Request(IQ::Set, JID(), boost::shared_ptr<PrivateStorage>(new PrivateStorage(payload)), router) { } - virtual void handleResponse(boost::shared_ptr<Payload> payload, boost::optional<Error> error) { + virtual void handleResponse(boost::shared_ptr<Payload> payload, boost::optional<ErrorPayload> error) { onResponse(error); } public: - boost::signal<void (const boost::optional<Error>&)> onResponse; + boost::signal<void (const boost::optional<ErrorPayload>&)> onResponse; }; } diff --git a/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp b/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp index 14e04cf..a86a111 100644 --- a/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp +++ b/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp @@ -72,7 +72,7 @@ class GetPrivateStorageRequestTest : public CppUnit::TestFixture } private: - void handleResponse(boost::shared_ptr<Payload> p, const boost::optional<Error>& e) { + void handleResponse(boost::shared_ptr<Payload> p, const boost::optional<ErrorPayload>& e) { if (e) { errors.push_back(*e); } @@ -99,7 +99,7 @@ class GetPrivateStorageRequestTest : public CppUnit::TestFixture private: IQRouter* router; DummyIQChannel* channel; - std::vector< Error > errors; + std::vector< ErrorPayload > errors; std::vector< boost::shared_ptr<Payload> > responses; }; diff --git a/Swiften/Queries/Responder.h b/Swiften/Queries/Responder.h index e6e8ca6..9c025eb 100644 --- a/Swiften/Queries/Responder.h +++ b/Swiften/Queries/Responder.h @@ -3,7 +3,7 @@ #include "Swiften/Queries/IQHandler.h" #include "Swiften/Queries/IQRouter.h" -#include "Swiften/Elements/Error.h" +#include "Swiften/Elements/ErrorPayload.h" namespace Swift { template<typename PAYLOAD_TYPE> @@ -25,7 +25,7 @@ namespace Swift { router_->sendIQ(IQ::createResult(to, id, payload)); } - void sendError(const JID& to, const String& id, Error::Condition condition, Error::Type type) { + void sendError(const JID& to, const String& id, ErrorPayload::Condition condition, ErrorPayload::Type type) { router_->sendIQ(IQ::createError(to, id, condition, type)); } @@ -42,7 +42,7 @@ namespace Swift { result = handleGetRequest(iq->getFrom(), iq->getID(), payload); } if (!result) { - router_->sendIQ(IQ::createError(iq->getFrom(), iq->getID(), Error::NotAllowed, Error::Cancel)); + router_->sendIQ(IQ::createError(iq->getFrom(), iq->getID(), ErrorPayload::NotAllowed, ErrorPayload::Cancel)); } return true; } diff --git a/Swiften/Queries/Responders/DiscoInfoResponder.cpp b/Swiften/Queries/Responders/DiscoInfoResponder.cpp index a114fbc..572f83f 100644 --- a/Swiften/Queries/Responders/DiscoInfoResponder.cpp +++ b/Swiften/Queries/Responders/DiscoInfoResponder.cpp @@ -27,7 +27,7 @@ bool DiscoInfoResponder::handleGetRequest(const JID& from, const String& id, boo sendResponse(from, id, boost::shared_ptr<DiscoInfo>(new DiscoInfo((*i).second))); } else { - sendError(from, id, Error::ItemNotFound, Error::Cancel); + sendError(from, id, ErrorPayload::ItemNotFound, ErrorPayload::Cancel); } } return true; diff --git a/Swiften/Queries/Responders/UnitTest/DiscoInfoResponderTest.cpp b/Swiften/Queries/Responders/UnitTest/DiscoInfoResponderTest.cpp index 6ed7b9e..5993d0c 100644 --- a/Swiften/Queries/Responders/UnitTest/DiscoInfoResponderTest.cpp +++ b/Swiften/Queries/Responders/UnitTest/DiscoInfoResponderTest.cpp @@ -72,7 +72,7 @@ class DiscoInfoResponderTest : public CppUnit::TestFixture { channel_->onIQReceived(IQ::createRequest(IQ::Get, JID("foo@bar.com"), "id-1", query)); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size())); - boost::shared_ptr<Error> payload(channel_->iqs_[0]->getPayload<Error>()); + boost::shared_ptr<ErrorPayload> payload(channel_->iqs_[0]->getPayload<ErrorPayload>()); CPPUNIT_ASSERT(payload); } diff --git a/Swiften/Queries/UnitTest/IQRouterTest.cpp b/Swiften/Queries/UnitTest/IQRouterTest.cpp index 94b7de8..5760b09 100644 --- a/Swiften/Queries/UnitTest/IQRouterTest.cpp +++ b/Swiften/Queries/UnitTest/IQRouterTest.cpp @@ -87,7 +87,7 @@ class IQRouterTest : public CppUnit::TestFixture channel_->onIQReceived(boost::shared_ptr<IQ>(new IQ())); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel_->iqs_.size())); - CPPUNIT_ASSERT(channel_->iqs_[0]->getPayload<Error>()); + CPPUNIT_ASSERT(channel_->iqs_[0]->getPayload<ErrorPayload>()); } diff --git a/Swiften/Queries/UnitTest/RequestTest.cpp b/Swiften/Queries/UnitTest/RequestTest.cpp index ea6dee6..51d5a51 100644 --- a/Swiften/Queries/UnitTest/RequestTest.cpp +++ b/Swiften/Queries/UnitTest/RequestTest.cpp @@ -113,7 +113,7 @@ class RequestTest : public CppUnit::TestFixture } private: - void handleResponse(boost::shared_ptr<Payload> p, const boost::optional<Error>& e) { + void handleResponse(boost::shared_ptr<Payload> p, const boost::optional<ErrorPayload>& e) { if (e) { ++errorsReceived_; } |