Implement history for distant chat

Uses the same history config as private chat
This commit is contained in:
AsamK 2015-08-28 01:21:55 +02:00
parent d7531b3dea
commit 5dad1680e6
4 changed files with 25 additions and 6 deletions

View file

@ -1019,8 +1019,8 @@ bool DistantChatService::getDistantChatStatus(const RsGxsId& gxs_id,uint32_t& st
{
status = it->second.status ;
if(from_gxs_id != NULL)
*from_gxs_id = it->second.own_gxs_id ;
if(from_gxs_id != NULL)
*from_gxs_id = it->second.own_gxs_id ;
return true ;
}

View file

@ -99,7 +99,17 @@ void p3HistoryMgr::addMessage(const ChatMessage& cm)
enabled = true;
}
// not handled: private distant chat
if (cm.chat_id.isGxsId() && mPrivateEnable == true) {
if (cm.incoming) {
peerName = cm.chat_id.toGxsId().toStdString();
} else {
uint32_t status;
RsGxsId from_gxs_id;
if (rsMsgs->getDistantChatStatus(cm.chat_id.toGxsId(), status, &from_gxs_id))
peerName = from_gxs_id.toStdString();
}
enabled = true;
}
if(enabled == false)
return;
@ -387,7 +397,10 @@ bool p3HistoryMgr::chatIdToVirtualPeerId(ChatId chat_id, RsPeerId &peer_id)
return true;
}
// not handled: private distant chat
if (chat_id.isGxsId()) {
peer_id = RsPeerId(chat_id.toGxsId());
return true;
}
return false;
}
@ -423,6 +436,9 @@ bool p3HistoryMgr::getMessages(const ChatId &chatId, std::list<HistoryMsg> &msgs
if (chatId.isLobbyId() && mLobbyEnable == true) {
enabled = true;
}
if (chatId.isGxsId() && mPrivateEnable == true) {
enabled = true;
}
if(enabled == false)
return false;