diff options
author | Robert Pösel <robyer@seznam.cz> | 2013-05-23 15:35:31 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2013-05-23 15:35:31 +0000 |
commit | 1100cf0fc0aa447cb2390409c8dcea9deebe3d4f (patch) | |
tree | 569c28d3028d3122d87495ccb754d0ef03756b64 /protocols/FacebookRM/src/json.cpp | |
parent | d9c995acca09460e8b8533c7efdb5eddd6e61d73 (diff) |
Facebook: Load sent messages from browser into Miranda.
git-svn-id: http://svn.miranda-ng.org/main/trunk@4811 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/json.cpp')
-rw-r--r-- | protocols/FacebookRM/src/json.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index 8d705b4323..ee1a2ed62a 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -310,6 +310,41 @@ int facebook_json_parser::parse_messages(void* data, std::vector< facebook_messa const Number& time_sent = messageContent["time"];
// proto->Log("????? Checking time %15.2f > %15.2f", time_sent.Value(), proto->facy.last_message_time_);
+
+ if (was_id == proto->facy.self_.user_id) {
+ // ignore messages sent from Miranda
+ std::set<std::string>::iterator it = proto->facy.messages_sent.find(message_id.Value());
+ if (it != proto->facy.messages_sent.end()) {
+ proto->facy.messages_sent.erase(it);
+ continue;
+ }
+
+ std::string message_text = utils::text::special_expressions_decode(utils::text::slashu_to_utf8(text.Value()));
+
+ const Number& to = objMember["to"];
+ char to_id[32];
+ lltoa(to.Value(), to_id, 10);
+
+ HANDLE hContact = proto->ContactIDToHContact(to_id);
+ if (!hContact)
+ continue;
+
+ DBEVENTINFO dbei = {0};
+ dbei.cbSize = sizeof(dbei);
+ dbei.eventType = EVENTTYPE_MESSAGE;
+ dbei.flags = DBEF_SENT | DBEF_UTF;
+ dbei.szModule = proto->m_szModuleName;
+
+ bool local_time = db_get_b(NULL, proto->m_szModuleName, FACEBOOK_KEY_LOCAL_TIMESTAMP, 0) != 0;
+ dbei.timestamp = local_time ? ::time(NULL) : utils::time::fix_timestamp(time_sent.Value());
+
+ dbei.cbBlob = (DWORD)message_text.length() + 1;
+ dbei.pBlob = (PBYTE)message_text.c_str();
+ db_event_add(hContact, &dbei);
+
+ continue;
+ }
+
if ((messageContent.Find("truncated") != messageContent.End())
&& (((const Number &)messageContent["truncated"]).Value() == 1)) {
// If we got truncated message, we can ignore it, because we should get it again as "messaging" type
|