[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [ktp-common-internals/mklapetek/SpaceBar] KTp/Declarative: [declarative] Don't set the same channel 
From:       Martin Klapetek <mklapetek () kde ! org>
Date:       2016-03-17 22:53:29
Message-ID: E1aggnJ-0005W6-3I () scm ! kde ! org
[Download RAW message or body]

Git commit 3092234ebc7dab4dddd40d9db909a1306e3e1d4a by Martin Klapetek.
Committed on 17/03/2016 at 22:53.
Pushed by mklapetek into branch 'mklapetek/SpaceBar'.

[declarative] Don't set the same channel twice to the Conversation

This happens when starting a chat; the MainLogModel immediatelly handles
the channel but the SpaceBarObserverProxy gets that same channel too and
passes the same channel to the model, but that channel is already being
handled so do nothing.

M  +5    -0    KTp/Declarative/mainlogmodel.cpp

http://commits.kde.org/telepathy-common-internals/3092234ebc7dab4dddd40d9db909a1306e3e1d4a

diff --git a/KTp/Declarative/mainlogmodel.cpp b/KTp/Declarative/mainlogmodel.cpp
index d83e24e..887de17 100644
--- a/KTp/Declarative/mainlogmodel.cpp
+++ b/KTp/Declarative/mainlogmodel.cpp
@@ -376,6 +376,11 @@ void MainLogModel::handleChannel(const Tp::AccountPtr &account, const Tp::TextCh
         for (i = 0; i < m_logItems.size(); i++) {
             LogItem &item = m_logItems[i];
             if (item.targetContact == contactId && item.accountObjectPath == account->objectPath()) {
+                // Don't set the same channel again
+                if (item.conversation->textChannel() == channel) {
+                    return;
+                }
+
                 item.conversation->setTextChannel(channel);
                 break;
             }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic