summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2018-03-27 16:32:09 (GMT)
committerTobias Markmann <tm@ayena.de>2018-03-28 16:06:10 (GMT)
commit44d588baf1f9324ced16e003d0209bd1e3c546ab (patch)
tree6627190d9498f69dc505d678a31ae040003caa96 /Swiften/VCards/VCardManager.cpp
parent5ba3f18ad8efa040d49f36d83ec2e7891a9add9f (diff)
downloadswift-44d588baf1f9324ced16e003d0209bd1e3c546ab.zip
swift-44d588baf1f9324ced16e003d0209bd1e3c546ab.tar.bz2
Fix error response handling when requesting VCardsswift-4.0.1
When fetching a vCard, an empty vCard response and an item-not-found error are semantically the same. Changed the code to treat and item-not-found error as an empty vCard in this case. This enables setting your own vCard on servers that do not return an empty vCard for fresh accounts and generally improves UX when fetching others vCards. Test-Information: Added unit tests verifying new behaviour. Tested with Swift against a Prosody IM instance. Without this change you cannot set the vCard on a fresh user. With this patch you can set your own vCard. Change-Id: I5f9adb4c3d6b6a1a320b834be918ab5ab0b52975
Diffstat (limited to 'Swiften/VCards/VCardManager.cpp')
-rw-r--r--Swiften/VCards/VCardManager.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/Swiften/VCards/VCardManager.cpp b/Swiften/VCards/VCardManager.cpp
index 95b96fa..9423702 100644
--- a/Swiften/VCards/VCardManager.cpp
+++ b/Swiften/VCards/VCardManager.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2016 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -50,10 +50,9 @@ void VCardManager::requestOwnVCard() {
requestVCard(JID());
}
-
void VCardManager::handleVCardReceived(const JID& actualJID, VCard::ref vcard, ErrorPayload::ref error) {
requestedVCards.erase(actualJID);
- if (!error) {
+ if (!error || (error && error->getCondition() == ErrorPayload::ItemNotFound)) {
if (!vcard) {
vcard = VCard::ref(new VCard());
}