fix chat room creation inserted twice in list

This commit is contained in:
Gaelle Braud 2025-12-17 11:48:38 +01:00
parent ec3125e8a5
commit 21312c99db
2 changed files with 10 additions and 2 deletions

View file

@ -175,7 +175,11 @@ void ChatList::setSelf(QSharedPointer<ChatList> me) {
[this, addChatToList](const std::shared_ptr<linphone::Core> &core,
const std::shared_ptr<linphone::ChatRoom> &chatRoom, linphone::ChatRoom::State state) {
if (state == linphone::ChatRoom::State::Created) {
if (chatRoom->getAccount() != core->getDefaultAccount()) {
auto chatAccount = chatRoom->getAccount();
auto defaultAccount = core->getDefaultAccount();
if (!chatAccount || !defaultAccount) return;
if (!chatAccount->getParams()->getIdentityAddress()->weakEqual(
defaultAccount->getParams()->getIdentityAddress())) {
qWarning() << log().arg("Chatroom does not refer to current account, return");
return;
}
@ -203,6 +207,10 @@ int ChatList::findChatIndex(ChatGui *chatGui) {
bool ChatList::addChatInList(QSharedPointer<ChatCore> chatCore) {
mustBeInMainThread(log().arg(Q_FUNC_INFO));
if (chatCore->getIdentifier().isEmpty()) {
qWarning() << "ChatRoom with invalid identifier cannot be added to the list, return";
return false;
}
auto chatList = getSharedList<ChatCore>();
auto it = std::find_if(chatList.begin(), chatList.end(), [chatCore](const QSharedPointer<ChatCore> item) {
return item && chatCore && item->getIdentifier() == chatCore->getIdentifier();

View file

@ -7,7 +7,7 @@ import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils
RowLayout {
id: mainItem
height: Utils.getSizeWithScreenRatio(40)
visible: eventLogCore.handled
visible: eventLogGui.core.handled
property EventLogGui eventLogGui
Rectangle {