mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-17 13:24:15 -05:00
Enabled history for chat lobbies (not saved to disc)
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6322 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c5c559ffe1
commit
be34ede8fd
@ -63,16 +63,15 @@ void p3HistoryMgr::addMessage(bool incoming, const std::string &chatPeerId, cons
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mPrivateEnable == false && chatPeerId.empty() == false) {
|
|
||||||
// private chat not enabled
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const RsChatLobbyMsgItem *cli = dynamic_cast<const RsChatLobbyMsgItem*>(chatItem);
|
const RsChatLobbyMsgItem *cli = dynamic_cast<const RsChatLobbyMsgItem*>(chatItem);
|
||||||
|
|
||||||
if (cli) {
|
if (cli) {
|
||||||
// disable history for chat lobbies until they are saved
|
// there is currently no setting for chat lobbies
|
||||||
return;
|
} else {
|
||||||
|
if (mPrivateEnable == false && chatPeerId.empty() == false) {
|
||||||
|
// private chat not enabled
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RsHistoryMsgItem* item = new RsHistoryMsgItem;
|
RsHistoryMsgItem* item = new RsHistoryMsgItem;
|
||||||
@ -83,6 +82,11 @@ void p3HistoryMgr::addMessage(bool incoming, const std::string &chatPeerId, cons
|
|||||||
item->sendTime = chatItem->sendTime;
|
item->sendTime = chatItem->sendTime;
|
||||||
item->recvTime = chatItem->recvTime;
|
item->recvTime = chatItem->recvTime;
|
||||||
|
|
||||||
|
if (cli) {
|
||||||
|
// disable save to disc for chat lobbies until they are saved
|
||||||
|
item->saveToDisc = false;
|
||||||
|
}
|
||||||
|
|
||||||
librs::util::ConvertUtf16ToUtf8(chatItem->message, item->message);
|
librs::util::ConvertUtf16ToUtf8(chatItem->message, item->message);
|
||||||
|
|
||||||
std::map<std::string, std::map<uint32_t, RsHistoryMsgItem*> >::iterator mit = mMessages.find(item->chatPeerId);
|
std::map<std::string, std::map<uint32_t, RsHistoryMsgItem*> >::iterator mit = mMessages.find(item->chatPeerId);
|
||||||
@ -96,7 +100,12 @@ void p3HistoryMgr::addMessage(bool incoming, const std::string &chatPeerId, cons
|
|||||||
if (chatPeerId.empty()) {
|
if (chatPeerId.empty()) {
|
||||||
limit = mPublicSaveCount;
|
limit = mPublicSaveCount;
|
||||||
} else {
|
} else {
|
||||||
limit = mPrivateSaveCount;
|
if (cli) {
|
||||||
|
// there is currently no setting for chat lobbies
|
||||||
|
limit = 0;
|
||||||
|
} else {
|
||||||
|
limit = mPrivateSaveCount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (limit) {
|
if (limit) {
|
||||||
@ -144,7 +153,9 @@ bool p3HistoryMgr::saveList(bool& cleanup, std::list<RsItem*>& saveData)
|
|||||||
std::map<uint32_t, RsHistoryMsgItem*>::iterator lit;
|
std::map<uint32_t, RsHistoryMsgItem*>::iterator lit;
|
||||||
for (mit = mMessages.begin(); mit != mMessages.end(); mit++) {
|
for (mit = mMessages.begin(); mit != mMessages.end(); mit++) {
|
||||||
for (lit = mit->second.begin(); lit != mit->second.end(); lit++) {
|
for (lit = mit->second.begin(); lit != mit->second.end(); lit++) {
|
||||||
saveData.push_back(lit->second);
|
if (lit->second->saveToDisc) {
|
||||||
|
saveData.push_back(lit->second);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ RsHistoryMsgItem::RsHistoryMsgItem() : RsItem(RS_PKT_VERSION1, RS_PKT_CLASS_CONF
|
|||||||
sendTime = 0;
|
sendTime = 0;
|
||||||
recvTime = 0;
|
recvTime = 0;
|
||||||
msgId = 0;
|
msgId = 0;
|
||||||
|
saveToDisc = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
RsHistoryMsgItem::~RsHistoryMsgItem()
|
RsHistoryMsgItem::~RsHistoryMsgItem()
|
||||||
@ -57,6 +58,7 @@ void RsHistoryMsgItem::clear()
|
|||||||
recvTime = 0;
|
recvTime = 0;
|
||||||
message.clear();
|
message.clear();
|
||||||
msgId = 0;
|
msgId = 0;
|
||||||
|
saveToDisc = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& RsHistoryMsgItem::print(std::ostream &out, uint16_t indent)
|
std::ostream& RsHistoryMsgItem::print(std::ostream &out, uint16_t indent)
|
||||||
|
@ -50,6 +50,7 @@ public:
|
|||||||
|
|
||||||
/* not serialised */
|
/* not serialised */
|
||||||
uint32_t msgId;
|
uint32_t msgId;
|
||||||
|
bool saveToDisc;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RsHistorySerialiser: public RsSerialType
|
class RsHistorySerialiser: public RsSerialType
|
||||||
|
@ -183,10 +183,6 @@ void ChatWidget::init(const std::string &peerId, const QString &title)
|
|||||||
QString customStateString = QString::fromUtf8(rsMsgs->getCustomStateString(peerId).c_str());
|
QString customStateString = QString::fromUtf8(rsMsgs->getCustomStateString(peerId).c_str());
|
||||||
updatePeersCustomStateString(QString::fromStdString(peerId), customStateString);
|
updatePeersCustomStateString(QString::fromStdString(peerId), customStateString);
|
||||||
} else {
|
} else {
|
||||||
// currently not possible
|
|
||||||
ui->actionDeleteChatHistory->setVisible(false);
|
|
||||||
ui->actionMessageHistory->setVisible(false);
|
|
||||||
|
|
||||||
updateTitle();
|
updateTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user