diff options
| -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 @@ -462,21 +462,19 @@ void MainController::handleChangeStatusRequest(StatusShow::Type show, const std: } void MainController::sendPresence(boost::shared_ptr<Presence> presence) { rosterController_->getWindow()->setMyStatusType(presence->getShow()); rosterController_->getWindow()->setMyStatusText(presence->getStatus()); systemTrayController_->setMyStatusType(presence->getShow()); notifier_->setTemporarilyDisabled(presence->getShow() == StatusShow::DND); // 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) { logout(); } } void MainController::handleInputIdleChanged(bool idle) { if (!statusTracker_) { //Haven't logged in yet. @@ -762,22 +760,25 @@ void MainController::handleServerDiscoInfoResponse(boost::shared_ptr<DiscoInfo> adHocManager_->setServerDiscoInfo(info); if (info->hasFeature(DiscoInfo::BlockingCommandFeature)) { rosterController_->getWindow()->setBlockingCommandAvailable(true); rosterController_->initBlockingCommand(); } } } 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; if (client_ && client_->isAvailable()) { sendPresence(statusTracker_->getNextPresence()); } } } void MainController::handleNotificationClicked(const JID& jid) { |
Swift