summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2015-04-09 14:38:31 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2015-04-09 14:38:31 +0000
commit74a2e42b34d8495bf1e3676d4580e1d286384722 (patch)
tree37d699c88ee0cf830d45ba54accd3a39084a9068 /protocols
parent2e63fc262814c5f1aa80f482a721faa660200b0b (diff)
SkypeWeb: Auto sync history part 2.
git-svn-id: http://svn.miranda-ng.org/main/trunk@12697 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/SkypeWeb/src/skype_messages.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp
index 8f1dd3803e..ed90a8ec3a 100644
--- a/protocols/SkypeWeb/src/skype_messages.cpp
+++ b/protocols/SkypeWeb/src/skype_messages.cpp
@@ -34,7 +34,6 @@ MEVENT CSkypeProto::AddMessageToDb(MCONTACT hContact, DWORD timestamp, DWORD fla
{
if (MEVENT hDbEvent = GetMessageFromDB(hContact, messageId, timestamp))
return hDbEvent;
- setDword(hContact, "LastMsgId", atoi(messageId));
size_t messageLength = mir_strlen(&content[emoteOffset]) + 1;
size_t messageIdLength = mir_strlen(messageId);
size_t cbBlob = messageLength + messageIdLength;
@@ -52,7 +51,6 @@ int CSkypeProto::OnReceiveMessage(const char *messageId, const char *url, time_t
{
ptrA skypename(ContactUrlToName(url));
MCONTACT hContact = GetContact(skypename);
- setDword(hContact, "LastMsgId", atoi(messageId));
PROTORECVEVENT recv = { 0 };
recv.flags = PREF_UTF;
recv.timestamp = timestamp;
@@ -126,7 +124,6 @@ void CSkypeProto::OnMessageSent(const NETLIBHTTPREQUEST *response, void *arg)
{
SendMessageParam *param = (SendMessageParam*)arg;
MCONTACT hContact = param->hContact;
- setDword(hContact, "LastMsgId", param->hMessage);
HANDLE hMessage = (HANDLE)param->hMessage;
delete param;
@@ -240,15 +237,17 @@ void CSkypeProto::OnSyncHistory(const NETLIBHTTPREQUEST *response)
if (lastMessage == NULL)
continue;
- int clientMsgId(atoi(mir_t2a(ptrT(json_as_string(json_get(lastMessage, "clientmessageid"))))));
+ ptrA clientMsgId(mir_t2a(ptrT(json_as_string(json_get(lastMessage, "clientmessageid")))));
ptrA conversationLink(mir_t2a(ptrT(json_as_string(json_get(lastMessage, "conversationLink")))));
+ LONGLONG composeTime(IsoToUnixTime(ptrT(json_as_string(json_get(lastMessage, "conversationLink")))));
ptrA skypename(ContactUrlToName(conversationLink));
+ if (skypename == NULL)
+ return;
MCONTACT hContact = GetContact(skypename);
if (hContact == NULL && !IsMe(skypename))
hContact = AddContact(skypename, true);
- int lastmsgid = db_get_dw(hContact, m_szModuleName, "LastMsgId", NULL);
- if (lastmsgid != clientMsgId)
+ if (GetMessageFromDB(hContact, clientMsgId, composeTime) == NULL)
PushRequest(new GetHistoryRequest(ptrA(getStringA("registrationToken")), skypename, ptrA(getStringA("Server"))), &CSkypeProto::OnGetServerHistory);
}
} \ No newline at end of file