mail_daemon: auto check message was leaked, send immediately.

* BMessageRunner does not take ownership of the message.
* Instead of waiting through the complete interval, we send an auto check
  message immediately after launch (or whenever else the timer is being
  started).
* Added constant instead of referring to 'moto' for the auto check message.
This commit is contained in:
Axel Dörfler 2013-03-25 00:00:18 +01:00
parent c67313f3c3
commit 4cab719ff2

View File

@ -40,6 +40,9 @@
#define B_TRANSLATION_CONTEXT "MailDaemon"
static const uint32 kMsgAutoCheck = 'moto';
struct send_mails_info {
send_mails_info()
{
@ -302,10 +305,8 @@ void
MailDaemonApplication::MessageReceived(BMessage* msg)
{
switch (msg->what) {
case 'moto':
if (fSettingsFile.CheckOnlyIfPPPUp()) {
// TODO: check whether internet is up and running!
}
case kMsgAutoCheck:
// TODO: check whether internet is up and running!
// supposed to fall through
case kMsgCheckAndSend: // check & send messages
msg->what = kMsgSendMessages;
@ -832,8 +833,13 @@ MailDaemonApplication::_UpdateAutoCheck(bigtime_t interval)
fAutoCheckRunner->SetInterval(interval);
fAutoCheckRunner->SetCount(-1);
} else {
fAutoCheckRunner = new BMessageRunner(be_app_messenger,
new BMessage('moto'), interval);
BMessage update(kMsgAutoCheck);
fAutoCheckRunner = new BMessageRunner(be_app_messenger, &update,
interval);
// Send one right away -- the message runner will wait until the
// first interval has passed before sending a message
PostMessage(&update);
}
} else {
delete fAutoCheckRunner;