MailFilter.h revision 146357b5
1/*
2 * Copyright 2011-2012, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef _MAIL_FILTER_H
6#define _MAIL_FILTER_H
7
8
9#include "MailProtocol.h"
10#include "MailSettings.h"
11
12
13class BMailProtocol;
14class BView;
15
16
17class BMailFilter {
18public:
19								BMailFilter(BMailProtocol& protocol,
20									BMailAddOnSettings* settings);
21	virtual						~BMailFilter();
22
23	virtual BString				DescriptiveName() const = 0;
24
25	// Message hooks if filter is installed to an inbound protocol
26	virtual	void				HeaderFetched(const entry_ref& ref,
27									BFile* file);
28	virtual	void				BodyFetched(const entry_ref& ref, BFile* file);
29	virtual void				MailboxSynchronized(status_t status);
30
31	// Message hooks if filter is installed to an outbound protocol
32	virtual	void				MessageReadyToSend(const entry_ref& ref,
33									BFile* file);
34	virtual	void				MessageSent(const entry_ref& ref,
35									BFile* file);
36
37protected:
38			BMailProtocol&		fMailProtocol;
39			BMailAddOnSettings*	fSettings;
40};
41
42
43// Your filter needs to export these hooks in order to be picked up
44extern "C" BView* instantiate_filter_config_panel(BMailAddOnSettings& settings);
45extern "C" BMailFilter* instantiate_filter(BMailProtocol& protocol,
46	BMailAddOnSettings* settings);
47extern "C" BString filter_name();
48
49
50#endif	// _MAIL_FILTER_H
51