diff options
Diffstat (limited to 'Swiften/Queries')
-rw-r--r-- | Swiften/Queries/GenericRequest.h | 4 | ||||
-rw-r--r-- | Swiften/Queries/Request.cpp | 8 | ||||
-rw-r--r-- | Swiften/Queries/Request.h | 2 | ||||
-rw-r--r-- | Swiften/Queries/Requests/GetPrivateStorageRequest.h | 4 | ||||
-rw-r--r-- | Swiften/Queries/Requests/SetPrivateStorageRequest.h | 4 | ||||
-rw-r--r-- | Swiften/Queries/Requests/SubmitInBandRegistrationFormRequest.h | 4 | ||||
-rw-r--r-- | Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp | 2 | ||||
-rw-r--r-- | Swiften/Queries/UnitTest/RequestTest.cpp | 2 | ||||
-rw-r--r-- | Swiften/Queries/UnitTest/ResponderTest.cpp | 4 |
9 files changed, 17 insertions, 17 deletions
diff --git a/Swiften/Queries/GenericRequest.h b/Swiften/Queries/GenericRequest.h index 72bbcbd..a8e3409 100644 --- a/Swiften/Queries/GenericRequest.h +++ b/Swiften/Queries/GenericRequest.h @@ -22,7 +22,7 @@ namespace Swift { Request(type, receiver, payload, router) { } - virtual void handleResponse(boost::shared_ptr<Payload> payload, boost::optional<ErrorPayload> error) { + virtual void handleResponse(boost::shared_ptr<Payload> payload, ErrorPayload::ref error) { onResponse(boost::dynamic_pointer_cast<PAYLOAD_TYPE>(payload), error); } @@ -32,6 +32,6 @@ namespace Swift { } public: - boost::signal<void (boost::shared_ptr<PAYLOAD_TYPE>, const boost::optional<ErrorPayload>&)> onResponse; + boost::signal<void (boost::shared_ptr<PAYLOAD_TYPE>, ErrorPayload::ref)> onResponse; }; } diff --git a/Swiften/Queries/Request.cpp b/Swiften/Queries/Request.cpp index 45ece8a..35475c1 100644 --- a/Swiften/Queries/Request.cpp +++ b/Swiften/Queries/Request.cpp @@ -40,15 +40,15 @@ 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<ErrorPayload>()); + handleResponse(iq->getPayloadOfSameType(payload_), ErrorPayload::ref()); } else { - boost::shared_ptr<ErrorPayload> errorPayload = iq->getPayload<ErrorPayload>(); + ErrorPayload::ref errorPayload = iq->getPayload<ErrorPayload>(); if (errorPayload) { - handleResponse(boost::shared_ptr<Payload>(), boost::optional<ErrorPayload>(*errorPayload)); + handleResponse(boost::shared_ptr<Payload>(), errorPayload); } else { - handleResponse(boost::shared_ptr<Payload>(), boost::optional<ErrorPayload>(ErrorPayload::UndefinedCondition)); + handleResponse(boost::shared_ptr<Payload>(), ErrorPayload::ref(new ErrorPayload(ErrorPayload::UndefinedCondition))); } } router_->removeHandler(this); diff --git a/Swiften/Queries/Request.h b/Swiften/Queries/Request.h index 9184dea..625c147 100644 --- a/Swiften/Queries/Request.h +++ b/Swiften/Queries/Request.h @@ -42,7 +42,7 @@ namespace Swift { return payload_; } - virtual void handleResponse(boost::shared_ptr<Payload>, boost::optional<ErrorPayload>) = 0; + virtual void handleResponse(boost::shared_ptr<Payload>, ErrorPayload::ref) = 0; private: bool handleIQ(boost::shared_ptr<IQ>); diff --git a/Swiften/Queries/Requests/GetPrivateStorageRequest.h b/Swiften/Queries/Requests/GetPrivateStorageRequest.h index b593495..f0b95d8 100644 --- a/Swiften/Queries/Requests/GetPrivateStorageRequest.h +++ b/Swiften/Queries/Requests/GetPrivateStorageRequest.h @@ -27,7 +27,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<ErrorPayload> error) { + virtual void handleResponse(boost::shared_ptr<Payload> payload, ErrorPayload::ref error) { boost::shared_ptr<PrivateStorage> storage = boost::dynamic_pointer_cast<PrivateStorage>(payload); if (storage) { onResponse(boost::dynamic_pointer_cast<PAYLOAD_TYPE>(storage->getPayload()), error); @@ -38,6 +38,6 @@ namespace Swift { } public: - boost::signal<void (boost::shared_ptr<PAYLOAD_TYPE>, const boost::optional<ErrorPayload>&)> onResponse; + boost::signal<void (boost::shared_ptr<PAYLOAD_TYPE>, ErrorPayload::ref)> onResponse; }; } diff --git a/Swiften/Queries/Requests/SetPrivateStorageRequest.h b/Swiften/Queries/Requests/SetPrivateStorageRequest.h index 1931f3a..69eb001 100644 --- a/Swiften/Queries/Requests/SetPrivateStorageRequest.h +++ b/Swiften/Queries/Requests/SetPrivateStorageRequest.h @@ -27,11 +27,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>, boost::optional<ErrorPayload> error) { + virtual void handleResponse(boost::shared_ptr<Payload>, ErrorPayload::ref error) { onResponse(error); } public: - boost::signal<void (const boost::optional<ErrorPayload>&)> onResponse; + boost::signal<void (ErrorPayload::ref)> onResponse; }; } diff --git a/Swiften/Queries/Requests/SubmitInBandRegistrationFormRequest.h b/Swiften/Queries/Requests/SubmitInBandRegistrationFormRequest.h index fb2d344..0700c65 100644 --- a/Swiften/Queries/Requests/SubmitInBandRegistrationFormRequest.h +++ b/Swiften/Queries/Requests/SubmitInBandRegistrationFormRequest.h @@ -26,11 +26,11 @@ namespace Swift { SetInBandRegistrationRequest(const JID& to, InBandRegistrationPayload::ref payload, IQRouter* router) : Request(IQ::Set, to, InBandRegistrationPayload::ref(payload), router) { } - virtual void handleResponse(Payload::ref payload, boost::optional<ErrorPayload> error) { + virtual void handleResponse(Payload::ref payload, ErrorPayload::ref error) { onResponse(payload, error); } public: - boost::signal<void (Payload::ref, const boost::optional<ErrorPayload>&)> onResponse; + boost::signal<void (Payload::ref, ErrorPayload::ref)> onResponse; }; } diff --git a/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp b/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp index fe8b0a0..89cd7f1 100644 --- a/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp +++ b/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp @@ -78,7 +78,7 @@ class GetPrivateStorageRequestTest : public CppUnit::TestFixture } private: - void handleResponse(boost::shared_ptr<Payload> p, const boost::optional<ErrorPayload>& e) { + void handleResponse(boost::shared_ptr<Payload> p, ErrorPayload::ref e) { if (e) { errors.push_back(*e); } diff --git a/Swiften/Queries/UnitTest/RequestTest.cpp b/Swiften/Queries/UnitTest/RequestTest.cpp index 0e0653b..3d8d6f2 100644 --- a/Swiften/Queries/UnitTest/RequestTest.cpp +++ b/Swiften/Queries/UnitTest/RequestTest.cpp @@ -136,7 +136,7 @@ class RequestTest : public CppUnit::TestFixture } private: - void handleResponse(boost::shared_ptr<Payload> p, const boost::optional<ErrorPayload>& e) { + void handleResponse(boost::shared_ptr<Payload> p, ErrorPayload::ref e) { if (e) { receivedErrors.push_back(*e); } diff --git a/Swiften/Queries/UnitTest/ResponderTest.cpp b/Swiften/Queries/UnitTest/ResponderTest.cpp index aba2cb9..3a17729 100644 --- a/Swiften/Queries/UnitTest/ResponderTest.cpp +++ b/Swiften/Queries/UnitTest/ResponderTest.cpp @@ -131,13 +131,13 @@ class ResponderTest : public CppUnit::TestFixture public: MyResponder(IQRouter* router) : Responder<SoftwareVersion>(router), getRequestResponse_(true), setRequestResponse_(true) {} - virtual bool handleGetRequest(const JID& from, const JID& to, const String& id, boost::shared_ptr<SoftwareVersion> payload) { + virtual bool handleGetRequest(const JID& from, const JID&, const String& id, boost::shared_ptr<SoftwareVersion> payload) { CPPUNIT_ASSERT_EQUAL(JID("foo@bar.com/baz"), from); CPPUNIT_ASSERT_EQUAL(String("myid"), id); getPayloads_.push_back(payload); return getRequestResponse_; } - virtual bool handleSetRequest(const JID& from, const JID& to, const String& id, boost::shared_ptr<SoftwareVersion> payload) { + virtual bool handleSetRequest(const JID& from, const JID&, const String& id, boost::shared_ptr<SoftwareVersion> payload) { CPPUNIT_ASSERT_EQUAL(JID("foo@bar.com/baz"), from); CPPUNIT_ASSERT_EQUAL(String("myid"), id); setPayloads_.push_back(payload); |