1 // Copyright 2009 The Archiveopteryx Developers <info@aox.org>
2 
3 #ifndef MESSAGE_H
4 #define MESSAGE_H
5 
6 #include "estringlist.h"
7 #include "multipart.h"
8 #include "header.h"
9 
10 
11 class EventHandler;
12 class Bodypart;
13 class Mailbox;
14 class EString;
15 
16 
17 class Message
18     : public Multipart
19 {
20 public:
21     Message();
22 
23     void parse( const EString & );
24 
25     bool valid() const;
26     EString error() const;
27     void recomputeError();
28 
29     EString rfc822( bool ) const;
30     EString body( bool ) const;
31 
32     void setWrapped( bool ) const;
33     bool isWrapped() const;
34 
35     void setDatabaseId( uint );
36     uint databaseId() const;
37 
38     void setThreadId( uint );
39     uint threadId() const;
40 
41     bool isMessage() const;
42 
43     Bodypart * bodypart( const EString &, bool create = false );
44     EString partNumber( Bodypart * ) const;
45 
46     List<Bodypart> * allBodyparts() const;
47 
48     void setRfc822Size( uint );
49     uint rfc822Size() const;
50     void setInternalDate( uint );
51     uint internalDate() const;
52 
53     bool hasHeaders() const;
54     void setHeadersFetched();
55     bool hasAddresses() const;
56     void setAddressesFetched();
57     bool hasTrivia() const;
58     void setTriviaFetched( bool );
59     bool hasBodies() const;
60     void setBodiesFetched();
61     bool hasBytesAndLines() const;
62     void setBytesAndLinesFetched();
63 
64     static UString baseSubject( const UString & );
65 
66     static EString acceptableBoundary( const EString & );
67 
68     void addMessageId( const EString & );
69 
70     static Header * parseHeader( uint &, uint, const EString &, Header::Mode );
71 
72 private:
73     void fix8BitHeaderFields();
74 
75 private:
76     class MessageData * d;
77     friend class MessageBodyFetcher;
78 };
79 
80 
81 #endif
82