From 6163df27ad6fd2a5da5d9bbb48bb457d8a07a2b6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 16 Jan 2017 18:20:37 +0300 Subject: DB_AUTH_BLOB: handy piece of code moved into the core --- protocols/Tox/src/tox_contacts.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'protocols/Tox/src') diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp index 4c2f582e41..9cfbd81b00 100644 --- a/protocols/Tox/src/tox_contacts.cpp +++ b/protocols/Tox/src/tox_contacts.cpp @@ -260,24 +260,12 @@ void CToxProto::OnFriendRequest(Tox*, const uint8_t *pubKey, const uint8_t *mess proto->delSetting(hContact, "Auth"); + DB_AUTH_BLOB blob(hContact, 0, 0, 0, (LPCSTR)address, (LPCSTR)message); + PROTORECVEVENT pre = { 0 }; pre.timestamp = time(NULL); - pre.lParam = (DWORD)(sizeof(DWORD) * 2 + address.GetLength() + length + 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, address); - pCurBlob += address.GetLength() + 1; - mir_strcpy((char *)pCurBlob, (char*)message); - pre.szMessage = (char*)pBlob; - + pre.lParam = blob.size(); + pre.szMessage = blob; ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre); } -- cgit v1.2.3