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

fix(history): don't save own messages when history is disabled

Fix #5036
This commit is contained in:
Anthony Bilinski 2018-03-28 00:17:51 -07:00
parent 7627d60a89
commit b852809d0c
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
2 changed files with 5 additions and 1 deletions

View File

@ -230,6 +230,10 @@ void History::addNewMessage(const QString& friendPk, const QString& message, con
const QDateTime& time, bool isSent, QString dispName, const QDateTime& time, bool isSent, QString dispName,
const std::function<void(int64_t)>& insertIdCallback) const std::function<void(int64_t)>& insertIdCallback)
{ {
if (!Settings::getInstance().getEnableLogging()) {
qWarning() << "Blocked a message from being added to database while history is disabled";
return;
}
if (!isValid()) { if (!isValid()) {
return; return;
} }

View File

@ -984,7 +984,7 @@ void ChatForm::SendMessageStr(QString msg)
uint32_t friendId = f->getId(); uint32_t friendId = f->getId();
int rec = isAction ? core->sendAction(friendId, part) : core->sendMessage(friendId, part); int rec = isAction ? core->sendAction(friendId, part) : core->sendMessage(friendId, part);
if (history) { if (history && Settings::getInstance().getEnableLogging()) {
auto* offMsgEngine = getOfflineMsgEngine(); auto* offMsgEngine = getOfflineMsgEngine();
QString selfPk = Core::getInstance()->getSelfId().toString(); QString selfPk = Core::getInstance()->getSelfId().toString();
QString pk = f->getPublicKey().toString(); QString pk = f->getPublicKey().toString();