forked from PowerDNS/powermail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
imapsession.hh
75 lines (63 loc) · 2.21 KB
/
imapsession.hh
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
/*
PowerMail versatile mail receiver
Copyright (C) 2002 PowerDNS.COM BV
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef IMAPSESSION_HH
#define IMAPSESSION_HH
#include "delivery.hh"
#include "pptalker.hh"
#include "megatalker.hh"
#include <string>
#include <vector>
#include "session.hh"
using namespace std;
class IMAPSession
{
public:
IMAPSession(Session *session,string remote) : d_remote(remote),d_login(false),
d_scanned(false), d_megatalker(0),
d_session(session), d_retrieved(0),
d_deleted(0) {}
~IMAPSession();
enum quit_t {noQuit, quitNow,pleaseQuit, pleaseDie};
bool giveLine(string &line, string &response, quit_t &quit, int &fd);
string getBanner();
private:
bool topCommands(const string &line, string &response, quit_t &quit);
bool unauthCommands(const string &command, const string &line, string &response, quit_t &quit);
bool unSelectedCommands(const string &command, const string &line, string &response, quit_t &quit);
bool controlCommands(const string &line, string &response, quit_t &quit);
bool restCommands(const string &line, string &response, quit_t &quit, int &fd);
void strip(string &line);
void firstWordUC(string &line);
int delDeleted(string &response);
int scanDir(string &response);
string d_remote;
string d_user;
bool d_login;
string d_dir;
string d_selected;
struct MsgDatum {
string d_fname;
bool d_deleted;
size_t d_size;
};
typedef vector<MsgDatum> msgData_t;
msgData_t d_msgData;
bool d_scanned;
MegaTalker *d_megatalker;
Session* d_session;
int d_retrieved;
int d_deleted;
};
#endif /* SMTPSESSION_HH */