summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/SkypeWeb')
-rw-r--r--protocols/SkypeWeb/src/requests/messages.h2
-rw-r--r--protocols/SkypeWeb/src/skype_events.cpp4
-rw-r--r--protocols/SkypeWeb/src/skype_messages.cpp16
-rw-r--r--protocols/SkypeWeb/src/skype_poll_processing.cpp18
-rw-r--r--protocols/SkypeWeb/src/skype_proto.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h2
-rw-r--r--protocols/SkypeWeb/src/skype_utils.cpp3
7 files changed, 31 insertions, 16 deletions
diff --git a/protocols/SkypeWeb/src/requests/messages.h b/protocols/SkypeWeb/src/requests/messages.h
index 07fbfc6e61..054d682619 100644
--- a/protocols/SkypeWeb/src/requests/messages.h
+++ b/protocols/SkypeWeb/src/requests/messages.h
@@ -106,7 +106,7 @@ public:
<< FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken)
<< CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
- CMStringA data(::FORMAT, "{\"consumptionhorizon\":\"%lld000;%lld000;%lld000\"}", msgTimestamp, time(NULL), msgId);
+ CMStringA data(::FORMAT, "{\"consumptionhorizon\":\"%lld000;%lld000;0\"}", msgTimestamp, time(NULL));
Body << VALUE(data);
}
};
diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp
index 03297983e8..2392542bba 100644
--- a/protocols/SkypeWeb/src/skype_events.cpp
+++ b/protocols/SkypeWeb/src/skype_events.cpp
@@ -126,7 +126,7 @@ void CSkypeProto::InitPopups()
m_hPopupClassNotify = Popup_RegisterClass(&ppc);
}
-/*int CSkypeProto::ProcessSrmmEvent(WPARAM, LPARAM lParam)
+int CSkypeProto::ProcessSrmmEvent(WPARAM, LPARAM lParam)
{
debugLogA(__FUNCTION__);
MessageWindowEventData *event = (MessageWindowEventData *)lParam;
@@ -135,4 +135,4 @@ void CSkypeProto::InitPopups()
SetSrmmReadStatus(event->hContact);
return 0;
-}*/ \ No newline at end of file
+} \ No newline at end of file
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp
index 1b65a34a9f..e47f8e248a 100644
--- a/protocols/SkypeWeb/src/skype_messages.cpp
+++ b/protocols/SkypeWeb/src/skype_messages.cpp
@@ -307,17 +307,17 @@ void CSkypeProto::OnPrivateMessageEvent(JSONNODE *node)
}
else if (!mir_strcmpi(messageType, "RichText/Contacts")){}
- if (clientMsgId && (!mir_strcmpi(messageType, "Text") || !mir_strcmpi(messageType, "RichText")))
- {
- PushRequest(new MarkMessageReadRequest(skypename, RegToken, _ttoi(json_as_string(json_get(node, "id"))), timestamp, false, Server));
- }
+ //if (clientMsgId && (!mir_strcmpi(messageType, "Text") || !mir_strcmpi(messageType, "RichText")))
+ //{
+ // PushRequest(new MarkMessageReadRequest(skypename, RegToken, _ttoi(json_as_string(json_get(node, "id"))), timestamp, false, Server));
+ //}
}
-int CSkypeProto::OnDbEventRead(WPARAM, LPARAM)
+int CSkypeProto::OnDbEventRead(WPARAM hContact, LPARAM hDbEvent)
{
debugLogA(__FUNCTION__);
- //if (IsOnline() && !isChatRoom(hContact) && !mir_strcmp(GetContactProto(hContact), m_szModuleName))
- // MarkMessagesRead(hContact, hDbEvent);
+ if (IsOnline() && !isChatRoom(hContact) && !mir_strcmp(GetContactProto(hContact), m_szModuleName))
+ MarkMessagesRead(hContact, hDbEvent);
return 0;
}
@@ -331,5 +331,5 @@ void CSkypeProto::MarkMessagesRead(MCONTACT hContact, MEVENT hDbEvent)
time_t timestamp = dbei.timestamp;
- PushRequest(new MarkMessageReadRequest(username, RegToken, time(NULL)+60/*it should be rewritten*/, timestamp, false, Server));
+ PushRequest(new MarkMessageReadRequest(username, RegToken, timestamp, timestamp, false, Server));
} \ No newline at end of file
diff --git a/protocols/SkypeWeb/src/skype_poll_processing.cpp b/protocols/SkypeWeb/src/skype_poll_processing.cpp
index 327bbaae3d..7682006a48 100644
--- a/protocols/SkypeWeb/src/skype_poll_processing.cpp
+++ b/protocols/SkypeWeb/src/skype_poll_processing.cpp
@@ -141,17 +141,29 @@ void CSkypeProto::ProcessConversationUpdateRes(JSONNODE *node)
JSONNODE *properties = json_get(node, "properties" );
ptrA convLink(mir_t2a(json_as_string(json_get(lastMessage, "conversationLink"))));
+ ptrA fromLink(mir_t2a(json_as_string(json_get(lastMessage, "from"))));
- if (strstr(convLink, "/8:"))
+ if (strstr(convLink, "/8:") && IsMe(ContactUrlToName(fromLink)))
{
ptrA skypename(ContactUrlToName(convLink));
MCONTACT hContact = FindContact(skypename);
if (hContact != NULL)
{
- ptrA consumptionhorizon(mir_t2a(json_as_string(json_get(properties, "consumptionhorizon"))));
+ CMStringA consumptionhorizon(mir_t2a(json_as_string(json_get(properties, "consumptionhorizon"))));
- //server return bad data
+ int iStart = 0;
+ CMStringA szToken1 = consumptionhorizon.Tokenize(";", iStart).Trim();
+
+ if (iStart != -1)
+ {
+ CMStringA szToken2 = consumptionhorizon.Tokenize(";", iStart).Trim();
+
+ time_t evttime = atoi(szToken2.GetBuffer());
+ db_set_dw(hContact, m_szModuleName, "LastMsgReadTime", evttime);
+
+ SetSrmmReadStatus(hContact);
+ }
}
}
}
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp
index 8c0b9b36d0..50990fb2af 100644
--- a/protocols/SkypeWeb/src/skype_proto.cpp
+++ b/protocols/SkypeWeb/src/skype_proto.cpp
@@ -43,7 +43,7 @@ PROTO<CSkypeProto>(protoName, userName), password(NULL)
CreateProtoService("/IncomingCallCLE", &CSkypeProto::OnIncomingCallCLE);
CreateProtoService("/IncomingCallPP", &CSkypeProto::OnIncomingCallPP);
- //HookProtoEvent(ME_MSG_WINDOWEVENT, &CSkypeProto::ProcessSrmmEvent);
+ HookProtoEvent(ME_MSG_WINDOWEVENT, &CSkypeProto::ProcessSrmmEvent);
m_tszAvatarFolder = std::tstring(VARST(_T("%miranda_avatarcache%"))) + _T("\\") + m_tszUserName;
DWORD dwAttributes = GetFileAttributes(m_tszAvatarFolder.c_str());
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h
index f639f1d18b..c50db3aa79 100644
--- a/protocols/SkypeWeb/src/skype_proto.h
+++ b/protocols/SkypeWeb/src/skype_proto.h
@@ -341,7 +341,7 @@ private:
//events
void InitDBEvents();
- //int __cdecl ProcessSrmmEvent(WPARAM, LPARAM);
+ int __cdecl ProcessSrmmEvent(WPARAM, LPARAM);
//services
INT_PTR __cdecl OnIncomingCallCLE (WPARAM wParam, LPARAM lParam);
diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp
index 4ef74fb50e..2d0d9dc3ae 100644
--- a/protocols/SkypeWeb/src/skype_utils.cpp
+++ b/protocols/SkypeWeb/src/skype_utils.cpp
@@ -758,6 +758,9 @@ void CSkypeProto::ProcessTimer()
if (IsOnline())
{
PushRequest(new GetContactListRequest(TokenSecret), &CSkypeProto::LoadContactList);
+
+ if (!m_hTrouterThread)
+ SendRequest(new CreateTrouterRequest(), &CSkypeProto::OnCreateTrouter);
}
}