mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
parent
52617ad075
commit
5b31cf6d9d
@ -141,7 +141,7 @@ Profile* Profile::loadProfile(QString name, const QString& password)
|
|||||||
saveFile.close();
|
saveFile.close();
|
||||||
p = new Profile(name, password, false, data);
|
p = new Profile(name, password, false, data);
|
||||||
p->passkey = std::move(tmpKey);
|
p->passkey = std::move(tmpKey);
|
||||||
if (tmpKey) {
|
if (p->passkey) {
|
||||||
p->encrypted = true;
|
p->encrypted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ Profile* Profile::createProfile(QString name, QString password)
|
|||||||
Settings::getInstance().createPersonal(name);
|
Settings::getInstance().createPersonal(name);
|
||||||
Profile* p = new Profile(name, password, true, QByteArray());
|
Profile* p = new Profile(name, password, true, QByteArray());
|
||||||
p->passkey = std::move(tmpKey);
|
p->passkey = std::move(tmpKey);
|
||||||
if (tmpKey) {
|
if (p->passkey) {
|
||||||
p->encrypted = true;
|
p->encrypted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,10 +393,10 @@ QPixmap Profile::loadAvatar(const QString& ownerId)
|
|||||||
QByteArray Profile::loadAvatarData(const QString& ownerId)
|
QByteArray Profile::loadAvatarData(const QString& ownerId)
|
||||||
{
|
{
|
||||||
QString path = avatarPath(ownerId);
|
QString path = avatarPath(ownerId);
|
||||||
|
bool avatarEncrypted = encrypted;
|
||||||
// If the encrypted avatar isn't found, try loading the unencrypted one for the same ID
|
// If the encrypted avatar isn't found, try loading the unencrypted one for the same ID
|
||||||
if (encrypted && !QFile::exists(path)) {
|
if (avatarEncrypted && !QFile::exists(path)) {
|
||||||
encrypted = false;
|
avatarEncrypted = false;
|
||||||
path = avatarPath(ownerId, true);
|
path = avatarPath(ownerId, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -406,7 +406,7 @@ QByteArray Profile::loadAvatarData(const QString& ownerId)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QByteArray pic = file.readAll();
|
QByteArray pic = file.readAll();
|
||||||
if (encrypted && !pic.isEmpty()) {
|
if (avatarEncrypted && !pic.isEmpty()) {
|
||||||
pic = passkey->decrypt(pic);
|
pic = passkey->decrypt(pic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user