Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
fix(history): don't save own messages when history is disabled
Browse files Browse the repository at this point in the history
Fix #5036
  • Loading branch information
anthonybilinski committed Mar 30, 2018
1 parent 7627d60 commit b852809
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/persistence/history.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/widget/form/chatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit b852809

Please sign in to comment.