diff --git a/linphone-desktop/src/components/contact/ContactModel.cpp b/linphone-desktop/src/components/contact/ContactModel.cpp index b47a04883..23680b20d 100644 --- a/linphone-desktop/src/components/contact/ContactModel.cpp +++ b/linphone-desktop/src/components/contact/ContactModel.cpp @@ -39,6 +39,8 @@ ContactModel::ContactModel (shared_ptr linphone_friend) { } ContactModel::ContactModel (VcardModel *vcard) { + Q_ASSERT(vcard != nullptr); + QQmlEngine *engine = App::getInstance()->getEngine(); if (engine->objectOwnership(vcard) == QQmlEngine::CppOwnership) throw invalid_argument("A contact is already linked to this vcard."); @@ -49,8 +51,11 @@ ContactModel::ContactModel (VcardModel *vcard) { engine->setObjectOwnership(vcard, QQmlEngine::CppOwnership); } -void ContactModel::presenceReceived () { - Presence::PresenceStatus status = static_cast(m_linphone_friend->getConsolidatedPresence()); +void ContactModel::refreshPresence () { + Presence::PresenceStatus status = static_cast( + m_linphone_friend->getConsolidatedPresence() + ); + emit presenceStatusChanged(status); emit presenceLevelChanged(Presence::getPresenceLevel(status)); } diff --git a/linphone-desktop/src/components/contact/ContactModel.hpp b/linphone-desktop/src/components/contact/ContactModel.hpp index ffc22ef74..59902be40 100644 --- a/linphone-desktop/src/components/contact/ContactModel.hpp +++ b/linphone-desktop/src/components/contact/ContactModel.hpp @@ -48,7 +48,7 @@ public: return m_vcard; } - void presenceReceived (); + void refreshPresence (); Q_INVOKABLE void startEdit (); Q_INVOKABLE void endEdit (); diff --git a/linphone-desktop/src/components/core/CoreHandlers.cpp b/linphone-desktop/src/components/core/CoreHandlers.cpp index dcc5f0c2c..da334279d 100644 --- a/linphone-desktop/src/components/core/CoreHandlers.cpp +++ b/linphone-desktop/src/components/core/CoreHandlers.cpp @@ -69,12 +69,11 @@ void CoreHandlers::onMessageReceived ( void CoreHandlers::onNotifyPresenceReceivedForUriOrTel ( const shared_ptr &, - const shared_ptr &lf, + const shared_ptr &linphone_friend, const string &, const shared_ptr & ) { - ContactModel *contact_model = &lf->getData("contact-model"); - contact_model->presenceReceived(); + linphone_friend->getData("contact-model").refreshPresence(); } void CoreHandlers::onRegistrationStateChanged (