diff options
author | Robert Pösel <robyer@seznam.cz> | 2014-12-23 15:30:07 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2014-12-23 15:30:07 +0000 |
commit | dfc984e97259bab3ab2de2f3b9cca0d9a097550d (patch) | |
tree | b9461d8acc5de1df006f6a8396b2a6dfb36e5d91 /protocols/FacebookRM/src/communication.cpp | |
parent | 2cd071fd8de860655b981d22ecac139cd6e4411b (diff) |
Facebook: Rework working with timestamps; version bump
Use time_t almost everywhere instead of DWORD and remove fix_timestamp method to replace it with to_timestamp
git-svn-id: http://svn.miranda-ng.org/main/trunk@11599 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/communication.cpp')
-rw-r--r-- | protocols/FacebookRM/src/communication.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index 2150ff6ab5..df86bfed9d 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -1335,19 +1335,18 @@ int facebook_client::send_message(int seqid, MCONTACT hContact, const std::strin if (!parent->isChatRoom(hContact)) parent->setString(hContact, FACEBOOK_KEY_MESSAGE_ID, mid.c_str()); - // Remember last action timestamp + // Get timestamp std::string timestamp = utils::text::source_get_value(&resp.data, 2, "\"timestamp\":", ","); - parent->setString(FACEBOOK_KEY_LAST_ACTION_TIMESTAMP, timestamp.c_str()); + time_t time = utils::time::from_string(timestamp); + + // Remember last action timestamp for history sync + parent->setDword(FACEBOOK_KEY_LAST_ACTION_TS, time); - // For classic conversation we try to remember and then replace timestamp of added event in OnPreCreateEvent() - if (seqid > 0) { - long long time = _atoi64(timestamp.c_str()); - if (time > 100000000000) - time /= 1000; - - messages_timestamp.insert(std::make_pair(seqid, (DWORD)time)); - } + // For classic conversation we try to replace timestamp of added event in OnPreCreateEvent() + if (seqid > 0) + messages_timestamp.insert(std::make_pair(seqid, time)); + // We have this message in database, so ignore further tries (in channel) to add it again messages_ignore.insert(std::make_pair(mid, 0)); } break; |