summaryrefslogtreecommitdiffstats
path: root/maildrop/rematchmsg.h
blob: 8b6360c31e072ea23f6fa8bf61f12cf22ec5287f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef	rematchmsg_h
#define	rematchmsg_h


class Message;

#include	"config.h"
#include	<sys/types.h>
// #include	<unistd.h>
#include	"rematch.h"

/////////////////////////////////////////////////////////////////////////////
//
// ReMatchMsg - match regular expression against the message directly.
//
// This class is derived from ReMatch, and is used when a regular expression
// should be matched against the message directly.
// It defines the virtual functions from ReMatch to go against the Message
// class itself.
//
// The constructor takes two flags:  headeronly, and mergelines.
// "headeronly" forces and end-of-file condition when a blank line is found
// in the message.  "mergelines" causes a newline character to be silently
// eaten, when it is immediately followed by a space.  The flags must be
// set as follows, in the following situations:
//
// A)  Match header and body:  mergelines is true, headeronly is false
// B)  Match header only:      mergelines is true, headeronly is true
// C)  Match body only:        mergelines is false, headeronly is false,
//                             also the message must be seeked to the
//                             start of the message contents.
//
/////////////////////////////////////////////////////////////////////////////

class ReMatchMsg : public ReMatch {
	Message *msg;

	int header_only, mergelines;
	int eof;
	int lastc;

	off_t end_headers;
	off_t start;
public:
	ReMatchMsg(Message *m, int flag, int flag2);
	virtual ~ReMatchMsg();

	int NextChar();
	int CurrentChar();
	off_t GetCurrentPos();
	void SetCurrentPos(off_t);
} ;
#endif