Browse Source

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

Fix #5036
reviewable/pr5038/r1
Anthony Bilinski 7 years ago
parent
commit
b852809d0c
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
  1. 4
      src/persistence/history.cpp
  2. 2
      src/widget/form/chatform.cpp

4
src/persistence/history.cpp

@ -230,6 +230,10 @@ void History::addNewMessage(const QString& friendPk, const QString& message, con @@ -230,6 +230,10 @@ void History::addNewMessage(const QString& friendPk, const QString& message, con
const QDateTime& time, bool isSent, QString dispName,
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()) {
return;
}

2
src/widget/form/chatform.cpp

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

Loading…
Cancel
Save