summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper/mailtypes.h
Unidiff
Diffstat (limited to 'kmicromail/libmailwrapper/mailtypes.h') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/mailtypes.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/kmicromail/libmailwrapper/mailtypes.h b/kmicromail/libmailwrapper/mailtypes.h
index c317880..020278d 100644
--- a/kmicromail/libmailwrapper/mailtypes.h
+++ b/kmicromail/libmailwrapper/mailtypes.h
@@ -1,171 +1,174 @@
1#ifndef __MAIL_TYPES_H 1#ifndef __MAIL_TYPES_H
2#define __MAIL_TYPES_H 2#define __MAIL_TYPES_H
3 3
4#define FLAG_ANSWERED 0 4#define FLAG_ANSWERED 0
5#define FLAG_FLAGGED 1 5#define FLAG_FLAGGED 1
6#define FLAG_DELETED 2 6#define FLAG_DELETED 2
7#define FLAG_SEEN 3 7#define FLAG_SEEN 3
8#define FLAG_DRAFT 4 8#define FLAG_DRAFT 4
9#define FLAG_RECENT 5 9#define FLAG_RECENT 5
10 10
11#include <opie2/osmartpointer.h> 11#include <opie2/osmartpointer.h>
12 12
13#include <qbitarray.h> 13#include <qbitarray.h>
14#include <qstring.h> 14#include <qstring.h>
15#include <qstringlist.h> 15#include <qstringlist.h>
16#include <qmap.h> 16#include <qmap.h>
17#include <qvaluelist.h> 17#include <qvaluelist.h>
18 18
19class AbstractMail; 19class AbstractMail;
20/* a class to describe mails in a mailbox */ 20/* a class to describe mails in a mailbox */
21/* Attention! 21/* Attention!
22 From programmers point of view it would make sense to 22 From programmers point of view it would make sense to
23 store the mail body into this class, too. 23 store the mail body into this class, too.
24 But: not from the point of view of the device. 24 But: not from the point of view of the device.
25 Mailbodies can be real large. So we request them when 25 Mailbodies can be real large. So we request them when
26 needed from the mail-wrapper class direct from the server itself 26 needed from the mail-wrapper class direct from the server itself
27 (imap) or from a file-based cache (pop3?) 27 (imap) or from a file-based cache (pop3?)
28 So there is no interface "const QString&body()" but you should 28 So there is no interface "const QString&body()" but you should
29 make a request to the mailwrapper with this class as parameter to 29 make a request to the mailwrapper with this class as parameter to
30 get the body. Same words for the attachments. 30 get the body. Same words for the attachments.
31*/ 31*/
32class RecMail:public Opie::Core::ORefCount 32class RecMail:public Opie::Core::ORefCount
33{ 33{
34public: 34public:
35 RecMail(); 35 RecMail();
36 RecMail(const RecMail&old); 36 RecMail(const RecMail&old);
37 virtual ~RecMail(); 37 virtual ~RecMail();
38 bool isEqual( RecMail* r1 );
38 39
39 const unsigned int getNumber()const{return msg_number;} 40 const unsigned int getNumber()const{return msg_number;}
40 void setNumber(unsigned int number){msg_number=number;} 41 void setNumber(unsigned int number){msg_number=number;}
41 const QString&getDate()const{ return date; } 42 const QString&getDate()const{ return date; }
42 void setDate( const QString&a ) { date = a; } 43 void setDate( const QString&a ) { date = a; }
44 const QString&getIsoDate()const{ return isodate; }
45 void setIsoDate( const QString&a ) { isodate = a; }
43 const QString&getFrom()const{ return from; } 46 const QString&getFrom()const{ return from; }
44 void setFrom( const QString&a ) { from = a; } 47 void setFrom( const QString&a ) { from = a; }
45 const QString&getSubject()const { return subject; } 48 const QString&getSubject()const { return subject; }
46 void setSubject( const QString&s ) { subject = s; } 49 void setSubject( const QString&s ) { subject = s; }
47 const QString&getMbox()const{return mbox;} 50 const QString&getMbox()const{return mbox;}
48 void setMbox(const QString&box){mbox = box;} 51 void setMbox(const QString&box){mbox = box;}
49 void setMsgid(const QString&id){msg_id=id;} 52 void setMsgid(const QString&id){msg_id=id;}
50 const QString&Msgid()const{return msg_id;} 53 const QString&Msgid()const{return msg_id;}
51 void setReplyto(const QString&reply){replyto=reply;} 54 void setReplyto(const QString&reply){replyto=reply;}
52 const QString&Replyto()const{return replyto;} 55 const QString&Replyto()const{return replyto;}
53 void setMsgsize(unsigned int size){msg_size = size;} 56 void setMsgsize(unsigned int size){msg_size = size;}
54 const unsigned int Msgsize()const{return msg_size;} 57 const unsigned int Msgsize()const{return msg_size;}
55 58
56 59
57 void setTo(const QStringList&list); 60 void setTo(const QStringList&list);
58 const QStringList&To()const; 61 const QStringList&To()const;
59 void setCC(const QStringList&list); 62 void setCC(const QStringList&list);
60 const QStringList&CC()const; 63 const QStringList&CC()const;
61 void setBcc(const QStringList&list); 64 void setBcc(const QStringList&list);
62 const QStringList&Bcc()const; 65 const QStringList&Bcc()const;
63 void setInreply(const QStringList&list); 66 void setInreply(const QStringList&list);
64 const QStringList&Inreply()const; 67 const QStringList&Inreply()const;
65 void setReferences(const QStringList&list); 68 void setReferences(const QStringList&list);
66 const QStringList&References()const; 69 const QStringList&References()const;
67 70
68 const QBitArray&getFlags()const{return msg_flags;} 71 const QBitArray&getFlags()const{return msg_flags;}
69 void setFlags(const QBitArray&flags){msg_flags = flags;} 72 void setFlags(const QBitArray&flags){msg_flags = flags;}
70 73
71 void setWrapper(AbstractMail*wrapper); 74 void setWrapper(AbstractMail*wrapper);
72 AbstractMail* Wrapper(); 75 AbstractMail* Wrapper();
73 76
74protected: 77protected:
75 QString subject,date,from,mbox,msg_id,replyto; 78 QString subject,date,isodate,from,mbox,msg_id,replyto;
76 unsigned int msg_number,msg_size; 79 unsigned int msg_number,msg_size;
77 QBitArray msg_flags; 80 QBitArray msg_flags;
78 QStringList to,cc,bcc,in_reply_to,references; 81 QStringList to,cc,bcc,in_reply_to,references;
79 AbstractMail*wrapper; 82 AbstractMail*wrapper;
80 void init(); 83 void init();
81 void copy_old(const RecMail&old); 84 void copy_old(const RecMail&old);
82}; 85};
83 86
84typedef Opie::Core::OSmartPointer<RecMail> RecMailP; 87typedef Opie::Core::OSmartPointer<RecMail> RecMailP;
85typedef QMap<QString,QString> part_plist_t; 88typedef QMap<QString,QString> part_plist_t;
86 89
87class RecPart:public Opie::Core::ORefCount 90class RecPart:public Opie::Core::ORefCount
88{ 91{
89protected: 92protected:
90 QString m_type,m_subtype,m_identifier,m_encoding,m_description; 93 QString m_type,m_subtype,m_identifier,m_encoding,m_description;
91 unsigned int m_lines,m_size; 94 unsigned int m_lines,m_size;
92 part_plist_t m_Parameters; 95 part_plist_t m_Parameters;
93 /* describes the position in the mail */ 96 /* describes the position in the mail */
94 QValueList<int> m_poslist; 97 QValueList<int> m_poslist;
95 98
96public: 99public:
97 RecPart(); 100 RecPart();
98 RecPart(const RecPart&); 101 RecPart(const RecPart&);
99 virtual ~RecPart(); 102 virtual ~RecPart();
100 103
101 const QString&Type()const; 104 const QString&Type()const;
102 void setType(const QString&type); 105 void setType(const QString&type);
103 const QString&Subtype()const; 106 const QString&Subtype()const;
104 void setSubtype(const QString&subtype); 107 void setSubtype(const QString&subtype);
105 const QString&Identifier()const; 108 const QString&Identifier()const;
106 void setIdentifier(const QString&identifier); 109 void setIdentifier(const QString&identifier);
107 const QString&Encoding()const; 110 const QString&Encoding()const;
108 void setEncoding(const QString&encoding); 111 void setEncoding(const QString&encoding);
109 const QString&Description()const; 112 const QString&Description()const;
110 void setDescription(const QString&desc); 113 void setDescription(const QString&desc);
111 void setLines(unsigned int lines); 114 void setLines(unsigned int lines);
112 const unsigned int Lines()const; 115 const unsigned int Lines()const;
113 void setSize(unsigned int size); 116 void setSize(unsigned int size);
114 const unsigned int Size()const; 117 const unsigned int Size()const;
115 118
116 119
117 void setParameters(const part_plist_t&list); 120 void setParameters(const part_plist_t&list);
118 const part_plist_t&Parameters()const; 121 const part_plist_t&Parameters()const;
119 void addParameter(const QString&key,const QString&value); 122 void addParameter(const QString&key,const QString&value);
120 const QString searchParamter(const QString&key)const; 123 const QString searchParamter(const QString&key)const;
121 void setPositionlist(const QValueList<int>&poslist); 124 void setPositionlist(const QValueList<int>&poslist);
122 const QValueList<int>& Positionlist()const; 125 const QValueList<int>& Positionlist()const;
123}; 126};
124 127
125typedef Opie::Core::OSmartPointer<RecPart> RecPartP; 128typedef Opie::Core::OSmartPointer<RecPart> RecPartP;
126 129
127class RecBody:public Opie::Core::ORefCount 130class RecBody:public Opie::Core::ORefCount
128{ 131{
129protected: 132protected:
130 QString m_BodyText; 133 QString m_BodyText;
131 QValueList<RecPartP> m_PartsList; 134 QValueList<RecPartP> m_PartsList;
132 RecPartP m_description; 135 RecPartP m_description;
133 136
134public: 137public:
135 RecBody(); 138 RecBody();
136 RecBody(const RecBody&old); 139 RecBody(const RecBody&old);
137 virtual ~RecBody(); 140 virtual ~RecBody();
138 void setBodytext(const QString&); 141 void setBodytext(const QString&);
139 const QString& Bodytext()const; 142 const QString& Bodytext()const;
140 143
141 void setDescription(const RecPartP&des); 144 void setDescription(const RecPartP&des);
142 const RecPartP& Description()const; 145 const RecPartP& Description()const;
143 146
144 void setParts(const QValueList<RecPartP>&parts); 147 void setParts(const QValueList<RecPartP>&parts);
145 const QValueList<RecPartP>& Parts()const; 148 const QValueList<RecPartP>& Parts()const;
146 void addPart(const RecPartP&part); 149 void addPart(const RecPartP&part);
147}; 150};
148 151
149typedef Opie::Core::OSmartPointer<RecBody> RecBodyP; 152typedef Opie::Core::OSmartPointer<RecBody> RecBodyP;
150 153
151class encodedString 154class encodedString
152{ 155{
153public: 156public:
154 encodedString(); 157 encodedString();
155 /* 158 /*
156 creates an new content string. 159 creates an new content string.
157 it makes a deep copy of it! 160 it makes a deep copy of it!
158 */ 161 */
159 encodedString(const char*nContent,unsigned int length); 162 encodedString(const char*nContent,unsigned int length);
160 /* 163 /*
161 Take over the nContent. Means: it will just copy the pointer, not the content. 164 Take over the nContent. Means: it will just copy the pointer, not the content.
162 so make sure: No one else frees the string, the string has allocated with 165 so make sure: No one else frees the string, the string has allocated with
163 malloc for compatibility with c-based libs 166 malloc for compatibility with c-based libs
164 */ 167 */
165 encodedString(char*nContent,unsigned int nSize); 168 encodedString(char*nContent,unsigned int nSize);
166 /* copy construkor - makes ALWAYS a deep copy!!!! */ 169 /* copy construkor - makes ALWAYS a deep copy!!!! */
167 encodedString(const encodedString&old); 170 encodedString(const encodedString&old);
168 /* assign operator - makes ALWAYS a deep copy!!!! */ 171 /* assign operator - makes ALWAYS a deep copy!!!! */
169 encodedString& operator=(const encodedString&old); 172 encodedString& operator=(const encodedString&old);
170 /* destructor - cleans the content */ 173 /* destructor - cleans the content */
171 virtual ~encodedString(); 174 virtual ~encodedString();