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/proto.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'protocols/FacebookRM/src/proto.cpp') diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index fe062681b2..b81f436cfa 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -65,6 +65,7 @@ FacebookProto::FacebookProto(const char* proto_name,const TCHAR* username) : db_set_resident(m_szModuleName, "Status"); db_set_resident(m_szModuleName, "IdleTS"); + db_set_resident(m_szModuleName, FACEBOOK_KEY_MESSAGE_READ); InitHotkeys(); InitPopups(); @@ -981,12 +982,17 @@ void FacebookProto::InitSounds() */ void FacebookProto::MessageRead(MCONTACT hContact) { - std::map::iterator it = facy.readers.find(hContact); + /*std::map::iterator it = facy.readers.find(hContact); if (it == facy.readers.end()) + return;*/ + + // We may use this instead of checing map as we have this info already in memory (this value is resident) + time_t time = getDword(hContact, FACEBOOK_KEY_MESSAGE_READ, 0); + if (!time) return; TCHAR ttime[64]; - _tcsftime(ttime, SIZEOF(ttime), _T("%X"), localtime(&it->second)); + _tcsftime(ttime, SIZEOF(ttime), _T("%X"), localtime(&time)); StatusTextData st = { 0 }; st.cbSize = sizeof(st); -- cgit v1.2.3