From f4e2f1deecd322e859bfb27bc5a9ab97726481c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Sun, 28 Nov 2010 13:08:54 +0100 Subject: Change error from optional to shared_ptr in GenericRequest Resolves: #692 diff --git a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot4.cpp b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot4.cpp index 077e749..9b2277b 100644 --- a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot4.cpp +++ b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot4.cpp @@ -57,7 +57,7 @@ class EchoBot { rosterRequest->send(); } - void handleRosterReceived(const optional& error) { + void handleRosterReceived(ErrorPayload::ref error) { if (error) { std::cerr << "Error receiving roster. Continuing anyway."; } diff --git a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot5.cpp b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot5.cpp index 6690b7c..47cbe1f 100644 --- a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot5.cpp +++ b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot5.cpp @@ -63,7 +63,7 @@ class EchoBot { rosterRequest->send(); } - void handleRosterReceived(const optional& error) { + void handleRosterReceived(ErrorPayload::ref error) { if (error) { std::cerr << "Error receiving roster. Continuing anyway."; } diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp index bbc04f6..7430f69 100644 --- a/Swift/Controllers/Chat/ChatControllerBase.cpp +++ b/Swift/Controllers/Chat/ChatControllerBase.cpp @@ -106,7 +106,7 @@ void ChatControllerBase::handleSendMessageRequest(const String &body) { postSendMessage(message->getBody(), boost::dynamic_pointer_cast(message)); } -void ChatControllerBase::handleSecurityLabelsCatalogResponse(boost::shared_ptr catalog, const boost::optional& error) { +void ChatControllerBase::handleSecurityLabelsCatalogResponse(boost::shared_ptr catalog, ErrorPayload::ref error) { if (!error) { if (catalog->getLabels().size() == 0) { chatWindow_->setSecurityLabelsEnabled(false); diff --git a/Swift/Controllers/Chat/ChatControllerBase.h b/Swift/Controllers/Chat/ChatControllerBase.h index efbf7b4..e1e5e62 100644 --- a/Swift/Controllers/Chat/ChatControllerBase.h +++ b/Swift/Controllers/Chat/ChatControllerBase.h @@ -66,7 +66,7 @@ namespace Swift { void createDayChangeTimer(); void handleSendMessageRequest(const String &body); void handleAllMessagesRead(); - void handleSecurityLabelsCatalogResponse(boost::shared_ptr, const boost::optional& error); + void handleSecurityLabelsCatalogResponse(boost::shared_ptr, ErrorPayload::ref error); String getErrorMessage(boost::shared_ptr); void handleDayChangeTick(); diff --git a/Swift/Controllers/Chat/MUCSearchController.cpp b/Swift/Controllers/Chat/MUCSearchController.cpp index e4592a9..7368dbb 100644 --- a/Swift/Controllers/Chat/MUCSearchController.cpp +++ b/Swift/Controllers/Chat/MUCSearchController.cpp @@ -108,9 +108,9 @@ void MUCSearchController::removeService(const JID& jid) { refreshView(); } -void MUCSearchController::handleDiscoInfoResponse(boost::shared_ptr info, const boost::optional& error, const JID& jid) { +void MUCSearchController::handleDiscoInfoResponse(boost::shared_ptr info, ErrorPayload::ref error, const JID& jid) { if (error) { - handleDiscoError(jid, error.get()); + handleDiscoError(jid, error); return; } GetDiscoItemsRequest::ref discoItemsRequest = GetDiscoItemsRequest::create(jid, iqRouter_); @@ -148,9 +148,9 @@ void MUCSearchController::handleDiscoInfoResponse(boost::shared_ptr i refreshView(); } -void MUCSearchController::handleRoomsItemsResponse(boost::shared_ptr items, const boost::optional& error, const JID& jid) { +void MUCSearchController::handleRoomsItemsResponse(boost::shared_ptr items, ErrorPayload::ref error, const JID& jid) { if (error) { - handleDiscoError(jid, error.get()); + handleDiscoError(jid, error); return; } serviceDetails_[jid].clearRooms(); @@ -161,9 +161,9 @@ void MUCSearchController::handleRoomsItemsResponse(boost::shared_ptr refreshView(); } -void MUCSearchController::handleServerItemsResponse(boost::shared_ptr items, const boost::optional& error, const JID& jid) { +void MUCSearchController::handleServerItemsResponse(boost::shared_ptr items, ErrorPayload::ref error, const JID& jid) { if (error) { - handleDiscoError(jid, error.get()); + handleDiscoError(jid, error); return; } if (jid.isValid()) { @@ -180,9 +180,9 @@ void MUCSearchController::handleServerItemsResponse(boost::shared_ptrgetText()); } void MUCSearchController::refreshView() { diff --git a/Swift/Controllers/Chat/MUCSearchController.h b/Swift/Controllers/Chat/MUCSearchController.h index 10988ad..f09a801 100644 --- a/Swift/Controllers/Chat/MUCSearchController.h +++ b/Swift/Controllers/Chat/MUCSearchController.h @@ -91,10 +91,10 @@ namespace Swift { private: void handleUIEvent(boost::shared_ptr event); void handleAddService(const JID& jid, bool userTriggered=false); - void handleDiscoInfoResponse(boost::shared_ptr info, const boost::optional& error, const JID& jid); - void handleRoomsItemsResponse(boost::shared_ptr items, const boost::optional& error, const JID& jid); - void handleServerItemsResponse(boost::shared_ptr items, const boost::optional& error, const JID& jid); - void handleDiscoError(const JID& jid, const ErrorPayload& error); + void handleDiscoInfoResponse(boost::shared_ptr info, ErrorPayload::ref error, const JID& jid); + void handleRoomsItemsResponse(boost::shared_ptr items, ErrorPayload::ref error, const JID& jid); + void handleServerItemsResponse(boost::shared_ptr items, ErrorPayload::ref error, const JID& jid); + void handleDiscoError(const JID& jid, ErrorPayload::ref error); void removeService(const JID& jid); void refreshView(); void loadServices(); diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index 49c4a23..8d78671 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -495,7 +495,7 @@ void MainController::setManagersOffline() { } } -void MainController::handleServerDiscoInfoResponse(boost::shared_ptr info, const boost::optional& error) { +void MainController::handleServerDiscoInfoResponse(boost::shared_ptr info, ErrorPayload::ref error) { if (!error) { chatsManager_->setServerDiscoInfo(info); } diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h index d2d55ac..8f7298b 100644 --- a/Swift/Controllers/MainController.h +++ b/Swift/Controllers/MainController.h @@ -91,7 +91,7 @@ namespace Swift { void handleQuitRequest(); void handleChangeStatusRequest(StatusShow::Type show, const String &statusText); void handleDisconnected(const boost::optional& error); - void handleServerDiscoInfoResponse(boost::shared_ptr, const boost::optional&); + void handleServerDiscoInfoResponse(boost::shared_ptr, ErrorPayload::ref); void handleEventQueueLengthChange(int count); void handleVCardReceived(const JID& j, VCard::ref vCard); void handleUIEvent(boost::shared_ptr event); diff --git a/Swift/Controllers/RosterController.cpp b/Swift/Controllers/RosterController.cpp index 038a883..cb044fb 100644 --- a/Swift/Controllers/RosterController.cpp +++ b/Swift/Controllers/RosterController.cpp @@ -236,7 +236,7 @@ void RosterController::handleUIEvent(boost::shared_ptr event) { } } -void RosterController::handleRosterSetError(boost::optional error, boost::shared_ptr rosterPayload) { +void RosterController::handleRosterSetError(ErrorPayload::ref error, boost::shared_ptr rosterPayload) { if (!error) { return; } diff --git a/Swift/Controllers/RosterController.h b/Swift/Controllers/RosterController.h index be9e407..2b1793e 100644 --- a/Swift/Controllers/RosterController.h +++ b/Swift/Controllers/RosterController.h @@ -58,7 +58,7 @@ namespace Swift { void handleSubscriptionRequestAccepted(SubscriptionRequestEvent* event); void handleSubscriptionRequestDeclined(SubscriptionRequestEvent* event); void handleUIEvent(boost::shared_ptr event); - void handleRosterSetError(boost::optional error, boost::shared_ptr rosterPayload); + void handleRosterSetError(ErrorPayload::ref error, boost::shared_ptr rosterPayload); void handleOwnNickChanged(const String& nick); void applyAllPresenceTo(const JID& jid); JID myJID_; diff --git a/Swiften/Disco/CapsManager.cpp b/Swiften/Disco/CapsManager.cpp index 43c2805..1c785e5 100644 --- a/Swiften/Disco/CapsManager.cpp +++ b/Swiften/Disco/CapsManager.cpp @@ -48,7 +48,7 @@ void CapsManager::handleStanzaChannelAvailableChanged(bool available) { } } -void CapsManager::handleDiscoInfoReceived(const JID& from, const String& hash, DiscoInfo::ref discoInfo, const boost::optional& error) { +void CapsManager::handleDiscoInfoReceived(const JID& from, const String& hash, DiscoInfo::ref discoInfo, ErrorPayload::ref error) { requestedDiscoInfos.erase(hash); if (error || CapsInfoGenerator("").generateCapsInfo(*discoInfo.get()).getVersion() != hash) { if (warnOnInvalidHash && !error) { diff --git a/Swiften/Disco/CapsManager.h b/Swiften/Disco/CapsManager.h index cbe3a44..842f2be 100644 --- a/Swiften/Disco/CapsManager.h +++ b/Swiften/Disco/CapsManager.h @@ -36,7 +36,7 @@ namespace Swift { private: void handlePresenceReceived(boost::shared_ptr); void handleStanzaChannelAvailableChanged(bool); - void handleDiscoInfoReceived(const JID&, const String& hash, DiscoInfo::ref, const boost::optional&); + void handleDiscoInfoReceived(const JID&, const String& hash, DiscoInfo::ref, ErrorPayload::ref); void requestDiscoInfo(const JID& jid, const String& node, const String& hash); private: diff --git a/Swiften/Elements/ErrorPayload.h b/Swiften/Elements/ErrorPayload.h index 9f00d53..8f849f2 100644 --- a/Swiften/Elements/ErrorPayload.h +++ b/Swiften/Elements/ErrorPayload.h @@ -6,12 +6,16 @@ #pragma once +#include + #include "Swiften/Elements/Payload.h" #include "Swiften/Base/String.h" namespace Swift { class ErrorPayload : public Payload { public: + typedef boost::shared_ptr ref; + enum Type { Cancel, Continue, Modify, Auth, Wait }; enum Condition { @@ -41,10 +45,6 @@ namespace Swift { ErrorPayload(Condition condition = UndefinedCondition, Type type = Cancel, const String& text = String()) : type_(type), condition_(condition), text_(text) { } - ErrorPayload(const ErrorPayload& other) : Payload(), type_(other.getType()), condition_(other.getCondition()), text_(other.getText()) { - - } - Type getType() const { return type_; } diff --git a/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp b/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp index c090153..578cab5 100644 --- a/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp +++ b/Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp @@ -28,7 +28,7 @@ JID recipient; int exitCode = CANNOT_CONNECT; boost::bsignals::connection errorConnection; -void handleServerDiscoInfoResponse(boost::shared_ptr /*info*/, const boost::optional& error) { +void handleServerDiscoInfoResponse(boost::shared_ptr /*info*/, ErrorPayload::ref error) { if (!error) { errorConnection.disconnect(); client->disconnect(); diff --git a/Swiften/FileTransfer/IBBSendSession.cpp b/Swiften/FileTransfer/IBBSendSession.cpp index 7246187..30f8836 100644 --- a/Swiften/FileTransfer/IBBSendSession.cpp +++ b/Swiften/FileTransfer/IBBSendSession.cpp @@ -34,7 +34,7 @@ void IBBSendSession::stop() { finish(boost::optional()); } -void IBBSendSession::handleIBBResponse(IBB::ref, const boost::optional& error) { +void IBBSendSession::handleIBBResponse(IBB::ref, ErrorPayload::ref error) { if (!error) { if (!bytestream->isFinished()) { try { diff --git a/Swiften/FileTransfer/IBBSendSession.h b/Swiften/FileTransfer/IBBSendSession.h index 102bae2..e114b23 100644 --- a/Swiften/FileTransfer/IBBSendSession.h +++ b/Swiften/FileTransfer/IBBSendSession.h @@ -34,7 +34,7 @@ namespace Swift { boost::signal)> onFinished; private: - void handleIBBResponse(IBB::ref, const boost::optional&); + void handleIBBResponse(IBB::ref, ErrorPayload::ref); void finish(boost::optional); private: diff --git a/Swiften/FileTransfer/OutgoingFileTransfer.cpp b/Swiften/FileTransfer/OutgoingFileTransfer.cpp index 9f1dd1b..4fa8d94 100644 --- a/Swiften/FileTransfer/OutgoingFileTransfer.cpp +++ b/Swiften/FileTransfer/OutgoingFileTransfer.cpp @@ -32,7 +32,7 @@ void OutgoingFileTransfer::start() { void OutgoingFileTransfer::stop() { } -void OutgoingFileTransfer::handleStreamInitiationRequestResponse(StreamInitiation::ref response, const boost::optional& error) { +void OutgoingFileTransfer::handleStreamInitiationRequestResponse(StreamInitiation::ref response, ErrorPayload::ref error) { if (error) { finish(FileTransferError()); } @@ -55,7 +55,7 @@ void OutgoingFileTransfer::handleStreamInitiationRequestResponse(StreamInitiatio } } -void OutgoingFileTransfer::handleBytestreamsRequestResponse(Bytestreams::ref, const boost::optional& error) { +void OutgoingFileTransfer::handleBytestreamsRequestResponse(Bytestreams::ref, ErrorPayload::ref error) { if (error) { finish(FileTransferError()); } diff --git a/Swiften/FileTransfer/OutgoingFileTransfer.h b/Swiften/FileTransfer/OutgoingFileTransfer.h index cfbfe21..3ecef5d 100644 --- a/Swiften/FileTransfer/OutgoingFileTransfer.h +++ b/Swiften/FileTransfer/OutgoingFileTransfer.h @@ -32,8 +32,8 @@ namespace Swift { boost::signal&)> onFinished; private: - void handleStreamInitiationRequestResponse(StreamInitiation::ref, const boost::optional&); - void handleBytestreamsRequestResponse(Bytestreams::ref, const boost::optional&); + void handleStreamInitiationRequestResponse(StreamInitiation::ref, ErrorPayload::ref); + void handleBytestreamsRequestResponse(Bytestreams::ref, ErrorPayload::ref); void finish(boost::optional error); void handleIBBSessionFinished(boost::optional error); diff --git a/Swiften/MUC/MUC.cpp b/Swiften/MUC/MUC.cpp index 86c8ca9..4185fa8 100644 --- a/Swiften/MUC/MUC.cpp +++ b/Swiften/MUC/MUC.cpp @@ -175,10 +175,9 @@ void MUC::handleIncomingPresence(boost::shared_ptr presence) { } -void MUC::handleCreationConfigResponse(boost::shared_ptr /*unused*/, const boost::optional& error) { +void MUC::handleCreationConfigResponse(boost::shared_ptr /*unused*/, ErrorPayload::ref error) { if (error) { - boost::shared_ptr errorCopy(new ErrorPayload(*error)); - onJoinFailed(errorCopy); + onJoinFailed(error); } else { /* onJoinComplete(getOwnNick()); isn't needed here, the presence will cause an emit elsewhere. */ presenceSender->addDirectedPresenceReceiver(ownMUCJID); diff --git a/Swiften/MUC/MUC.h b/Swiften/MUC/MUC.h index 3539e49..56cd392 100644 --- a/Swiften/MUC/MUC.h +++ b/Swiften/MUC/MUC.h @@ -76,7 +76,7 @@ namespace Swift { private: void handleIncomingPresence(boost::shared_ptr presence); void internalJoin(const String& nick); - void handleCreationConfigResponse(boost::shared_ptr, const boost::optional&); + void handleCreationConfigResponse(boost::shared_ptr, ErrorPayload::ref); private: JID ownMUCJID; diff --git a/Swiften/MUC/MUCBookmarkManager.cpp b/Swiften/MUC/MUCBookmarkManager.cpp index 0f5f3bb..d0855cd 100644 --- a/Swiften/MUC/MUCBookmarkManager.cpp +++ b/Swiften/MUC/MUCBookmarkManager.cpp @@ -24,7 +24,7 @@ MUCBookmarkManager::MUCBookmarkManager(IQRouter* iqRouter) { request->send(); } -void MUCBookmarkManager::handleBookmarksReceived(boost::shared_ptr payload, const boost::optional& error) { +void MUCBookmarkManager::handleBookmarksReceived(boost::shared_ptr payload, ErrorPayload::ref error) { if (error) { return; } diff --git a/Swiften/MUC/MUCBookmarkManager.h b/Swiften/MUC/MUCBookmarkManager.h index 35f5447..39699df 100644 --- a/Swiften/MUC/MUCBookmarkManager.h +++ b/Swiften/MUC/MUCBookmarkManager.h @@ -39,7 +39,7 @@ namespace Swift { private: bool containsEquivalent(const std::vector& list, const MUCBookmark& bookmark); - void handleBookmarksReceived(boost::shared_ptr payload, const boost::optional& error); + void handleBookmarksReceived(boost::shared_ptr payload, ErrorPayload::ref error); void flush(); private: 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, boost::optional error) { + virtual void handleResponse(boost::shared_ptr payload, ErrorPayload::ref error) { onResponse(boost::dynamic_pointer_cast(payload), error); } @@ -32,6 +32,6 @@ namespace Swift { } public: - boost::signal, const boost::optional&)> onResponse; + boost::signal, 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) { bool handled = false; if (sent_ && iq->getID() == id_) { if (iq->getType() == IQ::Result) { - handleResponse(iq->getPayloadOfSameType(payload_), boost::optional()); + handleResponse(iq->getPayloadOfSameType(payload_), ErrorPayload::ref()); } else { - boost::shared_ptr errorPayload = iq->getPayload(); + ErrorPayload::ref errorPayload = iq->getPayload(); if (errorPayload) { - handleResponse(boost::shared_ptr(), boost::optional(*errorPayload)); + handleResponse(boost::shared_ptr(), errorPayload); } else { - handleResponse(boost::shared_ptr(), boost::optional(ErrorPayload::UndefinedCondition)); + handleResponse(boost::shared_ptr(), 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, boost::optional) = 0; + virtual void handleResponse(boost::shared_ptr, ErrorPayload::ref) = 0; private: bool handleIQ(boost::shared_ptr); 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(new PrivateStorage(boost::shared_ptr(new PAYLOAD_TYPE()))), router) { } - virtual void handleResponse(boost::shared_ptr payload, boost::optional error) { + virtual void handleResponse(boost::shared_ptr payload, ErrorPayload::ref error) { boost::shared_ptr storage = boost::dynamic_pointer_cast(payload); if (storage) { onResponse(boost::dynamic_pointer_cast(storage->getPayload()), error); @@ -38,6 +38,6 @@ namespace Swift { } public: - boost::signal, const boost::optional&)> onResponse; + boost::signal, 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, IQRouter* router) : Request(IQ::Set, JID(), boost::shared_ptr(new PrivateStorage(payload)), router) { } - virtual void handleResponse(boost::shared_ptr, boost::optional error) { + virtual void handleResponse(boost::shared_ptr, ErrorPayload::ref error) { onResponse(error); } public: - boost::signal&)> onResponse; + boost::signal 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 error) { + virtual void handleResponse(Payload::ref payload, ErrorPayload::ref error) { onResponse(payload, error); } public: - boost::signal&)> onResponse; + boost::signal 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 p, const boost::optional& e) { + void handleResponse(boost::shared_ptr 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 p, const boost::optional& e) { + void handleResponse(boost::shared_ptr 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(router), getRequestResponse_(true), setRequestResponse_(true) {} - virtual bool handleGetRequest(const JID& from, const JID& to, const String& id, boost::shared_ptr payload) { + virtual bool handleGetRequest(const JID& from, const JID&, const String& id, boost::shared_ptr 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 payload) { + virtual bool handleSetRequest(const JID& from, const JID&, const String& id, boost::shared_ptr payload) { CPPUNIT_ASSERT_EQUAL(JID("foo@bar.com/baz"), from); CPPUNIT_ASSERT_EQUAL(String("myid"), id); setPayloads_.push_back(payload); diff --git a/Swiften/Roster/SetRosterRequest.h b/Swiften/Roster/SetRosterRequest.h index b1ecd1f..e5ae974 100644 --- a/Swiften/Roster/SetRosterRequest.h +++ b/Swiften/Roster/SetRosterRequest.h @@ -26,11 +26,11 @@ namespace Swift { SetRosterRequest(boost::shared_ptr payload, IQRouter* router) : Request(IQ::Set, JID(), boost::shared_ptr(payload), router) { } - virtual void handleResponse(boost::shared_ptr /*payload*/, boost::optional error) { + virtual void handleResponse(boost::shared_ptr /*payload*/, ErrorPayload::ref error) { onResponse(error); } public: - boost::signal&)> onResponse; + boost::signal onResponse; }; } diff --git a/Swiften/VCards/VCardManager.cpp b/Swiften/VCards/VCardManager.cpp index 5c26635..e0d3553 100644 --- a/Swiften/VCards/VCardManager.cpp +++ b/Swiften/VCards/VCardManager.cpp @@ -45,7 +45,7 @@ void VCardManager::requestOwnVCard() { } -void VCardManager::handleVCardReceived(const JID& actualJID, VCard::ref vcard, const boost::optional& error) { +void VCardManager::handleVCardReceived(const JID& actualJID, VCard::ref vcard, ErrorPayload::ref error) { if (error) { vcard = VCard::ref(new VCard()); } diff --git a/Swiften/VCards/VCardManager.h b/Swiften/VCards/VCardManager.h index 67a2ef8..e1ed44a 100644 --- a/Swiften/VCards/VCardManager.h +++ b/Swiften/VCards/VCardManager.h @@ -34,7 +34,7 @@ namespace Swift { boost::signal onVCardChanged; private: - void handleVCardReceived(const JID& from, VCard::ref, const boost::optional&); + void handleVCardReceived(const JID& from, VCard::ref, ErrorPayload::ref); private: JID ownJID; -- cgit v0.10.2-6-g49f6