diff options
author | George Hazan <ghazan@miranda.im> | 2017-01-16 18:20:37 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-01-16 18:20:37 +0300 |
commit | 6163df27ad6fd2a5da5d9bbb48bb457d8a07a2b6 (patch) | |
tree | d0523b56e1b987789c6622916a31e8f356076d23 /protocols/Steam/src/steam_contacts.cpp | |
parent | e021b02022a37bd23b599801026d631f5fd9f48c (diff) |
DB_AUTH_BLOB: handy piece of code moved into the core
Diffstat (limited to 'protocols/Steam/src/steam_contacts.cpp')
-rw-r--r-- | protocols/Steam/src/steam_contacts.cpp | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index 92a0bb5c63..efb76d7142 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -332,30 +332,12 @@ void CSteamProto::ContactIsAskingAuth(MCONTACT hContact) char reason[MAX_PATH]; mir_snprintf(reason, Translate("%s has added you to his or her Friend List"), nickName); - // blob is: 0(DWORD), hContact(DWORD), nick(ASCIIZ), firstName(ASCIIZ), lastName(ASCIIZ), sid(ASCIIZ), reason(ASCIIZ) - DWORD cbBlob = (DWORD)(sizeof(DWORD)* 2 + mir_strlen(nickName) + mir_strlen(firstName) + mir_strlen(lastName) + mir_strlen(steamId) + mir_strlen(reason) + 5); - - PBYTE pBlob, pCurBlob; - pCurBlob = pBlob = (PBYTE)mir_alloc(cbBlob); - - *((PDWORD)pCurBlob) = 0; - pCurBlob += sizeof(DWORD); - *((PDWORD)pCurBlob) = (DWORD)hContact; - pCurBlob += sizeof(DWORD); - mir_strcpy((char*)pCurBlob, nickName); - pCurBlob += mir_strlen(nickName) + 1; - mir_strcpy((char*)pCurBlob, firstName); - pCurBlob += mir_strlen(firstName) + 1; - mir_strcpy((char*)pCurBlob, lastName); - pCurBlob += mir_strlen(lastName) + 1; - mir_strcpy((char*)pCurBlob, steamId); - pCurBlob += mir_strlen(steamId) + 1; - mir_strcpy((char*)pCurBlob, reason); + DB_AUTH_BLOB blob(hContact, nickName, firstName, lastName, steamId, reason); PROTORECVEVENT recv = { 0 }; recv.timestamp = time(NULL); - recv.szMessage = (char*)pBlob; - recv.lParam = cbBlob; + recv.szMessage = blob; + recv.lParam = blob.size(); ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&recv); // remember to not create this event again, unless authorization status changes again |