2 * Copyright 2007-2015, Haiku, Inc. All rights reserved.
3 * Copyright 2001-2002 Dr. Zoidberg Enterprises. All rights reserved.
4 * Copyright 2011, Clemens Zeidler <haiku@clemens-zeidler.de>
5 * Distributed under the terms of the MIT License.
7 #ifndef MAIL_DAEMON_APPLICATION_H
8 #define MAIL_DAEMON_APPLICATION_H
13 #include <ObjectList.h>
15 #include <MessageRunner.h>
21 #include <MailProtocol.h>
23 #include "LEDAnimation.h"
24 #include "DefaultNotifier.h"
28 struct send_mails_info
;
31 struct account_protocols
{
34 image_id inboundImage
;
35 BInboundMailProtocol
* inboundProtocol
;
36 image_id outboundImage
;
37 BOutboundMailProtocol
* outboundProtocol
;
41 typedef std::map
<int32
, account_protocols
> AccountMap
;
44 class MailDaemonApplication
: public BServer
{
46 MailDaemonApplication();
47 virtual ~MailDaemonApplication();
49 virtual void ReadyToRun();
50 virtual void RefsReceived(BMessage
* message
);
51 virtual void MessageReceived(BMessage
* message
);
54 virtual bool QuitRequested();
56 void InstallDeskbarIcon();
57 void RemoveDeskbarIcon();
59 void GetNewMessages(BMessage
* message
);
60 void SendPendingMessages(BMessage
* message
);
62 void MakeMimeTypes(bool remakeMIMETypes
= false);
66 void _InitAccount(BMailAccountSettings
& settings
);
67 void _ReloadAccounts(BMessage
* message
);
69 const account_protocols
& account
);
71 BInboundMailProtocol
* _CreateInboundProtocol(
72 BMailAccountSettings
& settings
,
74 BOutboundMailProtocol
* _CreateOutboundProtocol(
75 BMailAccountSettings
& settings
,
78 BInboundMailProtocol
* _InboundProtocol(int32 account
);
79 BOutboundMailProtocol
* _OutboundProtocol(int32 account
);
81 void _InitNewMessagesCount();
82 void _UpdateNewMessagesNotification();
83 void _UpdateAutoCheckRunner();
85 void _AddMessage(send_mails_info
& info
,
86 const BEntry
& entry
, const BNode
& node
);
88 static bool _IsPending(BNode
& node
);
89 static bool _IsEntryInTrash(BEntry
& entry
);
92 BMessageRunner
* fAutoCheckRunner
;
93 BMailSettings fSettingsFile
;
97 // TRUE to do a beep when the status window closes. This happens
98 // when all mail has been received, so you get one beep for
99 // everything rather than individual beeps for each mail
101 // Set to TRUE by the 'mcbp' message that the mail Notification
102 // filter sends us, cleared when the beep is done.
103 BObjectList
<BMessage
> fFetchDoneRespondents
;
104 BObjectList
<BQuery
> fQueries
;
106 LEDAnimation
* fLEDAnimation
;
108 BString fAlertString
;
110 AccountMap fAccounts
;
112 ErrorLogWindow
* fErrorLogWindow
;
113 BNotification
* fNotification
;
117 #endif // MAIL_DAEMON_APPLICATION_H