summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_proto.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2014-09-10 21:30:23 +0000
committerAlexander Lantsev <aunsane@gmail.com>2014-09-10 21:30:23 +0000
commitb9f735d6457050e326b1b50323dfc0d3b4e03114 (patch)
tree8ef9971db40372fcf3318ea0fd1d2aab784244f9 /protocols/Tox/src/tox_proto.cpp
parentd1206e34effff489a9ab7adbfc142f57e749b30f (diff)
Tox: fixed crash on contact adding/removing
git-svn-id: http://svn.miranda-ng.org/main/trunk@10425 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_proto.cpp')
-rw-r--r--protocols/Tox/src/tox_proto.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp
index 4bd9ca4efc..33f05487ed 100644
--- a/protocols/Tox/src/tox_proto.cpp
+++ b/protocols/Tox/src/tox_proto.cpp
@@ -83,7 +83,10 @@ MCONTACT __cdecl CToxProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
return AddContact(id, flags & PALF_TEMPORARY);
}
-MCONTACT __cdecl CToxProto::AddToListByEvent(int flags, int iContact, HANDLE hDbEvent) { return 0; }
+MCONTACT __cdecl CToxProto::AddToListByEvent(int flags, int iContact, HANDLE hDbEvent)
+{
+ return 0;
+}
int __cdecl CToxProto::Authorize(HANDLE hDbEvent)
{
@@ -96,10 +99,13 @@ int __cdecl CToxProto::Authorize(HANDLE hDbEvent)
}
DBVARIANT dbv;
- if (!db_get(NULL, m_szModuleName, TOX_SETTINGS_ID, &dbv))
+ if (!db_get(hContact, m_szModuleName, TOX_SETTINGS_ID, &dbv))
{
- if (tox_add_friend_norequest(tox, (uint8_t*)dbv.pbVal) != TOX_ERROR)
+ std::vector<uint8_t> id(TOX_CLIENT_ID_SIZE);
+ memcpy(&id[0], dbv.pbVal, TOX_CLIENT_ID_SIZE);
+ if (tox_add_friend_norequest(tox, id.data()) != TOX_ERROR)
{
+ db_unset(hContact, m_szModuleName, "Auth");
SaveToxData();
db_free(&dbv);
return 0;