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