mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Merge pull request #56 from AsamK/distant_chat_history
Implement history for distant chat
This commit is contained in:
commit
7270ba908a
@ -1019,8 +1019,8 @@ bool DistantChatService::getDistantChatStatus(const RsGxsId& gxs_id,uint32_t& st
|
|||||||
{
|
{
|
||||||
status = it->second.status ;
|
status = it->second.status ;
|
||||||
|
|
||||||
if(from_gxs_id != NULL)
|
if(from_gxs_id != NULL)
|
||||||
*from_gxs_id = it->second.own_gxs_id ;
|
*from_gxs_id = it->second.own_gxs_id ;
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,17 @@ void p3HistoryMgr::addMessage(const ChatMessage& cm)
|
|||||||
enabled = true;
|
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)
|
if(enabled == false)
|
||||||
return;
|
return;
|
||||||
@ -387,7 +397,10 @@ bool p3HistoryMgr::chatIdToVirtualPeerId(ChatId chat_id, RsPeerId &peer_id)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// not handled: private distant chat
|
if (chat_id.isGxsId()) {
|
||||||
|
peer_id = RsPeerId(chat_id.toGxsId());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -423,6 +436,9 @@ bool p3HistoryMgr::getMessages(const ChatId &chatId, std::list<HistoryMsg> &msgs
|
|||||||
if (chatId.isLobbyId() && mLobbyEnable == true) {
|
if (chatId.isLobbyId() && mLobbyEnable == true) {
|
||||||
enabled = true;
|
enabled = true;
|
||||||
}
|
}
|
||||||
|
if (chatId.isGxsId() && mPrivateEnable == true) {
|
||||||
|
enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(enabled == false)
|
if(enabled == false)
|
||||||
return false;
|
return false;
|
||||||
|
@ -298,6 +298,9 @@ void ChatWidget::init(const ChatId &chat_id, const QString &title)
|
|||||||
// initialize first custom state string
|
// initialize first custom state string
|
||||||
QString customStateString = QString::fromUtf8(rsMsgs->getCustomStateString(chatId.toPeerId()).c_str());
|
QString customStateString = QString::fromUtf8(rsMsgs->getCustomStateString(chatId.toPeerId()).c_str());
|
||||||
updatePeersCustomStateString(QString::fromStdString(chatId.toPeerId().toStdString()), customStateString);
|
updatePeersCustomStateString(QString::fromStdString(chatId.toPeerId().toStdString()), customStateString);
|
||||||
|
} else if (chatType() == CHATTYPE_DISTANT){
|
||||||
|
hist_chat_type = RS_HISTORY_TYPE_PRIVATE ;
|
||||||
|
messageCount = Settings->getPrivateChatHistoryCount();
|
||||||
} else if(chatId.isBroadcast()){
|
} else if(chatId.isBroadcast()){
|
||||||
hist_chat_type = RS_HISTORY_TYPE_PUBLIC;
|
hist_chat_type = RS_HISTORY_TYPE_PUBLIC;
|
||||||
messageCount = Settings->getPublicChatHistoryCount();
|
messageCount = Settings->getPublicChatHistoryCount();
|
||||||
@ -325,7 +328,7 @@ void ChatWidget::init(const ChatId &chat_id, const QString &title)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
QString name;
|
QString name;
|
||||||
if (chatId.isLobbyId()) {
|
if (chatId.isLobbyId() || chatId.isGxsId()) {
|
||||||
RsIdentityDetails details;
|
RsIdentityDetails details;
|
||||||
if (rsIdentity->getIdDetails(RsGxsId(historyIt->peerName), details))
|
if (rsIdentity->getIdDetails(RsGxsId(historyIt->peerName), details))
|
||||||
name = QString::fromUtf8(details.mNickname.c_str());
|
name = QString::fromUtf8(details.mNickname.c_str());
|
||||||
|
@ -275,7 +275,7 @@ 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 name;
|
QString name;
|
||||||
if (m_chatId.isLobbyId()) {
|
if (m_chatId.isLobbyId() || m_chatId.isGxsId()) {
|
||||||
RsIdentityDetails details;
|
RsIdentityDetails details;
|
||||||
if (rsIdentity->getIdDetails(RsGxsId(msg.peerName), details))
|
if (rsIdentity->getIdDetails(RsGxsId(msg.peerName), details))
|
||||||
name = QString::fromUtf8(details.mNickname.c_str());
|
name = QString::fromUtf8(details.mNickname.c_str());
|
||||||
|
Loading…
Reference in New Issue
Block a user