vfs: check userland buffers before reading them.
[haiku.git] / src / servers / mail / MailDaemonApplication.h
blobac465c316c926d3369d91ffe929ec7be8ad3016b
1 /*
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.
6 */
7 #ifndef MAIL_DAEMON_APPLICATION_H
8 #define MAIL_DAEMON_APPLICATION_H
11 #include <map>
13 #include <ObjectList.h>
14 #include <Message.h>
15 #include <MessageRunner.h>
16 #include <Node.h>
17 #include <Query.h>
18 #include <Server.h>
19 #include <String.h>
21 #include <MailProtocol.h>
23 #include "LEDAnimation.h"
24 #include "DefaultNotifier.h"
27 class BNotification;
28 struct send_mails_info;
31 struct account_protocols {
32 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 {
45 public:
46 MailDaemonApplication();
47 virtual ~MailDaemonApplication();
49 virtual void ReadyToRun();
50 virtual void RefsReceived(BMessage* message);
51 virtual void MessageReceived(BMessage* message);
53 virtual void Pulse();
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);
64 private:
65 void _InitAccounts();
66 void _InitAccount(BMailAccountSettings& settings);
67 void _ReloadAccounts(BMessage* message);
68 void _RemoveAccount(
69 const account_protocols& account);
71 BInboundMailProtocol* _CreateInboundProtocol(
72 BMailAccountSettings& settings,
73 image_id& image);
74 BOutboundMailProtocol* _CreateOutboundProtocol(
75 BMailAccountSettings& settings,
76 image_id& image);
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);
91 private:
92 BMessageRunner* fAutoCheckRunner;
93 BMailSettings fSettingsFile;
95 int32 fNewMessages;
96 bool fCentralBeep;
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
100 // account.
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