summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2015-07-24 11:48:01 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2015-07-24 11:48:01 +0000
commit9ea1fabf1643f117b46ee44d359084fe77bfd4f2 (patch)
tree44d05a7c93c2416f04db0009e9afc050408955d1
parenta37130550153d51332ddd1996b8d796265c1dc35 (diff)
SkypeWeb: More fixes.
git-svn-id: http://svn.miranda-ng.org/main/trunk@14675 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/SkypeWeb/src/skype_db.cpp12
-rw-r--r--protocols/SkypeWeb/src/skype_events.cpp3
-rw-r--r--protocols/SkypeWeb/src/skype_messages.cpp6
3 files changed, 14 insertions, 7 deletions
diff --git a/protocols/SkypeWeb/src/skype_db.cpp b/protocols/SkypeWeb/src/skype_db.cpp
index b987cb9343..478de25527 100644
--- a/protocols/SkypeWeb/src/skype_db.cpp
+++ b/protocols/SkypeWeb/src/skype_db.cpp
@@ -73,13 +73,21 @@ MEVENT CSkypeProto::AppendDBEvent(MCONTACT hContact, MEVENT hEvent, const char *
JSONNode jMsg = JSONNode::parse((char*)dbei.pBlob);
if (jMsg)
{
- if (jMsg["edits"])
+ JSONNode &jEdits = jMsg["edits"];
+ if (jEdits)
{
+ for (auto it = jEdits.begin(); it != jEdits.end(); ++it)
+ {
+ const JSONNode &jEdit = *it;
+
+ if (jEdit["time"].as_int() == edit_time)
+ return hEvent;
+ }
JSONNode jEdit;
jEdit.push_back(JSONNode("time", (long)edit_time));
jEdit.push_back(JSONNode("text", szContent));
- jMsg["edits"].push_back(jEdit);
+ jEdits.push_back(jEdit);
}
}
else
diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp
index f2839d2a1f..2be1b79804 100644
--- a/protocols/SkypeWeb/src/skype_events.cpp
+++ b/protocols/SkypeWeb/src/skype_events.cpp
@@ -40,9 +40,8 @@ INT_PTR CSkypeProto::GetEventText(WPARAM, LPARAM lParam)
const JSONNode &jEdit = *it;
time_t time = jEdit["time"].as_int();
- tm* _tm = localtime(&time);
char szTime[MAX_PATH];
- strftime(szTime, sizeof(szTime), "%X %x", _tm);
+ strftime(szTime, sizeof(szTime), "%X %x", localtime(&time));
text.AppendFormat(Translate("Edited at %s:\n\t%s\n"), szTime, jEdit["text"].as_string());
}
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp
index 8c8cbb25aa..11a6dc8ff0 100644
--- a/protocols/SkypeWeb/src/skype_messages.cpp
+++ b/protocols/SkypeWeb/src/skype_messages.cpp
@@ -213,11 +213,11 @@ void CSkypeProto::MarkMessagesRead(MCONTACT hContact, MEVENT hDbEvent)
{
debugLogA(__FUNCTION__);
ptrA username(db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID));
+
DBEVENTINFO dbei = { sizeof(dbei) };
-
db_event_get(hDbEvent, &dbei);
-
time_t timestamp = dbei.timestamp;
- PushRequest(new MarkMessageReadRequest(username, m_szRegToken, timestamp, timestamp, false, m_szServer));
+ if(db_get_dw(hContact, m_szModuleName, "LastMsgTime", 0) > (timestamp - 300))
+ PushRequest(new MarkMessageReadRequest(username, m_szRegToken, timestamp, timestamp, false, m_szServer));
}