Fix Clear WebAPI when clear chat history in GUI and server is not

running.
This commit is contained in:
Phenom 2016-05-17 16:50:59 +02:00
parent 116e7422b9
commit 07191a7c0b

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)