2 * Copyright 2013-2016, Axel Dörfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT License.
5 #ifndef IMAP_PROTOCOL_H
6 #define IMAP_PROTOCOL_H
11 #include <MailProtocol.h>
12 #include <ObjectList.h>
20 class IMAPConnectionWorker
;
27 typedef std::map
<BString
, IMAPFolder
*> FolderMap
;
30 class IMAPProtocol
: public BInboundMailProtocol
{
33 const BMailAccountSettings
& settings
);
34 virtual ~IMAPProtocol();
36 status_t
CheckSubscribedFolders(
37 IMAP::Protocol
& protocol
, bool idle
);
38 void WorkerQuit(IMAPConnectionWorker
* worker
);
40 void MessageStored(IMAPFolder
& folder
,
41 entry_ref
& ref
, BFile
& stream
,
42 uint32 fetchFlags
, BMessage
& attributes
);
44 status_t
UpdateMessageFlags(IMAPFolder
& folder
,
45 uint32 uid
, uint32 flags
);
47 virtual status_t
SyncMessages();
48 virtual status_t
MarkMessageAsRead(const entry_ref
& ref
,
49 read_flags flags
= B_READ
);
51 virtual void MessageReceived(BMessage
* message
);
54 virtual status_t
HandleFetchBody(const entry_ref
& ref
,
55 const BMessenger
& replyTo
);
60 IMAPFolder
* _CreateFolder(const BString
& mailbox
,
61 const BString
& separator
);
62 IMAPFolder
* _FolderFor(ino_t directory
);
63 status_t
_EnqueueCheckMailboxes();
66 typedef std::map
<IMAPFolder
*, IMAPConnectionWorker
*> WorkerMap
;
67 typedef std::map
<ino_t
, IMAPFolder
*> FolderNodeMap
;
71 BObjectList
<IMAPConnectionWorker
> fWorkers
;
74 FolderNodeMap fFolderNodeMap
;
78 #endif // IMAP_PROTOCOL_H