fixed display of peer nicknames in chat lobby

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4742 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2011-12-28 09:15:28 +00:00
parent ed395fe061
commit 4236ad59a5
4 changed files with 25 additions and 2 deletions

View File

@ -77,3 +77,13 @@ void ChatLobbyDialog::updateStatus(const QString &peer_id, int status)
//
}
void ChatLobbyDialog::addIncomingChatMsg(const ChatInfo& info)
{
QDateTime sendTime = QDateTime::fromTime_t(info.sendTime);
QDateTime recvTime = QDateTime::fromTime_t(info.recvTime);
QString message = QString::fromStdWString(info.msg);
QString name = QString::fromUtf8(info.peer_nickname.c_str()) ;
addChatMsg(true, name, sendTime, recvTime, message, TYPE_NORMAL);
}

View File

@ -55,6 +55,7 @@ class ChatLobbyDialog: public PopupChatDialog
// The following methods are differentfrom those of the parent:
//
virtual void updateStatus(const QString &peer_id, int status) ; // needs grouped status. Not yet implemented.
virtual void addIncomingChatMsg(const ChatInfo& info) ; //
protected slots:
void setNickName(const QString&) ;

View File

@ -578,6 +578,16 @@ void PopupChatDialog::onPrivateChatChanged(int list, int type)
}
}
void PopupChatDialog::addIncomingChatMsg(const ChatInfo& info)
{
QDateTime sendTime = QDateTime::fromTime_t(info.sendTime);
QDateTime recvTime = QDateTime::fromTime_t(info.recvTime);
QString message = QString::fromStdWString(info.msg);
QString name = QString::fromUtf8(rsPeers->getPeerName(info.rsid).c_str()) ;
addChatMsg(true, name, sendTime, recvTime, message, TYPE_NORMAL);
}
void PopupChatDialog::insertChatMsgs()
{
std::list<ChatInfo> newchat;
@ -590,14 +600,15 @@ void PopupChatDialog::insertChatMsgs()
}
std::list<ChatInfo>::iterator it;
for(it = newchat.begin(); it != newchat.end(); it++) {
for(it = newchat.begin(); it != newchat.end(); it++)
{
/* are they public? */
if ((it->chatflags & RS_CHAT_PRIVATE) == 0) {
/* this should not happen */
continue;
}
addChatMsg(true, QString::fromUtf8(rsPeers->getPeerName(it->rsid).c_str()), QDateTime::fromTime_t(it->sendTime), QDateTime::fromTime_t(it->recvTime), QString::fromStdWString(it->msg), TYPE_NORMAL);
addIncomingChatMsg(*it) ;
}
rsMsgs->clearPrivateChatQueue(true, dialogId);

View File

@ -76,6 +76,7 @@ protected:
void insertChatMsgs();
void addChatMsg(bool incoming, const QString &name, const QDateTime &sendTime, const QDateTime &recvTime, const QString &message, enumChatType chatType);
virtual void addIncomingChatMsg(const ChatInfo& info) ; // derived in ChatLobbyDialog.
private slots:
void pasteLink() ;