Libresapi: Extended ChatInfo class to contain own identity used in chat

This commit is contained in:
Konrad 2018-01-05 20:44:48 +01:00
parent 96e75074a8
commit 4026040b49
2 changed files with 14 additions and 5 deletions

View File

@ -113,6 +113,8 @@ StreamBase& operator << (StreamBase& left, ChatHandler::ChatInfo& info)
{
left << makeKeyValueReference("remote_author_id", info.remote_author_id)
<< makeKeyValueReference("remote_author_name", info.remote_author_name)
<< makeKeyValueReference("own_author_id", info.own_author_id)
<< makeKeyValueReference("own_author_name", info.own_author_name)
<< makeKeyValueReference("is_broadcast", info.is_broadcast)
<< makeKeyValueReference("is_distant_chat_id", info.is_distant_chat_id)
<< makeKeyValueReference("is_lobby", info.is_lobby)
@ -435,16 +437,21 @@ void ChatHandler::tick()
}
else if(msg.chat_id.isDistantChatId())
{
RsIdentityDetails details;
RsIdentityDetails detailsRemoteIdentity;
RsIdentityDetails detailsOwnIdentity;
DistantChatPeerInfo dcpinfo;
if( !gxs_id_failed &&
rsMsgs->getDistantChatStatus(
msg.chat_id.toDistantChatId(), dcpinfo ) &&
mRsIdentity->getIdDetails(dcpinfo.to_id, details) )
msg.chat_id.toDistantChatId(), dcpinfo )
&& mRsIdentity->getIdDetails(dcpinfo.to_id, detailsRemoteIdentity)
&& mRsIdentity->getIdDetails(dcpinfo.own_id, detailsOwnIdentity))
{
info.remote_author_id = details.mId.toStdString();
info.remote_author_name = details.mNickname;
info.remote_author_id = detailsRemoteIdentity.mId.toStdString();
info.remote_author_name = detailsRemoteIdentity.mNickname;
info.own_author_id = detailsOwnIdentity.mId.toStdString();
info.own_author_name = detailsOwnIdentity.mNickname;
}
else
{

View File

@ -104,6 +104,8 @@ public:
bool is_distant_chat_id;
bool is_lobby;
bool is_peer;
std::string own_author_id;
std::string own_author_name;
std::string remote_author_id;
std::string remote_author_name;
};