From d6b34aef7861930ac1365f80e2b21ff9a3c2ee29 Mon Sep 17 00:00:00 2001 From: "Tux3 / Mlkj / !Lev.uXFMLA" Date: Sun, 1 Feb 2015 01:25:22 +0100 Subject: [PATCH] Update for toxcore API break --- src/core.cpp | 14 +++++++------- src/misc/cdata.cpp | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/core.cpp b/src/core.cpp index 812e36fc5..b7d590a00 100644 --- a/src/core.cpp +++ b/src/core.cpp @@ -742,7 +742,7 @@ void Core::acceptFriendRequest(const QString& userId) void Core::requestFriendship(const QString& friendAddress, const QString& message) { - const QString userId = friendAddress.mid(0, TOX_CLIENT_ID_SIZE * 2); + const QString userId = friendAddress.mid(0, TOX_PUBLIC_KEY_SIZE * 2); if (hasFriendWithAddress(friendAddress)) { @@ -1439,7 +1439,7 @@ void Core::loadFriends() // assuming there are not that many friends to fill up the whole stack int32_t *ids = new int32_t[friendCount]; tox_get_friendlist(tox, ids, friendCount); - uint8_t clientId[TOX_CLIENT_ID_SIZE]; + uint8_t clientId[TOX_PUBLIC_KEY_SIZE]; for (int32_t i = 0; i < static_cast(friendCount); ++i) { if (tox_get_client_id(tox, ids[i], clientId) == 0) { emit friendAdded(ids[i], CUserId::toString(clientId)); @@ -1500,7 +1500,7 @@ ToxID Core::getGroupPeerToxID(int groupId, int peerId) const { ToxID peerToxID; - uint8_t rawID[TOX_CLIENT_ID_SIZE]; + uint8_t rawID[TOX_PUBLIC_KEY_SIZE]; int res = tox_group_peer_pubkey(tox, groupId, peerId, rawID); if (res == -1) { @@ -1706,14 +1706,14 @@ bool Core::hasFriendWithAddress(const QString &addr) const return false; } - QString pubkey = addr.left(TOX_CLIENT_ID_SIZE * 2); + QString pubkey = addr.left(TOX_PUBLIC_KEY_SIZE * 2); return hasFriendWithPublicKey(pubkey); } bool Core::hasFriendWithPublicKey(const QString &pubkey) const { // Valid length check - if (pubkey.length() != (TOX_CLIENT_ID_SIZE * 2)) + if (pubkey.length() != (TOX_PUBLIC_KEY_SIZE * 2)) { return false; } @@ -1746,9 +1746,9 @@ bool Core::hasFriendWithPublicKey(const QString &pubkey) const QString Core::getFriendAddress(int friendNumber) const { // If we don't know the full address of the client, return just the id, otherwise get the full address - uint8_t rawid[TOX_CLIENT_ID_SIZE]; + uint8_t rawid[TOX_PUBLIC_KEY_SIZE]; tox_get_client_id(tox, friendNumber, rawid); - QByteArray data((char*)rawid,TOX_CLIENT_ID_SIZE); + QByteArray data((char*)rawid,TOX_PUBLIC_KEY_SIZE); QString id = data.toHex().toUpper(); QString addr = Settings::getInstance().getFriendAdress(id); diff --git a/src/misc/cdata.cpp b/src/misc/cdata.cpp index 7909ba73c..28025de94 100644 --- a/src/misc/cdata.cpp +++ b/src/misc/cdata.cpp @@ -56,7 +56,7 @@ uint16_t CData::fromString(const QString& data, uint8_t* cData) // CUserId -const uint16_t CUserId::SIZE{TOX_CLIENT_ID_SIZE}; +const uint16_t CUserId::SIZE{TOX_PUBLIC_KEY_SIZE}; CUserId::CUserId(const QString &userId) : CData(userId, SIZE < userId.size() ? userId.size() : SIZE)