mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-03 02:50:07 -05:00
Resolve nicks from gxsId in lobby chat history
This commit is contained in:
parent
45e1e81d9c
commit
ef5fca5e5e
@ -321,8 +321,21 @@ void ChatWidget::init(const ChatId &chat_id, const QString &title)
|
|||||||
// it can happen that a message is first added to the message history
|
// it can happen that a message is first added to the message history
|
||||||
// and later the gui receives the message through notify
|
// and later the gui receives the message through notify
|
||||||
// avoid this by not adding history entries if their age is < 2secs
|
// avoid this by not adding history entries if their age is < 2secs
|
||||||
if((time(NULL)-2) > historyIt->recvTime)
|
if ((time(NULL)-2) <= historyIt->recvTime)
|
||||||
addChatMsg(historyIt->incoming, QString::fromUtf8(historyIt->peerName.c_str()), QDateTime::fromTime_t(historyIt->sendTime), QDateTime::fromTime_t(historyIt->recvTime), QString::fromUtf8(historyIt->message.c_str()), MSGTYPE_HISTORY);
|
continue;
|
||||||
|
|
||||||
|
QString name;
|
||||||
|
if (chatId.isLobbyId()) {
|
||||||
|
RsIdentityDetails details;
|
||||||
|
if (rsIdentity->getIdDetails(RsGxsId(historyIt->peerName), details))
|
||||||
|
name = QString::fromUtf8(details.mNickname.c_str());
|
||||||
|
else
|
||||||
|
name = QString::fromUtf8(historyIt->peerName.c_str());
|
||||||
|
} else {
|
||||||
|
name = QString::fromUtf8(historyIt->peerName.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
addChatMsg(historyIt->incoming, name, QDateTime::fromTime_t(historyIt->sendTime), QDateTime::fromTime_t(historyIt->recvTime), QString::fromUtf8(historyIt->message.c_str()), MSGTYPE_HISTORY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
#include "rshare.h"
|
#include "rshare.h"
|
||||||
#include <retroshare/rshistory.h>
|
#include <retroshare/rshistory.h>
|
||||||
|
#include <retroshare/rsidentity.h>
|
||||||
#include "gui/settings/rsharesettings.h"
|
#include "gui/settings/rsharesettings.h"
|
||||||
#include "gui/notifyqt.h"
|
#include "gui/notifyqt.h"
|
||||||
|
|
||||||
@ -272,7 +273,19 @@ void ImHistoryBrowser::fillItem(QListWidgetItem *itemWidget, HistoryMsg& msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString messageText = RsHtml().formatText(NULL, QString::fromUtf8(msg.message.c_str()), formatTextFlag);
|
QString messageText = RsHtml().formatText(NULL, QString::fromUtf8(msg.message.c_str()), formatTextFlag);
|
||||||
QString formatMsg = style.formatMessage(type, QString::fromUtf8(msg.peerName.c_str()), QDateTime::fromTime_t(msg.sendTime), messageText);
|
|
||||||
|
QString name;
|
||||||
|
if (m_chatId.isLobbyId()) {
|
||||||
|
RsIdentityDetails details;
|
||||||
|
if (rsIdentity->getIdDetails(RsGxsId(msg.peerName), details))
|
||||||
|
name = QString::fromUtf8(details.mNickname.c_str());
|
||||||
|
else
|
||||||
|
name = QString::fromUtf8(msg.peerName.c_str());
|
||||||
|
} else {
|
||||||
|
name = QString::fromUtf8(msg.peerName.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
QString formatMsg = style.formatMessage(type, name, QDateTime::fromTime_t(msg.sendTime), messageText);
|
||||||
|
|
||||||
itemWidget->setData(Qt::DisplayRole, qVariantFromValue(IMHistoryItemPainter(formatMsg)));
|
itemWidget->setData(Qt::DisplayRole, qVariantFromValue(IMHistoryItemPainter(formatMsg)));
|
||||||
itemWidget->setData(ROLE_MSGID, msg.msgId);
|
itemWidget->setData(ROLE_MSGID, msg.msgId);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user