diff --git a/src/core/core.cpp b/src/core/core.cpp index 60734f810..5c1da4d39 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -1279,9 +1279,9 @@ ToxPk Core::getSelfPublicKey() const { QMutexLocker ml{&coreLoopLock}; - uint8_t friendId[TOX_ADDRESS_SIZE] = {0x00}; - tox_self_get_address(tox.get(), friendId); - return ToxPk(friendId); + uint8_t selfPk[TOX_PUBLIC_KEY_SIZE] = {0x00}; + tox_self_get_public_key(tox.get(), selfPk); + return ToxPk(selfPk); } /** diff --git a/src/persistence/profile.cpp b/src/persistence/profile.cpp index 77ad592e5..36b0f18fc 100644 --- a/src/persistence/profile.cpp +++ b/src/persistence/profile.cpp @@ -448,8 +448,7 @@ void Profile::startCore() core->start(); - const ToxId& selfId = core->getSelfId(); - const ToxPk& selfPk = selfId.getPublicKey(); + const ToxPk& selfPk = core->getSelfPublicKey(); const QByteArray data = loadAvatarData(selfPk); if (data.isEmpty()) { qDebug() << "Self avatar not found, will broadcast empty avatar to friends"; diff --git a/src/widget/form/addfriendform.cpp b/src/widget/form/addfriendform.cpp index 51806da14..795a1deda 100644 --- a/src/widget/form/addfriendform.cpp +++ b/src/widget/form/addfriendform.cpp @@ -314,7 +314,7 @@ void AddFriendForm::deleteFriendRequest(const ToxId& toxId) const int size = Settings::getInstance().getFriendRequestSize(); for (int i = 0; i < size; ++i) { Settings::Request request = Settings::getInstance().getFriendRequest(i); - if (toxId == ToxId(request.address)) { + if (toxId.getPublicKey() == ToxPk(request.address)) { Settings::getInstance().removeFriendRequest(i); return; } @@ -329,7 +329,7 @@ void AddFriendForm::onFriendRequestAccepted() removeFriendRequestWidget(friendWidget); const int indexFromEnd = requestsLayout->count() - index - 1; 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().savePersonal(); }