1/*
2 * Copyright 2011, Haiku, Inc. All rights reserved.
3 * Copyright 2011, Clemens Zeidler <haiku@clemens-zeidler.de>
4 * Distributed under the terms of the MIT License.
5 */
6#ifndef IMAP_ROOT_INBOUND_PROTOCOL_H
7#define IMAP_ROOT_INBOUND_PROTOCOL_H
8
9
10#include "IMAPInboundProtocol.h"
11
12#include "MailAddon.h"
13
14
15typedef BObjectList<InboundProtocolThread> ProtocolThreadList;
16
17
18/*! Hold the main INBOX mailbox and manage all the other other mailboxes. */
19class IMAPRootInboundProtocol : public IMAPInboundProtocol {
20public:
21								IMAPRootInboundProtocol(
22									BMailAccountSettings* settings);
23								~IMAPRootInboundProtocol();
24
25			//! thread safe interface
26			status_t			Connect(const char* server,
27									const char* username, const char* password,
28									bool useSSL = true, int32 port = -1);
29			status_t			Disconnect();
30
31			void				SetStopNow();
32
33			status_t			SyncMessages();
34			status_t			FetchBody(const entry_ref& ref);
35			status_t			MarkMessageAsRead(const entry_ref& ref,
36									read_flags flag = B_READ);
37
38			status_t			DeleteMessage(const entry_ref& ref);
39			status_t			AppendMessage(const entry_ref& ref);
40
41			status_t			DeleteMessage(node_ref& node);
42
43private:
44			void				_ShutdownChilds();
45			InboundProtocolThread*	_FindThreadFor(const entry_ref& ref);
46
47			ProtocolThreadList	fProtocolThreadList;
48};
49
50
51#endif // IMAP_ROOT_INBOUND_PROTOCOL_H
52