blob: 25a94f1e89fa5a796e7e725970dcbd0a5f95227b (
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
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
85
|
/* $Id: Summary.h 1649 2009-10-19 14:35:01Z terpstra $
*
* Summary.h - Helper which can load a message given MessageId
*
* Copyright (C) 2002 - Wesley W. Terpstra
*
* License: GPL
*
* Authors: 'Wesley W. Terpstra' <wesley@terpstra.ca>
*
* 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; version 2.1.
*
* 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 SUMMARY_H
#define SUMMARY_H
#include <esort.h>
#include "MessageId.h"
#include "ConfigFile.h"
#include <set>
#include <sys/types.h> // off_t
#include <unistd.h>
class DwMessage;
using std::set;
using std::ostream;
using namespace ESort;
// Convert all linear white space into a single space
string whitespace_sanitize(const string& x);
class Summary
{
protected:
MessageId id_;
bool deleted_;
bool allowed_;
string author_email_;
string author_name_;
string subject_;
string mbox_;
off_t offset_;
unsigned long length_;
set<string> mboxs_;
public:
Summary() { }
Summary(const MessageId& id) : id_(id), deleted_(false), allowed_(true) { }
string load(Reader* r, const Config& cfg); // "" is success
bool loaded() const { return mbox_ != ""; }
bool deleted() const { return deleted_; }
bool allowed() const { return allowed_; }
const MessageId& id() const { return id_; }
const string& author_email() const { return author_email_; }
const string& author_name () const { return author_name_; }
const string& subject () const { return subject_; }
const set<string>& mboxs() const { return mboxs_; }
string message(const string& dbdir, DwMessage& out) const; // "" is success
bool operator < (const Summary& o) const { return id_ < o.id_; }
};
ostream& operator << (ostream& o, const Summary& s);
#endif
|