File: rematchmsg.h

package info (click to toggle)
maildrop 0.54a-2
  • links: PTS
  • area: main
  • in suites: slink
  • size: 872 kB
  • ctags: 883
  • sloc: cpp: 8,469; ansic: 658; sh: 327; makefile: 82
file content (63 lines) | stat: -rw-r--r-- 2,430 bytes parent folder | download
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
54
55
56
57
58
59
60
61
62
63
/* DSTART                                                                    */
/*                                                                           */
/*           maildrop - mail delivery agent with filtering abilities         */
/*                                                                           */
/*  Copyright 1998, Double Precision Inc.                                    */
/*                                                                           */
/*  This program is distributed under the terms of the GNU General Public    */
/*  License. See COPYING for additional information.                         */
/* DEND                                                                      */
#ifndef	rematchmsg_h
#define	rematchmsg_h

static const char rematchmsg_h_rcsid[]="$Id: rematchmsg.h 1.1 1998/04/17 00:08:53 mrsam Exp $";

class Message;

#include	<sys/types.h>
// #include	<unistd.h>
#include	"rematch.h"
#include	"autoconf.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