diff options
author | George Hazan <ghazan@miranda.im> | 2018-01-08 22:25:39 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-01-08 22:25:39 +0300 |
commit | 1e5ae8efefc6f50082c1c1734c763aab2fb1b7f5 (patch) | |
tree | 3c6988ab32b6458289a830d7bf544a8357119246 /protocols/FacebookRM/src/process.cpp | |
parent | 2f058ad0b6a6df7074f5ca05b37b8f4717d9eb13 (diff) |
adds support for exiting groupchats
Diffstat (limited to 'protocols/FacebookRM/src/process.cpp')
-rw-r--r-- | protocols/FacebookRM/src/process.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index bb228332c4..cf11d945bf 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -781,19 +781,12 @@ void FacebookProto::ReceiveMessages(std::vector<facebook_message> &messages, boo case MESSAGE: UpdateChat(fbc->thread_id.c_str(), msg.user_id.c_str(), name.c_str(), msg.message_text.c_str(), msg.time); break; + case ADMIN_TEXT: UpdateChat(thread_id.c_str(), nullptr, nullptr, msg.message_text.c_str()); break; - case UNSUBSCRIBE: - // this is our own request to leave the groupchat - if (_atoi64(msg.message_id.c_str()) == fbc->tmp_msgid) { - Chat_Terminate(m_szModuleName, _A2T(fbc->thread_id.c_str()), true); - facy.chat_rooms.erase(thread_id); - delete fbc; - break; - } - // fall through + case UNSUBSCRIBE: case SUBSCRIBE: UpdateChat(thread_id.c_str(), nullptr, nullptr, msg.message_text.c_str()); { @@ -815,8 +808,15 @@ void FacebookProto::ReceiveMessages(std::vector<facebook_message> &messages, boo if (jt != fbc->participants.end()) { if (msg.type == SUBSCRIBE) AddChatContact(thread_id.c_str(), jt->second, msg.isUnread); - else - RemoveChatContact(thread_id.c_str(), jt->second.user_id.c_str(), jt->second.nick.c_str()); + else { + if (jt->second.user_id == facy.self_.user_id) { + // we exited the thread + Chat_Terminate(m_szModuleName, _A2T(fbc->thread_id.c_str()), true); + facy.chat_rooms.erase(thread_id); + delete fbc; + } + else RemoveChatContact(thread_id.c_str(), jt->second.user_id.c_str(), jt->second.nick.c_str()); + } } } } |