summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swift/Controllers/ProfileController.cpp13
-rw-r--r--Swift/Controllers/ProfileController.h7
-rw-r--r--Swiften/VCards/VCardManager.cpp5
-rw-r--r--Swiften/VCards/VCardManager.h15
4 files changed, 30 insertions, 10 deletions
diff --git a/Swift/Controllers/ProfileController.cpp b/Swift/Controllers/ProfileController.cpp
index 49818b0..a1aa5f9 100644
--- a/Swift/Controllers/ProfileController.cpp
+++ b/Swift/Controllers/ProfileController.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -24,6 +24,7 @@ ProfileController::ProfileController(VCardManager* vcardManager, ProfileWindowFa
ProfileController::~ProfileController() {
if (profileWindow) {
vcardManager->onOwnVCardChanged.disconnect(boost::bind(&ProfileController::handleOwnVCardChanged, this, _1));
+ vcardManager->onVCardRetrievalError.disconnect(boost::bind(&ProfileController::handleVCardRetrievalError, this, _1, _2));
profileWindow->onVCardChangeRequest.disconnect(boost::bind(&ProfileController::handleVCardChangeRequest, this, _1));
profileWindow->onWindowAboutToBeClosed.disconnect(boost::bind(&ProfileController::handleProfileWindowAboutToBeClosed, this, _1));
}
@@ -42,6 +43,7 @@ void ProfileController::handleUIEvent(UIEvent::ref event) {
profileWindow->onVCardChangeRequest.connect(boost::bind(&ProfileController::handleVCardChangeRequest, this, _1));
profileWindow->onWindowAboutToBeClosed.connect(boost::bind(&ProfileController::handleProfileWindowAboutToBeClosed, this, _1));
vcardManager->onOwnVCardChanged.connect(boost::bind(&ProfileController::handleOwnVCardChanged, this, _1));
+ vcardManager->onVCardRetrievalError.connect(boost::bind(&ProfileController::handleVCardRetrievalError, this, _1, _2));
}
gettingVCard = true;
updateDialogStatus();
@@ -71,6 +73,15 @@ void ProfileController::handleSetVCardResponse(ErrorPayload::ref error) {
}
}
+void ProfileController::handleVCardRetrievalError(const JID& jid, ErrorPayload::ref /* error */) {
+ if ((jid == JID()) && profileWindow) {
+ profileWindow->setProcessing(false);
+ profileWindow->setEnabled(false);
+ profileWindow->setVCard(boost::make_shared<VCard>());
+ profileWindow->setError(QT_TRANSLATE_NOOP("", "There was an error fetching your current profile data"));
+ }
+}
+
void ProfileController::handleOwnVCardChanged(VCard::ref vcard) {
if (profileWindow) {
profileWindow->setVCard(vcard);
diff --git a/Swift/Controllers/ProfileController.h b/Swift/Controllers/ProfileController.h
index c6f5420..ebb569d 100644
--- a/Swift/Controllers/ProfileController.h
+++ b/Swift/Controllers/ProfileController.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -13,9 +13,9 @@
#include <Swift/Controllers/UIEvents/UIEvent.h>
namespace Swift {
- class UIEventStream;
- class ProfileWindowFactory;
class ProfileWindow;
+ class ProfileWindowFactory;
+ class UIEventStream;
class VCardManager;
class ProfileController {
@@ -30,6 +30,7 @@ namespace Swift {
void handleVCardChangeRequest(VCard::ref vcard);
void handleSetVCardResponse(ErrorPayload::ref);
void handleOwnVCardChanged(VCard::ref vcard);
+ void handleVCardRetrievalError(const JID& jid, ErrorPayload::ref error);
void handleProfileWindowAboutToBeClosed(const JID&);
void updateDialogStatus();
diff --git a/Swiften/VCards/VCardManager.cpp b/Swiften/VCards/VCardManager.cpp
index 5fa44ae..347cc3d 100644
--- a/Swiften/VCards/VCardManager.cpp
+++ b/Swiften/VCards/VCardManager.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -60,6 +60,9 @@ void VCardManager::handleVCardReceived(const JID& actualJID, VCard::ref vcard, E
JID jid = actualJID.isValid() ? actualJID : ownJID.toBare();
setVCard(jid, vcard);
}
+ else {
+ onVCardRetrievalError(actualJID, error);
+ }
}
SetVCardRequest::ref VCardManager::createSetVCardRequest(VCard::ref vcard) {
diff --git a/Swiften/VCards/VCardManager.h b/Swiften/VCards/VCardManager.h
index 8b3075a..feed1bb 100644
--- a/Swiften/VCards/VCardManager.h
+++ b/Swiften/VCards/VCardManager.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2014 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -11,16 +11,16 @@
#include <boost/date_time/posix_time/posix_time.hpp>
#include <Swiften/Base/API.h>
-#include <Swiften/JID/JID.h>
-#include <Swiften/Elements/VCard.h>
+#include <Swiften/Base/boost_bsignals.h>
#include <Swiften/Elements/ErrorPayload.h>
+#include <Swiften/Elements/VCard.h>
+#include <Swiften/JID/JID.h>
#include <Swiften/VCards/SetVCardRequest.h>
-#include <Swiften/Base/boost_bsignals.h>
namespace Swift {
+ class IQRouter;
class JID;
class VCardStorage;
- class IQRouter;
class SWIFTEN_API VCardManager : public boost::bsignals::trackable {
public:
@@ -44,6 +44,11 @@ namespace Swift {
boost::signal<void (const JID&, VCard::ref)> onVCardChanged;
/**
+ * Emitted when we received an error on looking up a vCard.
+ */
+ boost::signal<void (const JID&, ErrorPayload::ref)> onVCardRetrievalError;
+
+ /**
* Emitted when our own vcard changes.
*
* onVCardChanged will also be emitted.