summaryrefslogtreecommitdiff
path: root/tools/libskrewt.h
blob: cfbbb79ae20b1b286a89d92e0c860899f216a51f (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
#include <string>
#include <vector>
#include <iostream>
#include "sepofra.h"
#include "qq_exit_codes.h"              // a bit of a kludge
extern std::string progid;

class skrewt{
public:
  std::string received_from;         // envelope HELO among other things
    std::string proximta_HELO;
    std::string proximta_rDNS;
    std::string proximta_IP;
    std::string proximta_AuthUser;
  std::string return_path;           // envelope MAIL FROM
  std::string boundary;
  std::string to;
  std::string from;
  std::string subject;
  std::string date;
  std::string message_id;
  std::string content_type;
  std::string delivered_to;
  int msgsize;
  std::vector<std::string> bigbuf;
  int saw_blank_line;
  int recno;

  int maxsize;
  int error_exit;
  int mid_required;

  // constructor
  skrewt()
  : boundary("x-xx-x"), msgsize(0), saw_blank_line(0), recno(0),
    maxsize(1000*1000), error_exit(0), mid_required(0)
  {}

  int headers(std::istream& xin);
  int dump_headers(std::ostream& xout);
  int interstage();
  int body(std::istream& xin, std::ostream& xout);
  int krunch_rfrom();
};

void parse_content(const std::string type_spec_line,
        std::string &maintype, std::string &boundary);

void exeunt(const int sts);
void maybe_exeunt(const int sts, const int really);