Merge pull request #56 from AsamK/distant_chat_history

Implement history for distant chat
This commit is contained in:
defnax 2015-08-28 01:58:37 +02:00
commit e1aee8fe81
2 changed files with 20 additions and 4 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;