summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/proto.cpp
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-12-01 22:24:48 +0000
committerRobert Pösel <robyer@seznam.cz>2014-12-01 22:24:48 +0000
commit556d6a85c9d5f4e2d29b94526689568b4081c006 (patch)
treed93c8d208bdce79d0da51c4b1873cbc38df523c9 /protocols/FacebookRM/src/proto.cpp
parentc5b2c7be9f6e35e739ad2aeb5e6d8447bd449a60 (diff)
Facebook: Optimize marking chat messages as read
Not mark as read every single message when loading history messages. git-svn-id: http://svn.miranda-ng.org/main/trunk@11206 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/proto.cpp')
-rw-r--r--protocols/FacebookRM/src/proto.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index b10a5821b5..a5443be932 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -538,17 +538,16 @@ INT_PTR FacebookProto::OnMind(WPARAM wParam, LPARAM lParam)
int FacebookProto::OnDbEventRead(WPARAM contactID, LPARAM dbei)
{
- std::map<MCONTACT, bool>::iterator it = facy.ignore_read.find(contactID);
- if (it != facy.ignore_read.end()) {
- if (it->second) // it's TRUE, so we ignore this
- return 0;
- else // it's FALSE, so we just remove it from list
- facy.ignore_read.erase(it);
- }
+ if (isOffline() || !IsMyContact(contactID, false)) // ignore chats
+ return 0;
- if ((IsMyContact(contactID, true)) && !isOffline()) {
- ForkThread(&FacebookProto::ReadMessageWorker, (void*)contactID);
- }
+ if (facy.ignore_read.find(contactID) != facy.ignore_read.end())
+ return 0; // it's there, so we ignore this
+
+ std::set<MCONTACT> *hContacts = new std::set<MCONTACT>();
+ hContacts->insert(contactID);
+
+ ForkThread(&FacebookProto::ReadMessageWorker, (void*)hContacts);
return 0;
}