From cf488b3a97eb641d271cf0b3f183fc914ee0caf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Sun, 31 Aug 2014 18:34:12 +0000 Subject: 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 --- protocols/FacebookRM/src/communication.cpp | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'protocols/FacebookRM/src/communication.cpp') 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::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( -- cgit v1.2.3