summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-03-01 08:45:36 (GMT)
committerKevin Smith <kevin.smith@isode.com>2016-03-09 16:48:50 (GMT)
commit4da2f1c85f2eeac9fb98d5dcc9097eeed9b34e8b (patch)
tree3d3d512818b2fe3ae3265c559bfac143eefdc93a /Swiften/VCards
parentb792712c9a406a7913935c23d535f214bfd758e8 (diff)
downloadswift-4da2f1c85f2eeac9fb98d5dcc9097eeed9b34e8b.zip
swift-4da2f1c85f2eeac9fb98d5dcc9097eeed9b34e8b.tar.bz2
Improve profile editing UX when vCard is not supported
Previously, when editing your own vCard and the server responded with an error, the user would indefinitely see a spinner. With this commit, the user will see an error message instead. Test-Information: Tested on OS X 10.11.3, with a XMPP server with enabled and disabled vCards. The enabled case still works as expected and in the disabled case the error message is shown, instead of the indefinite spinner. Change-Id: Ic9167ee633a2f9a9fa3b520f6067dc2c94857c07
Diffstat (limited to 'Swiften/VCards')
-rw-r--r--Swiften/VCards/VCardManager.cpp5
-rw-r--r--Swiften/VCards/VCardManager.h15
2 files changed, 14 insertions, 6 deletions
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.