diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-05-09 18:20:41 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-05-09 18:20:41 +0000 |
commit | 98ea54f7f9eac65c369538e0f293ac7ec3e8db51 (patch) | |
tree | ac16c667c685bf68ef3368bc4b4c2f54cb81da3b /protocols/SkypeWeb/src/skype_contacts.cpp | |
parent | ead1af24335c627c11ef2e23f7a31131c0412a2e (diff) |
SkypeWeb: TRouter refactoring.
git-svn-id: http://svn.miranda-ng.org/main/trunk@13499 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/skype_contacts.cpp')
-rw-r--r-- | protocols/SkypeWeb/src/skype_contacts.cpp | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index 72237b51d0..f4f1f87e99 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -130,37 +130,47 @@ void CSkypeProto::LoadContactsAuth(const NETLIBHTTPREQUEST *response) node = json_get(item, "sender");
ptrA skypename(mir_t2a(ptrT(json_as_string(node))));
- JSONNODE *node = json_get(root, "greeting");
+ node = json_get(root, "greeting");
CMStringA reason = ptrA(mir_t2a(ptrT(json_as_string(node))));
+ node = json_get(root, "event_time");
+ ptrT eventTimeStr(json_as_string(node));
+ time_t eventTime = IsoToUnixTime(eventTimeStr);
+
if (reason == "null")
reason.Empty();
MCONTACT hContact = AddContact(skypename);
if (hContact)
{
- delSetting(hContact, "Auth");
-
- PROTORECVEVENT pre = { 0 };
- pre.flags = PREF_UTF;
- pre.timestamp = time(NULL);
- pre.lParam = (DWORD)(sizeof(DWORD) * 2 + mir_strlen(skypename) + reason.GetLength() + 5);
-
- /*blob is: 0(DWORD), hContact(DWORD), nick(ASCIIZ), firstName(ASCIIZ), lastName(ASCIIZ), id(ASCIIZ), reason(ASCIIZ)*/
- PBYTE pBlob, pCurBlob;
- pCurBlob = pBlob = (PBYTE)mir_calloc(pre.lParam);
-
- *((PDWORD)pCurBlob) = 0;
- pCurBlob += sizeof(DWORD);
- *((PDWORD)pCurBlob) = (DWORD)hContact;
- pCurBlob += sizeof(DWORD);
- pCurBlob += 3;
- mir_strcpy((char*)pCurBlob, skypename);
- pCurBlob += mir_strlen(skypename) + 1;
- mir_strcpy((char*)pCurBlob, reason);
- pre.szMessage = (char*)pBlob;
-
- ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre);
+ time_t lastEventTime = db_get_dw(hContact, m_szModuleName, "LastAuthRequestTime", 0);
+
+ if (lastEventTime == 0 || lastEventTime < eventTime)
+ {
+ db_set_dw(hContact, m_szModuleName,"LastAuthRequestTime", eventTime);
+ delSetting(hContact, "Auth");
+
+ PROTORECVEVENT pre = { 0 };
+ pre.flags = PREF_UTF;
+ pre.timestamp = time(NULL);
+ pre.lParam = (DWORD)(sizeof(DWORD) * 2 + mir_strlen(skypename) + reason.GetLength() + 5);
+
+ /*blob is: 0(DWORD), hContact(DWORD), nick(ASCIIZ), firstName(ASCIIZ), lastName(ASCIIZ), id(ASCIIZ), reason(ASCIIZ)*/
+ PBYTE pBlob, pCurBlob;
+ pCurBlob = pBlob = (PBYTE)mir_calloc(pre.lParam);
+
+ *((PDWORD)pCurBlob) = 0;
+ pCurBlob += sizeof(DWORD);
+ *((PDWORD)pCurBlob) = (DWORD)hContact;
+ pCurBlob += sizeof(DWORD);
+ pCurBlob += 3;
+ mir_strcpy((char*)pCurBlob, skypename);
+ pCurBlob += mir_strlen(skypename) + 1;
+ mir_strcpy((char*)pCurBlob, reason);
+ pre.szMessage = (char*)pBlob;
+
+ ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre);
+ }
}
}
json_delete(items);
|