summaryrefslogtreecommitdiff
path: root/protocols/Tox
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-01-16 18:20:37 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-01-16 18:20:37 +0300
commit6163df27ad6fd2a5da5d9bbb48bb457d8a07a2b6 (patch)
treed0523b56e1b987789c6622916a31e8f356076d23 /protocols/Tox
parente021b02022a37bd23b599801026d631f5fd9f48c (diff)
DB_AUTH_BLOB: handy piece of code moved into the core
Diffstat (limited to 'protocols/Tox')
-rw-r--r--protocols/Tox/src/tox_contacts.cpp20
1 files changed, 4 insertions, 16 deletions
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);
}