File: wvpopclient.h

package info (click to toggle)
retchmail 1%3A1.1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 256 kB
  • ctags: 156
  • sloc: cpp: 854; makefile: 73
file content (84 lines) | stat: -rw-r--r-- 2,185 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 * Worldvisions Weaver Software:
 *   Copyright (C) 1997-2003 Net Integration Technologies, Inc.
 *
 * Avery's insanely fast alternative to Fetchmail -- Pop3 Client
 *
 * This code is LGPL - see the file COPYING.LIB for a full copy of the
 * license.
 */

#include "wvsendmail.h"
#include "wvstreamclone.h"
#include "wvstring.h"
#include "wvhashtable.h"
#include "wvlog.h"
#include "wvvector.h"

#ifndef WVPOPCLIENT_H
#define WVPOPCLIENT_H 1

DeclareWvDict(WvSendmailProc, int, count);

class WvPopClient : public WvStreamClone
{
public:
    WvSendmailProcDict sendprocs;
    WvString username, password, deliverto, mda;
    WvLog log;
    long res1, res2;
    int  next_req, next_ack, sendmails;
    bool flushing, apop_enable, apop_enable_fallback, explode;
    WvStringList trace;

    bool safemode;
    int max_requests;
    WvStringList safe_deletes;

    bool ignorerp;
    
    struct MsgInfo
    {
	int num;                // message number
	long len;               // message length (bytes)
	bool sent,              // message _fully_ transferred to sendmail
	     deleted;           // server acknowledged DELE command
	WvString err;		// error message
	int deletes_after_this; // number of DELE messages following this RETR

	MsgInfo()
	  : num(0), len(0), sent(false), deleted(false),
	    deletes_after_this(0)
	{
	}
    };
    DeclareWvVector(MsgInfo);
    MsgInfoVector mess;

    // note: we take possession of 'conn' and may delete it at any time!
    WvPopClient(WvStream *conn,
		WvStringParm acct, WvStringParm _password,
		WvStringParm _deliverto, WvStringParm _mda, 
		bool _flushing, bool _apop_enable,
                bool _apop_enable_fallback, bool _explode,
		bool _safemode, bool _ignorerp);
    virtual ~WvPopClient();

    bool never_select;
    virtual void pre_select(SelectInfo &si);
    virtual bool post_select(SelectInfo &si);
    virtual void execute();
    
    void cmd(WvStringParm s);
    void cmd(WVSTRING_FORMAT_DECL)
	{ return cmd(WvString(WVSTRING_FORMAT_CALL)); }
    bool response();
    
    void send_done(int count, bool success);

private:
    WvString acctparse(WvStringParm acct);
    bool not_found;
};

#endif // WVPOPCLIENT_H