summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/communication.cpp
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2015-03-04 12:05:59 +0000
committerRobert Pösel <robyer@seznam.cz>2015-03-04 12:05:59 +0000
commit921df52650b4d5bc6b725f28bbc0b3dd298d1989 (patch)
tree64ef035901d0568284324ca1bcb690cacee853e3 /protocols/FacebookRM/src/communication.cpp
parentcdc3ce491f2ec062b717646f115d856775cbca9a (diff)
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
Diffstat (limited to 'protocols/FacebookRM/src/communication.cpp')
-rw-r--r--protocols/FacebookRM/src/communication.cpp23
1 files changed, 22 insertions, 1 deletions
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<MCONTACT, time_t>::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);