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:
parent
67620f9661
commit
23a82a3b28
|
@ -54,9 +54,11 @@ void Group::updatePeer(int peerId, QString name)
|
||||||
toxids[toxid] = name;
|
toxids[toxid] = name;
|
||||||
|
|
||||||
Friend *f = FriendList::findFriend(id);
|
Friend *f = FriendList::findFriend(id);
|
||||||
|
|
||||||
if (f != nullptr && f->hasAlias())
|
if (f != nullptr && f->hasAlias())
|
||||||
{
|
{
|
||||||
|
peers[peerId] = f->getDisplayedName();
|
||||||
|
toxids[toxid] = f->getDisplayedName();
|
||||||
|
} else {
|
||||||
widget->onUserListChanged();
|
widget->onUserListChanged();
|
||||||
chatForm->onUserListChanged();
|
chatForm->onUserListChanged();
|
||||||
emit userListChanged(getGroupWidget());
|
emit userListChanged(getGroupWidget());
|
||||||
|
@ -91,8 +93,9 @@ void Group::regeneratePeerList()
|
||||||
|
|
||||||
QString toxid = id.publicKey;
|
QString toxid = id.publicKey;
|
||||||
toxids[toxid] = peers[i];
|
toxids[toxid] = peers[i];
|
||||||
|
|
||||||
Friend *f = FriendList::findFriend(id);
|
Friend *f = FriendList::findFriend(id);
|
||||||
if (f)
|
if (f != nullptr && f->hasAlias())
|
||||||
{
|
{
|
||||||
peers[i] = f->getDisplayedName();
|
peers[i] = f->getDisplayedName();
|
||||||
toxids[toxid] = f->getDisplayedName();
|
toxids[toxid] = f->getDisplayedName();
|
||||||
|
|
|
@ -1462,13 +1462,9 @@ void Widget::onGroupNamelistChanged(int groupnumber, int peernumber, uint8_t Cha
|
||||||
g = createGroup(groupnumber);
|
g = createGroup(groupnumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString name = Nexus::getCore()->getGroupPeerName(groupnumber, peernumber);
|
|
||||||
TOX_CHAT_CHANGE change = static_cast<TOX_CHAT_CHANGE>(Change);
|
TOX_CHAT_CHANGE change = static_cast<TOX_CHAT_CHANGE>(Change);
|
||||||
if (change == TOX_CHAT_CHANGE_PEER_ADD)
|
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->addPeer(peernumber,name);
|
||||||
g->regeneratePeerList();
|
g->regeneratePeerList();
|
||||||
// g->getChatForm()->addSystemInfoMessage(tr("%1 has joined the chat").arg(name), "white", QDateTime::currentDateTime());
|
// 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...
|
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);
|
g->updatePeer(peernumber, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user