summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/SkypeWeb/src/requests/messages.h4
-rw-r--r--protocols/SkypeWeb/src/skype_messages.cpp13
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h3
3 files changed, 17 insertions, 3 deletions
diff --git a/protocols/SkypeWeb/src/requests/messages.h b/protocols/SkypeWeb/src/requests/messages.h
index de6d044305..9a87361990 100644
--- a/protocols/SkypeWeb/src/requests/messages.h
+++ b/protocols/SkypeWeb/src/requests/messages.h
@@ -98,8 +98,8 @@ public:
class MarkMessageReadRequest : public HttpRequest
{
public:
- MarkMessageReadRequest(const char *regToken, const char *username, LONGLONG msgId = 0, const char *server = SKYPE_ENDPOINTS_HOST) :
- HttpRequest(REQUEST_GET, FORMAT, "%s/v1/users/ME/conversations/8:%s/messages/%lld", server, ptrA(mir_urlEncode(username)), msgId)
+ MarkMessageReadRequest(const char *regToken, LONGLONG msgId = 0, const char *server = SKYPE_ENDPOINTS_HOST) :
+ HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/ALL/messages/%lld/ack", server, msgId)
{
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp
index 070cf94851..a826d38e52 100644
--- a/protocols/SkypeWeb/src/skype_messages.cpp
+++ b/protocols/SkypeWeb/src/skype_messages.cpp
@@ -243,8 +243,19 @@ void CSkypeProto::OnPrivateMessageEvent(JSONNODE *node)
}
}
-int CSkypeProto::OnDbEventRead(WPARAM wParam, LPARAM lParam)
+int CSkypeProto::OnDbEventRead(WPARAM, LPARAM hDbEvent)
{
debugLogA(__FUNCTION__);
+ if (IsOnline())
+ MarkMessagesRead(hDbEvent);
return 0;
+}
+
+void CSkypeProto::MarkMessagesRead(MEVENT hDbEvent)
+{
+ debugLogA(__FUNCTION__);
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ db_event_get(hDbEvent, &dbei);
+ time_t timestamp = dbei.timestamp;
+ PushRequest(new MarkMessageReadRequest(ptrA(getStringA("registrationToken")), timestamp, ptrA(getStringA("Server"))));
} \ No newline at end of file
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h
index 123e6a2b0c..f837fc36b5 100644
--- a/protocols/SkypeWeb/src/skype_proto.h
+++ b/protocols/SkypeWeb/src/skype_proto.h
@@ -198,8 +198,11 @@ private:
void OnMessageSent(const NETLIBHTTPREQUEST *response, void *arg);
int __cdecl OnPreCreateMessage(WPARAM, LPARAM lParam);
+ void MarkMessagesRead(MEVENT hDbEvent);
+
void OnPrivateMessageEvent(JSONNODE *node);
+
// sync
void OnGetServerHistory(const NETLIBHTTPREQUEST *response);
void SyncHistory();