1/*
2 * Copyright 2011-2013, 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_LISTENER_H
7#define IMAP_LISTENER_H
8
9
10#include <MailFilter.h>
11#include <String.h>
12
13
14class HaikuMailFormatFilter : public BMailFilter {
15public:
16								HaikuMailFormatFilter(BMailProtocol& protocol,
17									const BMailAccountSettings& settings);
18
19	virtual BString				DescriptiveName() const;
20
21			BMailFilterAction	HeaderFetched(entry_ref& ref, BFile& file,
22									BMessage& attributes);
23			void				BodyFetched(const entry_ref& ref, BFile& file,
24									BMessage& attributes);
25
26			void				MessageSent(const entry_ref& ref, BFile& file);
27
28private:
29			void				_RemoveExtraWhitespace(BString& name);
30			void				_RemoveLeadingDots(BString& name);
31			BString				_ExtractName(const BString& from);
32			status_t			_SetType(BMessage& attributes,
33									const char* mimeType);
34
35private:
36			int32				fAccountID;
37			BString				fAccountName;
38			BString				fOutboundDirectory;
39};
40
41
42#endif // IMAP_LISTENER_H
43