mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-14 08:59:50 -05:00
Merge pull request #1630 from PhenomRetroShare/Fix_ChatWidgetHistoryUserName
Fix ChatWidget History UserName
This commit is contained in:
commit
6001517718
@ -390,13 +390,24 @@ void ChatWidget::init(const ChatId &chat_id, const QString &title)
|
||||
// it can happen that a message is first added to the message history
|
||||
// and later the gui receives the message through notify
|
||||
// avoid this by not adding history entries if their age is < 2secs
|
||||
if ((time(NULL)-2) <= historyIt->recvTime)
|
||||
if (time(nullptr) <= historyIt->recvTime+2)
|
||||
continue;
|
||||
|
||||
QString name;
|
||||
if (chatId.isLobbyId() || chatId.isDistantChatId())
|
||||
{
|
||||
RsIdentityDetails details;
|
||||
time_t start = time(nullptr);
|
||||
while (!rsIdentity->getIdDetails(RsGxsId(historyIt->peerName), details))
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
if (time(nullptr)>start+2)
|
||||
{
|
||||
std::cerr << "ChatWidget History haven't found Id Details and have wait 1 sec for it." << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (rsIdentity->getIdDetails(RsGxsId(historyIt->peerName), details))
|
||||
name = QString::fromUtf8(details.mNickname.c_str());
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user