mirror of
https://review.haiku-os.org/haiku
synced 2025-01-31 10:47:14 +01:00
Mail server: fix disabling notifications
* The default notifier didn't always take the setting into account. * The mail server was not using the setting from the settings file and instead waiting for a message that wasn't sent anywhere. Fixes #10852.
This commit is contained in:
parent
d8853b4953
commit
0b90f99bc3
@ -22,7 +22,6 @@ const uint32 kMsgCheckMessage = 'mnow';
|
||||
const uint32 kMsgSendMessages = 'msnd';
|
||||
const uint32 kMsgSettingsUpdated = 'mrrs';
|
||||
const uint32 kMsgAccountsChanged = 'macc';
|
||||
const uint32 kMsgSetStatusWindowMode = 'shst';
|
||||
const uint32 kMsgCountNewMessages = 'mnum';
|
||||
const uint32 kMsgMarkMessageAsRead = 'mmar';
|
||||
const uint32 kMsgFetchBody = 'mfeb';
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
|
||||
DefaultNotifier::DefaultNotifier(const char* accountName, bool inbound,
|
||||
ErrorLogWindow* errorWindow, uint32& showMode)
|
||||
ErrorLogWindow* errorWindow, uint32 showMode)
|
||||
:
|
||||
fAccountName(accountName),
|
||||
fIsInbound(inbound),
|
||||
@ -131,11 +131,7 @@ DefaultNotifier::ReportProgress(uint32 messages, uint64 bytes,
|
||||
if (fItemsDone == fTotalItems && fTotalItems != 0)
|
||||
timeout = 1; // We're done, make the window go away faster
|
||||
|
||||
if ((!fIsInbound
|
||||
&& (fShowMode & B_MAIL_SHOW_STATUS_WINDOW_WHEN_SENDING) != 0)
|
||||
|| (fIsInbound
|
||||
&& (fShowMode & B_MAIL_SHOW_STATUS_WINDOW_WHEN_ACTIVE) != 0))
|
||||
fNotification.Send(timeout);
|
||||
_NotifyIfAllowed(timeout);
|
||||
}
|
||||
|
||||
|
||||
@ -145,5 +141,19 @@ DefaultNotifier::ResetProgress(const char* message)
|
||||
fNotification.SetProgress(0);
|
||||
if (message != NULL)
|
||||
fNotification.SetTitle(message);
|
||||
fNotification.Send(0);
|
||||
_NotifyIfAllowed();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DefaultNotifier::_NotifyIfAllowed(int timeout)
|
||||
{
|
||||
int32 flag;
|
||||
if (fIsInbound)
|
||||
flag = B_MAIL_SHOW_STATUS_WINDOW_WHEN_ACTIVE;
|
||||
else
|
||||
flag = B_MAIL_SHOW_STATUS_WINDOW_WHEN_SENDING;
|
||||
|
||||
if ((fShowMode & flag) != 0)
|
||||
fNotification.Send(timeout);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ class DefaultNotifier : public BMailNotifier {
|
||||
public:
|
||||
DefaultNotifier(const char* accountName,
|
||||
bool inbound, ErrorLogWindow* errorWindow,
|
||||
uint32& showMode);
|
||||
uint32 showMode);
|
||||
~DefaultNotifier();
|
||||
|
||||
BMailNotifier* Clone();
|
||||
@ -34,6 +34,9 @@ public:
|
||||
const char* message = NULL);
|
||||
void ResetProgress(const char* message = NULL);
|
||||
|
||||
private:
|
||||
void _NotifyIfAllowed(int timeout = 0);
|
||||
|
||||
private:
|
||||
BString fAccountName;
|
||||
bool fIsInbound;
|
||||
|
@ -305,14 +305,6 @@ MailDaemonApplication::MessageReceived(BMessage* msg)
|
||||
_ReloadAccounts(msg);
|
||||
break;
|
||||
|
||||
case kMsgSetStatusWindowMode: // when to show the status window
|
||||
{
|
||||
int32 mode;
|
||||
if (msg->FindInt32("ShowStatusWindow", &mode) == B_OK)
|
||||
fNotifyMode = mode;
|
||||
break;
|
||||
}
|
||||
|
||||
case kMsgMarkMessageAsRead:
|
||||
{
|
||||
int32 account = msg->FindInt32("account");
|
||||
@ -413,7 +405,8 @@ MailDaemonApplication::MessageReceived(BMessage* msg)
|
||||
|
||||
_UpdateNewMessagesNotification();
|
||||
|
||||
if (fNotifyMode != B_MAIL_SHOW_STATUS_WINDOW_NEVER)
|
||||
if (fSettingsFile.ShowStatusWindow()
|
||||
!= B_MAIL_SHOW_STATUS_WINDOW_NEVER)
|
||||
fNotification->Send();
|
||||
break;
|
||||
}
|
||||
@ -654,7 +647,7 @@ MailDaemonApplication::_InitAccount(BMailAccountSettings& settings)
|
||||
}
|
||||
if (account.inboundProtocol != NULL) {
|
||||
DefaultNotifier* notifier = new DefaultNotifier(settings.Name(), true,
|
||||
fErrorLogWindow, fNotifyMode);
|
||||
fErrorLogWindow, fSettingsFile.ShowStatusWindow());
|
||||
account.inboundProtocol->SetMailNotifier(notifier);
|
||||
account.inboundProtocol->Run();
|
||||
}
|
||||
@ -666,7 +659,7 @@ MailDaemonApplication::_InitAccount(BMailAccountSettings& settings)
|
||||
}
|
||||
if (account.outboundProtocol != NULL) {
|
||||
DefaultNotifier* notifier = new DefaultNotifier(settings.Name(), false,
|
||||
fErrorLogWindow, fNotifyMode);
|
||||
fErrorLogWindow, fSettingsFile.ShowStatusWindow());
|
||||
account.outboundProtocol->SetMailNotifier(notifier);
|
||||
account.outboundProtocol->Run();
|
||||
}
|
||||
|
@ -111,7 +111,6 @@ private:
|
||||
|
||||
ErrorLogWindow* fErrorLogWindow;
|
||||
BNotification* fNotification;
|
||||
uint32 fNotifyMode;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user