Add Admin and subject change events

This commit is contained in:
Julien Wadel 2021-08-16 21:12:20 +02:00
parent f38574e5af
commit b765866a27
3 changed files with 30 additions and 2 deletions

View file

@ -110,6 +110,22 @@ bool ChatNoticeModel::update(){
break;
}
case linphone::EventLog::Type::ConferenceSubjectChanged : {
setName(Utils::coreStringToAppString(mEventLog->getSubject()));
setStatus(NoticeType::NoticeMessage);
break;
}
case linphone::EventLog::Type::ConferenceParticipantSetAdmin :
case linphone::EventLog::Type::ConferenceParticipantUnsetAdmin :
{
setName(Utils::getDisplayName(participantAddress));
setStatus(NoticeType::NoticeMessage);
break;
}
default:{
handledEvent = false;
}

View file

@ -1044,6 +1044,10 @@ void ChatRoomModel::onParticipantRemoved(const std::shared_ptr<linphone::ChatRoo
}
void ChatRoomModel::onParticipantAdminStatusChanged(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
auto events = chatRoom->getHistoryEvents(0);
auto e = std::find(events.begin(), events.end(), eventLog);
if( e != events.end() )
insertNotice(*e);
setLastUpdateTime(QDateTime::fromMSecsSinceEpoch(chatRoom->getLastUpdateTime()));
emit participantAdminStatusChanged(chatRoom, eventLog);
emit isMeAdminChanged(); // It is not the case all the time but calling getters is not a heavy request
@ -1063,6 +1067,10 @@ void ChatRoomModel::onSecurityEvent(const std::shared_ptr<linphone::ChatRoom> &
emit securityLevelChanged((int)chatRoom->getSecurityLevel());
}
void ChatRoomModel::onSubjectChanged(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog) {
auto events = chatRoom->getHistoryEvents(0);
auto e = std::find(events.begin(), events.end(), eventLog);
if( e != events.end() )
insertNotice(*e);
setLastUpdateTime(QDateTime::fromMSecsSinceEpoch(chatRoom->getLastUpdateTime()));
emit subjectChanged(getSubject());
emit usernameChanged();

View file

@ -36,10 +36,10 @@ RowLayout{
return '%1 has left';
}
if (status == LinphoneEnums.EventLogTypeConferenceParticipantSetAdmin) {
return 'EventLogTypeConferenceParticipantSetAdmin';
return '%1 is now an admin';
}
if (status == LinphoneEnums.EventLogTypeConferenceParticipantUnsetAdmin) {
return 'EventLogTypeConferenceParticipantUnsetAdmin';
return '%1 is no more an admin';
}
if (status == LinphoneEnums.EventLogTypeConferenceParticipantDeviceAdded) {
return 'EventLogTypeConferenceParticipantDeviceAdded';
@ -65,6 +65,10 @@ RowLayout{
if (status == LinphoneEnums.EventLogTypeConferenceEphemeralMessageDisabled) {
return 'You disabled ephemeral messages';
}
if (status == LinphoneEnums.EventLogTypeConferenceSubjectChanged) {
return 'New subject : %1';
}
return 'unknown_notice'
}