diff options
-rw-r--r-- | protocols/SkypeWeb/src/skype_db.cpp | 12 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_events.cpp | 3 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_messages.cpp | 6 |
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));
}
|