From 23a82a3b2814216640eca18b2b3ea3289121e9d9 Mon Sep 17 00:00:00 2001 From: apprb Date: Fri, 22 Jan 2016 19:06:25 +0600 Subject: [PATCH] Groupchats: fix user list update --- src/group.cpp | 7 +++++-- src/widget/widget.cpp | 5 +---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/group.cpp b/src/group.cpp index 3497263de..29708759a 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -54,9 +54,11 @@ void Group::updatePeer(int peerId, QString name) toxids[toxid] = name; Friend *f = FriendList::findFriend(id); - if (f != nullptr && f->hasAlias()) { + peers[peerId] = f->getDisplayedName(); + toxids[toxid] = f->getDisplayedName(); + } else { widget->onUserListChanged(); chatForm->onUserListChanged(); emit userListChanged(getGroupWidget()); @@ -91,8 +93,9 @@ void Group::regeneratePeerList() QString toxid = id.publicKey; toxids[toxid] = peers[i]; + Friend *f = FriendList::findFriend(id); - if (f) + if (f != nullptr && f->hasAlias()) { peers[i] = f->getDisplayedName(); toxids[toxid] = f->getDisplayedName(); diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index d2677077e..0e1313d3f 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -1462,13 +1462,9 @@ void Widget::onGroupNamelistChanged(int groupnumber, int peernumber, uint8_t Cha g = createGroup(groupnumber); } - QString name = Nexus::getCore()->getGroupPeerName(groupnumber, peernumber); TOX_CHAT_CHANGE change = static_cast(Change); if (change == TOX_CHAT_CHANGE_PEER_ADD) { - if (name.isEmpty()) - name = tr("", "Placeholder when we don't know someone's name in a group chat"); - // g->addPeer(peernumber,name); g->regeneratePeerList(); // g->getChatForm()->addSystemInfoMessage(tr("%1 has joined the chat").arg(name), "white", QDateTime::currentDateTime()); @@ -1483,6 +1479,7 @@ void Widget::onGroupNamelistChanged(int groupnumber, int peernumber, uint8_t Cha } else if (change == TOX_CHAT_CHANGE_PEER_NAME) // core overwrites old name before telling us it changed... { + QString name = Nexus::getCore()->getGroupPeerName(groupnumber, peernumber); g->updatePeer(peernumber, name); } }