Hide presence if not in contact

This commit is contained in:
Julien Wadel 2021-08-11 20:41:00 +02:00
parent e4952ab5c0
commit 38d01ce997
3 changed files with 6 additions and 21 deletions

View file

@ -420,13 +420,12 @@ int ChatRoomModel::getPresenceStatus() const {
auto participants = mChatRoom->getParticipants();
auto contact = CoreManager::getInstance()->getContactsListModel()->findContactModelFromSipAddress(Utils::coreStringToAppString((*participants.begin())->getAddress()->asString()));
if(contact) {
int p = contact->getPresenceLevel();
return p;
return contact->getPresenceLevel();
}
else
return 0;
return -1;
}else
return 0;
return -1;
}
ParticipantListModel* ChatRoomModel::getParticipants() const{

View file

@ -71,6 +71,7 @@ Item {
PresenceLevel {
id: presenceLevelIcon
visible: level >= 0
anchors {
bottom: parent.bottom

View file

@ -52,25 +52,10 @@ Rectangle {
//image: _contact && _contact.vcard.avatar
image: entry?(entry.contactModel?entry.contactModel.vcard.avatar:entry.avatar?entry.avatar: ''):''
presenceLevel: entry?(entry.contactModel ? Presence.getPresenceLevel(entry.contactModel.presenceStatus)
: Presence.getPresenceLevel(entry.presenceStatus)
presenceLevel: entry?(entry.contactModel ? (entry.contactModel.presenceStatus >= 0 ? Presence.getPresenceLevel(entry.contactModel.presenceStatus) : -1)
: (entry.presenceStatus >= 0 ? Presence.getPresenceLevel(entry.presenceStatus) : -1)
)
:-1
/*
Connections{
target: entry.contactModel?entry.contactModel:entry
onPresenceStatusChanged:{
if(entry){
if(entry.contactModel){
avatar.presenceLevel = Presence.getPresenceLevel(entry.contactModel.presenceStatus);
}else {
avatar.presenceLevel = Presence.getPresenceLevel(entry.presenceStatus);
}
}else {
avatar.presenceLevel = -1;
}
}
}*/
//username: LinphoneUtils.getContactUsername(_contact || entry.sipAddress || entry.fullPeerAddress || entry.peerAddress || '')
//username: UtilsCpp.getDisplayName(entry.sipAddress || entry.peerAddress )