summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/proto.cpp
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-12-21 14:37:38 +0000
committerRobert Pösel <robyer@seznam.cz>2014-12-21 14:37:38 +0000
commit310cdd11d658f232ab9b05a7b39cc9c3d9a00436 (patch)
treef94ccec81ed18054bf2fcafecfef29162a96c072 /protocols/FacebookRM/src/proto.cpp
parent1143653f5936f4f4ea97e0d0bd863b79385004e1 (diff)
Facebook: Use correct (= server) timestamp for sent messages
- used only when "use local time for messages" isn't enabled - also it probably doesn't work for StdMsg (SRMM) plugin git-svn-id: http://svn.miranda-ng.org/main/trunk@11555 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/proto.cpp')
-rw-r--r--protocols/FacebookRM/src/proto.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index aacb6f08a7..cb070adb20 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -70,6 +70,7 @@ PROTO<FacebookProto>(proto_name, username)
HookProtoEvent(ME_GC_BUILDMENU, &FacebookProto::OnGCMenuHook);
HookProtoEvent(ME_DB_EVENT_MARKED_READ, &FacebookProto::OnDbEventRead);
HookProtoEvent(ME_MSG_WINDOWEVENT, &FacebookProto::OnProcessSrmmEvent);
+ HookProtoEvent(ME_MSG_PRECREATEEVENT, &FacebookProto::OnPreCreateEvent);
db_set_resident(m_szModuleName, "Status");
db_set_resident(m_szModuleName, "IdleTS");
@@ -583,6 +584,22 @@ int FacebookProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam)
return 0;
}
+int FacebookProto::OnPreCreateEvent(WPARAM, LPARAM lParam)
+{
+ MessageWindowEvent *evt = (MessageWindowEvent *)lParam;
+ if (strcmp(GetContactProto(evt->hContact), m_szModuleName))
+ return 0;
+
+ std::map<int, DWORD>::iterator it = facy.messages_timestamp.find(evt->seq);
+ if (it != facy.messages_timestamp.end()) {
+ // set correct timestamp of this message
+ evt->dbei->timestamp = it->second;
+ facy.messages_timestamp.erase(it);
+ }
+
+ return 1;
+}
+
INT_PTR FacebookProto::CheckNewsfeeds(WPARAM, LPARAM)
{
if (!isOffline()) {