summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot4.cpp2
-rw-r--r--Documentation/SwiftenDevelopersGuide/Examples/EchoBot/EchoBot5.cpp2
-rw-r--r--Swift/Controllers/Chat/ChatControllerBase.cpp2
-rw-r--r--Swift/Controllers/Chat/ChatControllerBase.h2
-rw-r--r--Swift/Controllers/Chat/MUCSearchController.cpp16
-rw-r--r--Swift/Controllers/Chat/MUCSearchController.h8
-rw-r--r--Swift/Controllers/MainController.cpp2
-rw-r--r--Swift/Controllers/MainController.h2
-rw-r--r--Swift/Controllers/RosterController.cpp2
-rw-r--r--Swift/Controllers/RosterController.h2
-rw-r--r--Swiften/Disco/CapsManager.cpp2
-rw-r--r--Swiften/Disco/CapsManager.h2
-rw-r--r--Swiften/Elements/ErrorPayload.h8
-rw-r--r--Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp2
-rw-r--r--Swiften/FileTransfer/IBBSendSession.cpp2
-rw-r--r--Swiften/FileTransfer/IBBSendSession.h2
-rw-r--r--Swiften/FileTransfer/OutgoingFileTransfer.cpp4
-rw-r--r--Swiften/FileTransfer/OutgoingFileTransfer.h4
-rw-r--r--Swiften/MUC/MUC.cpp5
-rw-r--r--Swiften/MUC/MUC.h2
-rw-r--r--Swiften/MUC/MUCBookmarkManager.cpp2
-rw-r--r--Swiften/MUC/MUCBookmarkManager.h2
-rw-r--r--Swiften/Queries/GenericRequest.h4
-rw-r--r--Swiften/Queries/Request.cpp8
-rw-r--r--Swiften/Queries/Request.h2
-rw-r--r--Swiften/Queries/Requests/GetPrivateStorageRequest.h4
-rw-r--r--Swiften/Queries/Requests/SetPrivateStorageRequest.h4
-rw-r--r--Swiften/Queries/Requests/SubmitInBandRegistrationFormRequest.h4
-rw-r--r--Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp2
-rw-r--r--Swiften/Queries/UnitTest/RequestTest.cpp2
-rw-r--r--Swiften/Queries/UnitTest/ResponderTest.cpp4
-rw-r--r--Swiften/Roster/SetRosterRequest.h4
-rw-r--r--Swiften/VCards/VCardManager.cpp2
-rw-r--r--Swiften/VCards/VCardManager.h2
34 files changed, 59 insertions, 60 deletions
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<ErrorPayload>& 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<ErrorPayload>& 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<Stanza>(message));
}
-void ChatControllerBase::handleSecurityLabelsCatalogResponse(boost::shared_ptr<SecurityLabelsCatalog> catalog, const boost::optional<ErrorPayload>& error) {
+void ChatControllerBase::handleSecurityLabelsCatalogResponse(boost::shared_ptr<SecurityLabelsCatalog> 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<SecurityLabelsCatalog>, const boost::optional<ErrorPayload>& error);
+ void handleSecurityLabelsCatalogResponse(boost::shared_ptr<SecurityLabelsCatalog>, ErrorPayload::ref error);
String getErrorMessage(boost::shared_ptr<ErrorPayload>);
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<DiscoInfo> info, const boost::optional<ErrorPayload>& error, const JID& jid) {
+void MUCSearchController::handleDiscoInfoResponse(boost::shared_ptr<DiscoInfo> 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<DiscoInfo> i
refreshView();
}
-void MUCSearchController::handleRoomsItemsResponse(boost::shared_ptr<DiscoItems> items, const boost::optional<ErrorPayload>& error, const JID& jid) {
+void MUCSearchController::handleRoomsItemsResponse(boost::shared_ptr<DiscoItems> 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<DiscoItems>
refreshView();
}
-void MUCSearchController::handleServerItemsResponse(boost::shared_ptr<DiscoItems> items, const boost::optional<ErrorPayload>& error, const JID& jid) {
+void MUCSearchController::handleServerItemsResponse(boost::shared_ptr<DiscoItems> 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_ptr<DiscoItems
refreshView();
}
-void MUCSearchController::handleDiscoError(const JID& jid, const ErrorPayload& error) {
+void MUCSearchController::handleDiscoError(const JID& jid, ErrorPayload::ref error) {
serviceDetails_[jid].setComplete(true);
- serviceDetails_[jid].setError(error.getText());
+ serviceDetails_[jid].setError(error->getText());
}
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<UIEvent> event);
void handleAddService(const JID& jid, bool userTriggered=false);
- void handleDiscoInfoResponse(boost::shared_ptr<DiscoInfo> info, const boost::optional<ErrorPayload>& error, const JID& jid);
- void handleRoomsItemsResponse(boost::shared_ptr<DiscoItems> items, const boost::optional<ErrorPayload>& error, const JID& jid);
- void handleServerItemsResponse(boost::shared_ptr<DiscoItems> items, const boost::optional<ErrorPayload>& error, const JID& jid);
- void handleDiscoError(const JID& jid, const ErrorPayload& error);
+ void handleDiscoInfoResponse(boost::shared_ptr<DiscoInfo> info, ErrorPayload::ref error, const JID& jid);
+ void handleRoomsItemsResponse(boost::shared_ptr<DiscoItems> items, ErrorPayload::ref error, const JID& jid);
+ void handleServerItemsResponse(boost::shared_ptr<DiscoItems> 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<DiscoInfo> info, const boost::optional<ErrorPayload>& error) {
+void MainController::handleServerDiscoInfoResponse(boost::shared_ptr<DiscoInfo> 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<ClientError>& error);
- void handleServerDiscoInfoResponse(boost::shared_ptr<DiscoInfo>, const boost::optional<ErrorPayload>&);
+ void handleServerDiscoInfoResponse(boost::shared_ptr<DiscoInfo>, ErrorPayload::ref);
void handleEventQueueLengthChange(int count);
void handleVCardReceived(const JID& j, VCard::ref vCard);
void handleUIEvent(boost::shared_ptr<UIEvent> 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<UIEvent> event) {
}
}
-void RosterController::handleRosterSetError(boost::optional<ErrorPayload> error, boost::shared_ptr<RosterPayload> rosterPayload) {
+void RosterController::handleRosterSetError(ErrorPayload::ref error, boost::shared_ptr<RosterPayload> 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<UIEvent> event);
- void handleRosterSetError(boost::optional<ErrorPayload> error, boost::shared_ptr<RosterPayload> rosterPayload);
+ void handleRosterSetError(ErrorPayload::ref error, boost::shared_ptr<RosterPayload> 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<ErrorPayload>& 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<Presence>);
void handleStanzaChannelAvailableChanged(bool);
- void handleDiscoInfoReceived(const JID&, const String& hash, DiscoInfo::ref, const boost::optional<ErrorPayload>&);
+ 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 <boost/shared_ptr.hpp>
+
#include "Swiften/Elements/Payload.h"
#include "Swiften/Base/String.h"
namespace Swift {
class ErrorPayload : public Payload {
public:
+ typedef boost::shared_ptr<ErrorPayload> 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<DiscoInfo> /*info*/, const boost::optional<ErrorPayload>& error) {
+void handleServerDiscoInfoResponse(boost::shared_ptr<DiscoInfo> /*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<FileTransferError>());
}
-void IBBSendSession::handleIBBResponse(IBB::ref, const boost::optional<ErrorPayload>& 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<void (boost::optional<FileTransferError>)> onFinished;
private:
- void handleIBBResponse(IBB::ref, const boost::optional<ErrorPayload>&);
+ void handleIBBResponse(IBB::ref, ErrorPayload::ref);
void finish(boost::optional<FileTransferError>);
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<ErrorPayload>& 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<ErrorPayload>& 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<void (const boost::optional<FileTransferError>&)> onFinished;
private:
- void handleStreamInitiationRequestResponse(StreamInitiation::ref, const boost::optional<ErrorPayload>&);
- void handleBytestreamsRequestResponse(Bytestreams::ref, const boost::optional<ErrorPayload>&);
+ void handleStreamInitiationRequestResponse(StreamInitiation::ref, ErrorPayload::ref);
+ void handleBytestreamsRequestResponse(Bytestreams::ref, ErrorPayload::ref);
void finish(boost::optional<FileTransferError> error);
void handleIBBSessionFinished(boost::optional<FileTransferError> 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> presence) {
}
-void MUC::handleCreationConfigResponse(boost::shared_ptr<MUCOwnerPayload> /*unused*/, const boost::optional<ErrorPayload>& error) {
+void MUC::handleCreationConfigResponse(boost::shared_ptr<MUCOwnerPayload> /*unused*/, ErrorPayload::ref error) {
if (error) {
- boost::shared_ptr<ErrorPayload> 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> presence);
void internalJoin(const String& nick);
- void handleCreationConfigResponse(boost::shared_ptr<MUCOwnerPayload>, const boost::optional<ErrorPayload>&);
+ void handleCreationConfigResponse(boost::shared_ptr<MUCOwnerPayload>, 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<Storage> payload, const boost::optional<ErrorPayload>& error) {
+void MUCBookmarkManager::handleBookmarksReceived(boost::shared_ptr<Storage> 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<MUCBookmark>& list, const MUCBookmark& bookmark);
- void handleBookmarksReceived(boost::shared_ptr<Storage> payload, const boost::optional<ErrorPayload>& error);
+ void handleBookmarksReceived(boost::shared_ptr<Storage> 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> 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);
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<RosterPayload> payload, IQRouter* router) : Request(IQ::Set, JID(), boost::shared_ptr<RosterPayload>(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(error);
}
public:
- boost::signal<void (const boost::optional<ErrorPayload>&)> onResponse;
+ boost::signal<void (ErrorPayload::ref)> 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<ErrorPayload>& 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<void (const JID&, VCard::ref)> onVCardChanged;
private:
- void handleVCardReceived(const JID& from, VCard::ref, const boost::optional<ErrorPayload>&);
+ void handleVCardReceived(const JID& from, VCard::ref, ErrorPayload::ref);
private:
JID ownJID;