1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Groupchats: fix user list update

This commit is contained in:
apprb 2016-01-22 19:06:25 +06:00
parent 67620f9661
commit 23a82a3b28
No known key found for this signature in database
GPG Key ID: B001911B5B22FB9B
2 changed files with 6 additions and 6 deletions

View File

@ -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();

View File

@ -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<TOX_CHAT_CHANGE>(Change);
if (change == TOX_CHAT_CHANGE_PEER_ADD)
{
if (name.isEmpty())
name = tr("<Unknown>", "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);
}
}