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

Commit

Permalink
feat(offlinemsg): Force offline messages to always be enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
sphaerophoria committed May 26, 2019
1 parent 22362d2 commit d934cf3
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 44 deletions.
4 changes: 0 additions & 4 deletions src/persistence/offlinemsgengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,6 @@ void OfflineMsgEngine::deliverOfflineMsgs()
{
QMutexLocker ml(&mutex);

if (!Settings::getInstance().getFauxOfflineMessaging()) {
return;
}

if (!f->isOnline()) {
return;
}
Expand Down
18 changes: 0 additions & 18 deletions src/persistence/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ void Settings::loadGlobal()
checkUpdates = s.value("checkUpdates", true).toBool();
notifySound = s.value("notifySound", true).toBool(); // note: notifySound and busySound UI elements are now under UI settings
busySound = s.value("busySound", false).toBool(); // page, but kept under General in settings file to be backwards compatible
fauxOfflineMessaging = s.value("fauxOfflineMessaging", true).toBool();
autoSaveEnabled = s.value("autoSaveEnabled", false).toBool();
globalAutoAcceptDir = s.value("globalAutoAcceptDir",
QStandardPaths::locate(QStandardPaths::HomeLocation, QString(),
Expand Down Expand Up @@ -436,7 +435,6 @@ void Settings::saveGlobal()
s.setValue("checkUpdates", checkUpdates);
s.setValue("notifySound", notifySound);
s.setValue("busySound", busySound);
s.setValue("fauxOfflineMessaging", fauxOfflineMessaging);
s.setValue("autoSaveEnabled", autoSaveEnabled);
s.setValue("autoAcceptMaxSize", static_cast<qlonglong>(autoAcceptMaxSize));
s.setValue("globalAutoAcceptDir", globalAutoAcceptDir);
Expand Down Expand Up @@ -2062,22 +2060,6 @@ void Settings::removeFriendSettings(const ToxPk& id)
friendLst.remove(id.getByteArray());
}

bool Settings::getFauxOfflineMessaging() const
{
QMutexLocker locker{&bigLock};
return fauxOfflineMessaging;
}

void Settings::setFauxOfflineMessaging(bool value)
{
QMutexLocker locker{&bigLock};

if (value != fauxOfflineMessaging) {
fauxOfflineMessaging = value;
emit fauxOfflineMessagingChanged(fauxOfflineMessaging);
}
}

bool Settings::getCompactLayout() const
{
QMutexLocker locker{&bigLock};
Expand Down
5 changes: 0 additions & 5 deletions src/persistence/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ public slots:
void dateFormatChanged(const QString& format);
void statusChangeNotificationEnabledChanged(bool enabled);
void spellCheckingEnabledChanged(bool enabled);
void fauxOfflineMessagingChanged(bool enabled);

// Privacy
void typingNotificationChanged(bool enabled);
Expand Down Expand Up @@ -516,9 +515,6 @@ public slots:
SIGNAL_IMPL(Settings, autoAcceptDirChanged, const ToxPk& id, const QString& dir)
SIGNAL_IMPL(Settings, contactNoteChanged, const ToxPk& id, const QString& note)

bool getFauxOfflineMessaging() const;
void setFauxOfflineMessaging(bool value);

bool getCompactLayout() const;
void setCompactLayout(bool compact);

Expand Down Expand Up @@ -600,7 +596,6 @@ public slots:
bool dontShowDhtDialog;

bool autoLogin;
bool fauxOfflineMessaging;
bool compactLayout;
FriendListSortingMode sortingMode;
bool groupchatPosition;
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 @@ -1141,7 +1141,7 @@ void ChatForm::SendMessageStr(QString msg)
QString selfPk = Core::getInstance()->getSelfId().toString();
QString pk = f->getPublicKey().toString();
QString name = Core::getInstance()->getUsername();
bool isSent = !Settings::getInstance().getFauxOfflineMessaging();
bool const isSent = false; // This forces history to add it to the offline messages table
history->addNewMessage(pk, historyPart, selfPk, timestamp, isSent, name,
[messageSent, offMsgEngine, receipt, ma](RowId id) {
if (messageSent) {
Expand Down
6 changes: 0 additions & 6 deletions src/widget/form/settings/generalform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ GeneralForm::GeneralForm(SettingsWidget* myParent)
bodyUI->closeToTray->setEnabled(showSystemTray);

bodyUI->statusChanges->setChecked(s.getStatusChangeNotificationEnabled());
bodyUI->cbFauxOfflineMessaging->setChecked(s.getFauxOfflineMessaging());

bodyUI->autoAwaySpinBox->setValue(s.getAutoAwayTime());
bodyUI->autoSaveFilesDir->setText(s.getGlobalAutoAcceptDir());
Expand Down Expand Up @@ -217,11 +216,6 @@ void GeneralForm::on_statusChanges_stateChanged()
Settings::getInstance().setStatusChangeNotificationEnabled(bodyUI->statusChanges->isChecked());
}

void GeneralForm::on_cbFauxOfflineMessaging_stateChanged()
{
Settings::getInstance().setFauxOfflineMessaging(bodyUI->cbFauxOfflineMessaging->isChecked());
}

void GeneralForm::on_autoAwaySpinBox_editingFinished()
{
int minutes = bodyUI->autoAwaySpinBox->value();
Expand Down
2 changes: 0 additions & 2 deletions src/widget/form/settings/generalform.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ private slots:
void on_autoAwaySpinBox_editingFinished();
void on_minimizeToTray_stateChanged();
void on_statusChanges_stateChanged();
void on_cbFauxOfflineMessaging_stateChanged();

void on_autoacceptFiles_stateChanged();
void on_maxAutoAcceptSizeMB_editingFinished();
void on_autoSaveFilesDir_clicked();
Expand Down
8 changes: 0 additions & 8 deletions src/widget/form/settings/generalsettings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,6 @@ instead of closing itself.</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbFauxOfflineMessaging">
<property name="text">
<string>Faux offline messaging</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
Expand Down Expand Up @@ -371,7 +364,6 @@ instead of closing itself.</string>
<tabstop>minimizeToTray</tabstop>
<tabstop>closeToTray</tabstop>
<tabstop>statusChanges</tabstop>
<tabstop>cbFauxOfflineMessaging</tabstop>
<tabstop>autoAwaySpinBox</tabstop>
<tabstop>autoSaveFilesDir</tabstop>
<tabstop>autoacceptFiles</tabstop>
Expand Down

0 comments on commit d934cf3

Please sign in to comment.