From 6c21b8918e51b66845f2555c8e3e4dc7d7a3b749 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Sat, 20 Sep 2014 18:57:33 +0000 Subject: Tox: - tox id is string again (h8!!) - updated tox core git-svn-id: http://svn.miranda-ng.org/main/trunk@10537 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Tox/src/tox_messages.cpp | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'protocols/Tox/src/tox_messages.cpp') diff --git a/protocols/Tox/src/tox_messages.cpp b/protocols/Tox/src/tox_messages.cpp index ee19016c2d..d22fbc9f2d 100644 --- a/protocols/Tox/src/tox_messages.cpp +++ b/protocols/Tox/src/tox_messages.cpp @@ -35,15 +35,9 @@ void CToxProto::OnFriendAction(Tox *tox, const int number, const uint8_t *action int __cdecl CToxProto::SendMsg(MCONTACT hContact, int flags, const char* msg) { - DBVARIANT dbv; - std::vector id(TOX_CLIENT_ID_SIZE); - if (!db_get(hContact, m_szModuleName, TOX_SETTINGS_ID, &dbv)) - { - memcpy(&id[0], dbv.pbVal, TOX_CLIENT_ID_SIZE); - db_free(&dbv); - } - - uint32_t number = tox_get_friend_number(tox, id.data()); + std::string id = getStringA(hContact, TOX_SETTINGS_ID); + std::vector clientId = HexStringToData(id); + uint32_t number = tox_get_friend_number(tox, clientId.data()); if (number == TOX_ERROR) { debugLogA("CToxProto::SendMsg: failed to get friend number"); @@ -120,14 +114,9 @@ int __cdecl CToxProto::UserIsTyping(MCONTACT hContact, int type) { if (hContact && IsOnline()) { - DBVARIANT dbv; - std::vector id(TOX_CLIENT_ID_SIZE); - if (!db_get(hContact, m_szModuleName, TOX_SETTINGS_ID, &dbv)) - { - memcpy(&id[0], dbv.pbVal, TOX_CLIENT_ID_SIZE); - db_free(&dbv); - } - uint32_t number = tox_get_friend_number(tox, id.data()); + std::string id = getStringA(hContact, TOX_SETTINGS_ID); + std::vector clientId = HexStringToData(id); + uint32_t number = tox_get_friend_number(tox, clientId.data()); if (number >= 0) { tox_set_user_is_typing(tox, number, type); -- cgit v1.2.3