From 921df52650b4d5bc6b725f28bbc0b3dd298d1989 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Wed, 4 Mar 2015 12:05:59 +0000 Subject: Facebook: More unification for groupchat seen info and save groupchat "readers" into database in key "MessageReaders" (Unicode); Version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@12315 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/src/communication.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'protocols/FacebookRM/src/communication.cpp') diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index 2c84a18b5b..88ce68ba1c 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -654,6 +654,10 @@ void facebook_client::clear_chatrooms() void facebook_client::clear_readers() { for (std::map::iterator it = readers.begin(); it != readers.end();) { + if (parent->isChatRoom(it->first)) { + parent->delSetting(it->first, FACEBOOK_KEY_MESSAGE_READERS); + } + parent->delSetting(it->first, FACEBOOK_KEY_MESSAGE_READ); it = readers.erase(it); } @@ -663,8 +667,21 @@ void facebook_client::clear_readers() /** * Inserts info to readers list, db and writes to statusbar */ -void facebook_client::insert_reader(MCONTACT hContact, time_t timestamp) +void facebook_client::insert_reader(MCONTACT hContact, time_t timestamp, const std::tstring &reader) { + if (parent->isChatRoom(hContact)) { + std::tstring treaders; + + // Load old readers + ptrT told(parent->getTStringA(hContact, FACEBOOK_KEY_MESSAGE_READERS)); + if (told) + treaders = std::tstring(told) + _T(", "); + + // Append new reader name and remember them + treaders += utils::text::prepare_name(reader, true); + parent->setTString(hContact, FACEBOOK_KEY_MESSAGE_READERS, treaders.c_str()); + } + parent->setDword(hContact, FACEBOOK_KEY_MESSAGE_READ, timestamp); readers.insert(std::make_pair(hContact, timestamp)); parent->MessageRead(hContact); @@ -675,6 +692,10 @@ void facebook_client::insert_reader(MCONTACT hContact, time_t timestamp) */ void facebook_client::erase_reader(MCONTACT hContact) { + if (parent->isChatRoom(hContact)) { + parent->delSetting(hContact, FACEBOOK_KEY_MESSAGE_READERS); + } + parent->delSetting(hContact, FACEBOOK_KEY_MESSAGE_READ); readers.erase(hContact); CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, NULL); -- cgit v1.2.3