diff options
author | Robert Pösel <robyer@seznam.cz> | 2014-08-31 18:34:12 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2014-08-31 18:34:12 +0000 |
commit | cf488b3a97eb641d271cf0b3f183fc914ee0caf2 (patch) | |
tree | 6af6006ac7971c3bb9499258938ab36771b20ec4 /protocols/FacebookRM/src/communication.cpp | |
parent | b35a3607236bcd628d56290fe4a72977454ac1c7 (diff) |
Facebook: Save message read time into DB as key "MessageRead" (DWORD)
git-svn-id: http://svn.miranda-ng.org/main/trunk@10347 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/communication.cpp')
-rw-r--r-- | protocols/FacebookRM/src/communication.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index 3223c110ff..cc6eef0292 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -715,6 +715,38 @@ void facebook_client::clear_chatrooms() chat_rooms.clear(); } +/** + * Clears readers info for all contacts from readers list and db + */ +void facebook_client::clear_readers() +{ + for (std::map<MCONTACT, time_t>::iterator it = readers.begin(); it != readers.end();) { + parent->delSetting(it->first, FACEBOOK_KEY_MESSAGE_READ); + it = readers.erase(it); + } + readers.clear(); +} + +/** + * Inserts info to readers list, db and writes to statusbar + */ +void facebook_client::insert_reader(MCONTACT hContact, time_t timestamp) +{ + parent->setDword(hContact, FACEBOOK_KEY_MESSAGE_READ, timestamp); + readers.insert(std::make_pair(hContact, timestamp)); + parent->MessageRead(hContact); +} + +/** + * Removes info from readers list, db and clears statusbar + */ +void facebook_client::erase_reader(MCONTACT hContact) +{ + parent->delSetting(hContact, FACEBOOK_KEY_MESSAGE_READ); + readers.erase(hContact); + CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, NULL); +} + void loginError(FacebookProto *proto, std::string error_str) { error_str = utils::text::trim( utils::text::html_entities_decode( |