MailFilter.h revision ca3341c7
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 BMailSettingsView;
15
16
17class BMailFilter {
18public:
19								BMailFilter(BMailProtocol& protocol,
20									const BMailAddOnSettings* settings);
21	virtual						~BMailFilter();
22
23	// Message hooks if filter is installed to an inbound protocol
24	virtual	void				HeaderFetched(const entry_ref& ref,
25									BFile* file);
26	virtual	void				BodyFetched(const entry_ref& ref, BFile* file);
27	virtual void				MailboxSynchronized(status_t status);
28
29	// Message hooks if filter is installed to an outbound protocol
30	virtual	void				MessageReadyToSend(const entry_ref& ref,
31									BFile* file);
32	virtual	void				MessageSent(const entry_ref& ref,
33									BFile* file);
34
35protected:
36			BMailProtocol&		fMailProtocol;
37			const BMailAddOnSettings* fSettings;
38};
39
40
41// Your filter needs to export these hooks in order to be picked up
42extern "C" BMailSettingsView* instantiate_filter_settings_view(
43	const BMailAccountSettings& accountSettings,
44	const BMailAddOnSettings& settings);
45extern "C" BString filter_name(const BMailAccountSettings& accountSettings,
46	const BMailAddOnSettings* settings);
47extern "C" BMailFilter* instantiate_filter(BMailProtocol& protocol,
48	const BMailAddOnSettings& settings);
49
50
51#endif	// _MAIL_FILTER_H
52