Fix received time on forwards.

Remove gruu on convertion of participant addresses into string.
Fix permissions access on removing records.
This commit is contained in:
Julien Wadel 2023-08-03 11:11:40 +02:00
parent 6bb29f5061
commit b8a6339e69
6 changed files with 21 additions and 9 deletions

View file

@ -288,9 +288,9 @@ void ChatMessageModel::updateFileTransferInformation(){
mContentListModel->updateContents(this);
}
QDateTime ChatMessageModel::initReceivedTimestamp(const std::shared_ptr<linphone::ChatMessage> &message, bool isNew){
QDateTime ChatMessageModel::initReceivedTimestamp(const std::shared_ptr<linphone::ChatMessage> &message, bool isNew, bool force){
auto appdata = ChatEvent::AppDataManager(QString::fromStdString(message->getAppdata()));
if(!appdata.mData.contains("receivedTime")){// If already set : Do not overwrite.
if(force || !appdata.mData.contains("receivedTime")){// If already set : Do not overwrite.
appdata.mData["receivedTime"] = QString::number(isNew ? QDateTime::currentMSecsSinceEpoch() : message->getTime()*1000);
qDebug() << (isNew ? "New" : "Old") << " message received at " << QDateTime::fromMSecsSinceEpoch(appdata.mData["receivedTime"].toLongLong()).toString("yyyy/MM/dd hh:mm:ss.zzz") << QDateTime::fromMSecsSinceEpoch(message->getTime()*1000).toString("yyyy/MM/dd hh:mm:ss.zzz");
message->setAppdata(Utils::appStringToCoreString(appdata.toString()));

View file

@ -119,7 +119,7 @@ public:
virtual void deleteEvent() override;
void updateFileTransferInformation();
static QDateTime initReceivedTimestamp(const std::shared_ptr<linphone::ChatMessage> &message, bool isNew); // return received timestamp
static QDateTime initReceivedTimestamp(const std::shared_ptr<linphone::ChatMessage> &message, bool isNew, bool force = false); // return received timestamp
// Linphone callbacks
void onFileTransferRecv(const std::shared_ptr<linphone::ChatMessage> & message, const std::shared_ptr<linphone::Content> & content, const std::shared_ptr<const linphone::Buffer> & buffer) ;

View file

@ -1216,7 +1216,7 @@ void ChatRoomModel::onChatMessagesReceived(const std::shared_ptr<linphone::ChatR
void ChatRoomModel::onChatMessageSending(const std::shared_ptr<linphone::ChatRoom> & chatRoom, const std::shared_ptr<const linphone::EventLog> & eventLog){
auto message = eventLog->getChatMessage();
if(message){
ChatMessageModel::initReceivedTimestamp(message, true);
ChatMessageModel::initReceivedTimestamp(message, true, true);
insertMessageAtEnd(message);
updateLastUpdateTime();
emit messageReceived(message);

View file

@ -91,8 +91,11 @@ QString ParticipantListModel::addressesToString()const{
QStringList txt;
for(auto item : mList){
auto participant = item.objectCast<ParticipantModel>();
if( participant->getParticipant())// is Participant. We test it because this participant is not accepted by chat room yet.
txt << Utils::toDisplayString(Utils::coreStringToAppString(participant->getParticipant()->getAddress()->asStringUriOnly()), CoreManager::getInstance()->getSettingsModel()->getSipDisplayMode());
if( participant->getParticipant()) {// is Participant. We test it because this participant is not accepted by chat room yet.
auto address = participant->getParticipant()->getAddress()->clone();
address->clean();
txt << Utils::toDisplayString(Utils::coreStringToAppString(address->asStringUriOnly()), CoreManager::getInstance()->getSettingsModel()->getSipDisplayMode());
}
}
txt.removeFirst();// Remove me
return txt.join(", ");

View file

@ -48,8 +48,13 @@ RecordingProxyModel::RecordingProxyModel (QObject *parent) : SortFilterProxyMode
void RecordingProxyModel::remove(FileMediaModel * fileModel){
QFile file(fileModel->getFilePath());
if(file.remove())
qobject_cast<RecordingListModel*>(sourceModel())->remove(fileModel);
auto listModel = qobject_cast<RecordingListModel*>(sourceModel());
auto model = listModel->get(fileModel);
if(model){
listModel->remove(fileModel);
if(!file.remove())
listModel->add(model);
}
}
bool RecordingProxyModel::lessThan (const QModelIndex &left, const QModelIndex &right) const {

View file

@ -191,7 +191,11 @@ Item {
descriptionText: qsTr('recordingsDelete'),
}, function (status) {
if (status) {
recordingsProxyModel.remove($modelData)
if(vocalPlayer.item)
vocalPlayer.item.stop()
if(vocalPlayer.active)
vocalPlayer.active = false
recordingsProxyModel.remove($modelData)
}
})