diff options
author | Alex Clayton <alex.clayton@isode.com> | 2016-03-10 12:00:49 (GMT) |
---|---|---|
committer | Alex Clayton <alex.clayton@isode.com> | 2016-03-14 14:08:40 (GMT) |
commit | 9a5a18ee69e1daf50ac60c3c33619fa13743205f (patch) | |
tree | a9cb31beb7aec44e09a7f7eeffe5b672acc052b6 /src | |
parent | 5c9f31f688e480d63daab8f99205a05ff4f91e8b (diff) | |
download | stroke-9a5a18ee69e1daf50ac60c3c33619fa13743205f.zip stroke-9a5a18ee69e1daf50ac60c3c33619fa13743205f.tar.bz2 |
Do not flush VCard cache if IQ request returns an error.
As per swiften patch of the same name
(37aafcb4d693a0b4f5944a52e0c070e5aa384245) changes behaviour of VCard
cache slightly, and updates test accordingly.
Test-information: Unit tests pass.
Change-Id: I933c8000b4cb73b43db28db94887a768d0272dd2
Diffstat (limited to 'src')
-rw-r--r-- | src/com/isode/stroke/vcards/VCardManager.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/com/isode/stroke/vcards/VCardManager.java b/src/com/isode/stroke/vcards/VCardManager.java index 80e7942..082aeeb 100644 --- a/src/com/isode/stroke/vcards/VCardManager.java +++ b/src/com/isode/stroke/vcards/VCardManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015, Isode Limited, London, England. + * Copyright (c) 2010-2016, Isode Limited, London, England. * All rights reserved. */ package com.isode.stroke.vcards; @@ -82,14 +82,15 @@ public class VCardManager { requestVCard(new JID()); } - private void handleVCardReceived(final JID actualJID, VCard vcard, ErrorPayload error) { - if (error != null || vcard == null) { - vcard = new VCard(); + if (error == null) { + if (vcard == null) { + vcard = new VCard(); + } + requestedVCards.remove(actualJID); + JID jid = actualJID.isValid() ? actualJID : ownJID.toBare(); + setVCard(jid, vcard); } - requestedVCards.remove(actualJID); - JID jid = actualJID.isValid() ? actualJID : ownJID.toBare(); - setVCard(jid, vcard); } public SetVCardRequest createSetVCardRequest(final VCard vcard) { |