summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-03-11 23:04:47 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-03-11 23:04:47 (GMT)
commit3a39980d887a874e571d59ac0cebda103300c3a5 (patch)
tree9135075403ac35d39b9f638c4a1914177ff3c525 /Swift/Controllers
parent1e63ca24edf35e5681653189fd6ca107627946f4 (diff)
downloadswift-contrib-3a39980d887a874e571d59ac0cebda103300c3a5.zip
swift-contrib-3a39980d887a874e571d59ac0cebda103300c3a5.tar.bz2
Fixed unnecessary updating and sending out VCard photo hash.
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/MainController.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index d9e177b..c4ed28e 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -561,9 +561,12 @@ void MainController::handleVCardReceived(const JID& jid, VCard::ref vCard) {
if (!jid.equals(jid_, JID::WithoutResource) || !vCard || vCard->getPhoto().isEmpty()) {
return;
}
- vCardPhotoHash_ = Hexify::hexify(SHA1::getHash(vCard->getPhoto()));
- if (client_ && client_->isAvailable()) {
- sendPresence(statusTracker_->getNextPresence());
+ std::string hash = Hexify::hexify(SHA1::getHash(vCard->getPhoto()));
+ if (hash != vCardPhotoHash_) {
+ vCardPhotoHash_ = hash;
+ if (client_ && client_->isAvailable()) {
+ sendPresence(statusTracker_->getNextPresence());
+ }
}
}