Skip to content

Commit

Permalink
Only update user in channels tree when there's visible changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bear101 committed Aug 9, 2023
1 parent 8852970 commit 3c29967
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Client/qtTeamTalk/channelstree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,7 @@ void ChannelsTree::slotUpdateChannel(const Channel& chan)

updateChannelItem(chan.nChannelID);

//update users since there might be a new operator
//update users since there might be a new operator or transmit user has changed
users_t chanusers = getChannelUsers(chan.nChannelID, m_users, m_channels, false);
for (auto ite=chanusers.begin();ite!=chanusers.end();++ite)
{
Expand Down Expand Up @@ -1344,12 +1344,19 @@ void ChannelsTree::slotUserLoggedOut(const User& user)
void ChannelsTree::slotUserUpdate(const User& user)
{
Q_ASSERT(m_users.find(user.nUserID) != m_users.end());
User oldUser = m_users[user.nUserID];
m_users.insert(user.nUserID, user);

//ignore user if not in channel
if(user.nChannelID == 0)
return;

// ignore if there's no visible changes
if (_Q(oldUser.szNickname) == _Q(user.szNickname) &&
_Q(oldUser.szStatusMsg) == _Q(user.szStatusMsg) &&
oldUser.nStatusMode == user.nStatusMode)
return;

QTreeWidgetItem* item = getUserItem(user.nUserID);
if(item)
{
Expand Down

0 comments on commit 3c29967

Please sign in to comment.