1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix(core): Fix missed ToxId to ToxPk constructions

This commit is contained in:
Anthony Bilinski 2022-02-18 15:53:31 -08:00
parent 11f7f6193a
commit 56eed63fde
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
3 changed files with 6 additions and 7 deletions

View File

@ -1279,9 +1279,9 @@ ToxPk Core::getSelfPublicKey() const
{ {
QMutexLocker ml{&coreLoopLock}; QMutexLocker ml{&coreLoopLock};
uint8_t friendId[TOX_ADDRESS_SIZE] = {0x00}; uint8_t selfPk[TOX_PUBLIC_KEY_SIZE] = {0x00};
tox_self_get_address(tox.get(), friendId); tox_self_get_public_key(tox.get(), selfPk);
return ToxPk(friendId); return ToxPk(selfPk);
} }
/** /**

View File

@ -448,8 +448,7 @@ void Profile::startCore()
core->start(); core->start();
const ToxId& selfId = core->getSelfId(); const ToxPk& selfPk = core->getSelfPublicKey();
const ToxPk& selfPk = selfId.getPublicKey();
const QByteArray data = loadAvatarData(selfPk); const QByteArray data = loadAvatarData(selfPk);
if (data.isEmpty()) { if (data.isEmpty()) {
qDebug() << "Self avatar not found, will broadcast empty avatar to friends"; qDebug() << "Self avatar not found, will broadcast empty avatar to friends";

View File

@ -314,7 +314,7 @@ void AddFriendForm::deleteFriendRequest(const ToxId& toxId)
const int size = Settings::getInstance().getFriendRequestSize(); const int size = Settings::getInstance().getFriendRequestSize();
for (int i = 0; i < size; ++i) { for (int i = 0; i < size; ++i) {
Settings::Request request = Settings::getInstance().getFriendRequest(i); Settings::Request request = Settings::getInstance().getFriendRequest(i);
if (toxId == ToxId(request.address)) { if (toxId.getPublicKey() == ToxPk(request.address)) {
Settings::getInstance().removeFriendRequest(i); Settings::getInstance().removeFriendRequest(i);
return; return;
} }
@ -329,7 +329,7 @@ void AddFriendForm::onFriendRequestAccepted()
removeFriendRequestWidget(friendWidget); removeFriendRequestWidget(friendWidget);
const int indexFromEnd = requestsLayout->count() - index - 1; const int indexFromEnd = requestsLayout->count() - index - 1;
const Settings::Request request = Settings::getInstance().getFriendRequest(indexFromEnd); const Settings::Request request = Settings::getInstance().getFriendRequest(indexFromEnd);
emit friendRequestAccepted(ToxId(request.address).getPublicKey()); emit friendRequestAccepted(ToxPk{request.address});
Settings::getInstance().removeFriendRequest(indexFromEnd); Settings::getInstance().removeFriendRequest(indexFromEnd);
Settings::getInstance().savePersonal(); Settings::getInstance().savePersonal();
} }