From b9f735d6457050e326b1b50323dfc0d3b4e03114 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Wed, 10 Sep 2014 21:30:23 +0000 Subject: Tox: fixed crash on contact adding/removing git-svn-id: http://svn.miranda-ng.org/main/trunk@10425 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Tox/src/tox_proto.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'protocols/Tox/src/tox_proto.cpp') 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 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; -- cgit v1.2.3