diff options
| author | Richard Maudsley <richard.maudsley@isode.com> | 2014-06-24 16:09:00 (GMT) |
|---|---|---|
| committer | Richard Maudsley <richard.maudsley@isode.com> | 2014-06-24 16:09:04 (GMT) |
| commit | 59c3d7532b7768c6ab0c8cf6f4c587206c080c14 (patch) | |
| tree | 490a46d3ff8852b781644475c4762d1c3f697b41 | |
| parent | c779e07f6d1d23cc157ab3823a00edd95f70ab3b (diff) | |
| download | swift-contrib-59c3d7532b7768c6ab0c8cf6f4c587206c080c14.zip swift-contrib-59c3d7532b7768c6ab0c8cf6f4c587206c080c14.tar.bz2 | |
Fix VCard update not being broadcast when clearing avatar.
Test-Information:
Connect two clients, set and clear the avatar from one of the clients, check that the second client receives a presence update with the correct hash and that the contacts avatar is updated in the roster and any open chat windows.
Change-Id: I96ad8a9cfaa618aa07acf1cb4452855435ba1179
| -rw-r--r-- | Swift/Controllers/MainController.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index 45a0df7..df137f4 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -469,7 +469,5 @@ void MainController::sendPresence(boost::shared_ptr<Presence> presence) { // Add information and send - if (!vCardPhotoHash_.empty()) { - presence->updatePayload(boost::make_shared<VCardUpdate>(vCardPhotoHash_)); - } + presence->updatePayload(boost::make_shared<VCardUpdate>(vCardPhotoHash_)); client_->getPresenceSender()->sendPresence(presence); if (presence->getType() == Presence::Unavailable) { @@ -769,8 +767,11 @@ void MainController::handleServerDiscoInfoResponse(boost::shared_ptr<DiscoInfo> void MainController::handleVCardReceived(const JID& jid, VCard::ref vCard) { - if (!jid.equals(jid_, JID::WithoutResource) || !vCard || vCard->getPhoto().empty()) { + if (!jid.equals(jid_, JID::WithoutResource) || !vCard) { return; } - std::string hash = Hexify::hexify(networkFactories_->getCryptoProvider()->getSHA1Hash(vCard->getPhoto())); + std::string hash; + if (!vCard->getPhoto().empty()) { + hash = Hexify::hexify(networkFactories_->getCryptoProvider()->getSHA1Hash(vCard->getPhoto())); + } if (hash != vCardPhotoHash_) { vCardPhotoHash_ = hash; |
Swift