Browse Source

fix(core): Fix missed ToxId to ToxPk constructions

reviewable/pr6480/r5
Anthony Bilinski 4 years ago
parent
commit
56eed63fde
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
  1. 6
      src/core/core.cpp
  2. 3
      src/persistence/profile.cpp
  3. 4
      src/widget/form/addfriendform.cpp

6
src/core/core.cpp

@ -1279,9 +1279,9 @@ ToxPk Core::getSelfPublicKey() const @@ -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);
}
/**

3
src/persistence/profile.cpp

@ -448,8 +448,7 @@ void Profile::startCore() @@ -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";

4
src/widget/form/addfriendform.cpp

@ -314,7 +314,7 @@ void AddFriendForm::deleteFriendRequest(const ToxId& toxId) @@ -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() @@ -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();
}

Loading…
Cancel
Save