E-mail: Stop the mail_daemon if there are no accounts left.

* This fixes part of #12347.
This commit is contained in:
Axel Dörfler 2016-02-04 21:03:27 +01:00
parent 1f105f6750
commit 9cbc5b82c2

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2007-2015 Haiku, Inc. All rights reserved. * Copyright 2007-2016 Haiku, Inc. All rights reserved.
* Copyright 2001-2003 Dr. Zoidberg Enterprises. All rights reserved. * Copyright 2001-2003 Dr. Zoidberg Enterprises. All rights reserved.
* *
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
@ -499,10 +499,14 @@ ConfigWindow::_SaveSettings()
messenger.SendMessage(&changedAccounts); messenger.SendMessage(&changedAccounts);
} }
// Start the mail_daemon if auto start was selected // Start/stop the mail_daemon depending on the settings
BMailDaemon daemon; BMailDaemon daemon;
if (fSaveSettings && settings.DaemonAutoStarts() && !daemon.IsRunning()) if (fSaveSettings) {
daemon.Launch(); if (settings.DaemonAutoStarts() && !daemon.IsRunning())
daemon.Launch();
else if (!settings.DaemonAutoStarts() && daemon.IsRunning())
daemon.Quit();
}
} }