Merge pull request #389 from PhenomRetroShare/Fix_ClearWebAPIWhenClearChatHistory

Fix Clear WebAPI when clear chat history in GUI and server is not running.
This commit is contained in:
Cyril Soler 2016-05-17 11:21:03 -04:00
commit 9f560696e9

View File

@ -172,8 +172,20 @@ void ChatHandler::notifyChatMessage(const ChatMessage &msg)
void ChatHandler::notifyChatCleared(const ChatId &chat_id)
{
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
//Remove processed messages
std::list<Msg>& msgs = mMsgs[chat_id];
msgs.clear();
//Remove unprocessed messages
for(std::list<ChatMessage>::iterator lit = mRawMsgs.begin(); lit != mRawMsgs.end();)
{
ChatMessage& msg = *lit;
if (msg.chat_id == chat_id)
{
lit = mRawMsgs.erase(lit);
} else {
++lit;
}
}
}
void ChatHandler::notifyChatStatus(const ChatId &chat_id, const std::string &status)