fix chat room creation inserted twice in list
This commit is contained in:
parent
ec3125e8a5
commit
21312c99db
2 changed files with 10 additions and 2 deletions
|
|
@ -175,7 +175,11 @@ void ChatList::setSelf(QSharedPointer<ChatList> me) {
|
||||||
[this, addChatToList](const std::shared_ptr<linphone::Core> &core,
|
[this, addChatToList](const std::shared_ptr<linphone::Core> &core,
|
||||||
const std::shared_ptr<linphone::ChatRoom> &chatRoom, linphone::ChatRoom::State state) {
|
const std::shared_ptr<linphone::ChatRoom> &chatRoom, linphone::ChatRoom::State state) {
|
||||||
if (state == linphone::ChatRoom::State::Created) {
|
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");
|
qWarning() << log().arg("Chatroom does not refer to current account, return");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -203,6 +207,10 @@ int ChatList::findChatIndex(ChatGui *chatGui) {
|
||||||
|
|
||||||
bool ChatList::addChatInList(QSharedPointer<ChatCore> chatCore) {
|
bool ChatList::addChatInList(QSharedPointer<ChatCore> chatCore) {
|
||||||
mustBeInMainThread(log().arg(Q_FUNC_INFO));
|
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 chatList = getSharedList<ChatCore>();
|
||||||
auto it = std::find_if(chatList.begin(), chatList.end(), [chatCore](const QSharedPointer<ChatCore> item) {
|
auto it = std::find_if(chatList.begin(), chatList.end(), [chatCore](const QSharedPointer<ChatCore> item) {
|
||||||
return item && chatCore && item->getIdentifier() == chatCore->getIdentifier();
|
return item && chatCore && item->getIdentifier() == chatCore->getIdentifier();
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: mainItem
|
id: mainItem
|
||||||
height: Utils.getSizeWithScreenRatio(40)
|
height: Utils.getSizeWithScreenRatio(40)
|
||||||
visible: eventLogCore.handled
|
visible: eventLogGui.core.handled
|
||||||
property EventLogGui eventLogGui
|
property EventLogGui eventLogGui
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue