summaryrefslogtreecommitdiff
path: root/protocols/VKontakte
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2015-02-02 06:07:50 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2015-02-02 06:07:50 +0000
commitbc12cb40df2111e973107c0bc3172ea274f774e7 (patch)
tree38d3723c14430203310a98fd1ec49f0d6522b22f /protocols/VKontakte
parent5bd5d3dc1920e22d0632dd265593b6dacce227dd (diff)
VKontakte: fix(???) for empty contact name on friend request (attempt 2)
git-svn-id: http://svn.miranda-ng.org/main/trunk@11980 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte')
-rw-r--r--protocols/VKontakte/src/misc.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index 5e1a404d57..ebe357b40b 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -515,18 +515,23 @@ void CVkProto::ApplyCookies(AsyncHttpRequest *pReq)
void CVkProto::DBAddAuthRequest(const MCONTACT hContact)
{
debugLogA("CVkProto::DBAddAuthRequest");
- //char* szJid = mir_utf8encodeT(jid);
- CMString tszNick = db_get_sa(hContact, m_szModuleName, "Nick");
- char* szNick = mir_utf8encodeT(tszNick.GetBuffer());
+ CMString tszNick = db_get_sa(hContact, m_szModuleName, "Nick");
+ CMString tszFirstName = db_get_sa(hContact, m_szModuleName, "FirstName");
+ CMString tszLastName = db_get_sa(hContact, m_szModuleName, "LastName");
+
+ ptrA szNick(mir_utf8encodeT(tszNick.GetBuffer()));
+ ptrA szFirstName(mir_utf8encodeT(tszFirstName.GetBuffer()));
+ ptrA szLastName(mir_utf8encodeT(tszLastName.GetBuffer()));
+
//blob is: uin(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ)
- //blob is: 0(DWORD), hContact(DWORD), nick(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ)
+ //blob is: 0(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ)
DBEVENTINFO dbei = { sizeof(DBEVENTINFO) };
dbei.szModule = m_szModuleName;
dbei.timestamp = (DWORD)time(NULL);
dbei.flags = DBEF_UTF;
dbei.eventType = EVENTTYPE_AUTHREQUEST;
- dbei.cbBlob = (DWORD)(sizeof(DWORD) * 2 + mir_strlen(szNick) + 5);
+ dbei.cbBlob = (DWORD)(sizeof(DWORD) * 2 + mir_strlen(szNick) + mir_strlen(szFirstName) + mir_strlen(szLastName) + 5);
PBYTE pCurBlob = dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob);
@@ -539,18 +544,18 @@ void CVkProto::DBAddAuthRequest(const MCONTACT hContact)
strcpy((char*)pCurBlob, szNick);
pCurBlob += mir_strlen(szNick) + 1;
- *pCurBlob = '\0'; //firstName
- pCurBlob++;
- *pCurBlob = '\0'; //lastName
- pCurBlob++;
+ strcpy((char*)pCurBlob, szFirstName);
+ pCurBlob += mir_strlen(szFirstName) + 1;
+
+ strcpy((char*)pCurBlob, szLastName);
+ pCurBlob += mir_strlen(szLastName) + 1;
+
*pCurBlob = '\0'; //email
pCurBlob++;
*pCurBlob = '\0'; //reason
db_event_add(NULL, &dbei);
- debugLogA("CVkProto::DBAddAuthRequest '%s'", szNick);
-
- mir_free(szNick);
+ debugLogA("CVkProto::DBAddAuthRequest %s", tszNick.IsEmpty() ? "<null>" : szNick);
}
MCONTACT CVkProto::MContactFromDbEvent(MEVENT hDbEvent)