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

fix(history): save name to history for friend invite message

This avoids an extra alias table entry for the empty name. It is not possible to safely heal existing databases, since friend invite message is a normal action message making it hard to change the alias ID used by it, and the alias in the alias table could be used by any other messages if the user's name has ever truely been blank. Just avoid the incorrect alias entry for new chats.
This commit is contained in:
Anthony Bilinski 2019-05-01 01:45:35 -07:00
parent 0fd06e35a4
commit 2ccb1ec150
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C

View File

@ -563,11 +563,12 @@ void Profile::onRequestSent(const ToxPk& friendPk, const QString& message)
return; return;
} }
QString pkStr = friendPk.toString(); const QString pkStr = friendPk.toString();
QString inviteStr = Core::tr("/me offers friendship, \"%1\"").arg(message); const QString inviteStr = Core::tr("/me offers friendship, \"%1\"").arg(message);
QString selfStr = core->getSelfPublicKey().toString(); const QString selfStr = core->getSelfPublicKey().toString();
QDateTime datetime = QDateTime::currentDateTime(); const QDateTime datetime = QDateTime::currentDateTime();
history->addNewMessage(pkStr, inviteStr, selfStr, datetime, true, QString()); const QString name = core->getUsername();
history->addNewMessage(pkStr, inviteStr, selfStr, datetime, true, name);
} }
/** /**