Diffstat (limited to 'noncore/net/mail/mailtypes.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/mailtypes.cpp | 335 |
1 files changed, 0 insertions, 335 deletions
diff --git a/noncore/net/mail/mailtypes.cpp b/noncore/net/mail/mailtypes.cpp deleted file mode 100644 index d8a36e7..0000000 --- a/noncore/net/mail/mailtypes.cpp +++ b/dev/null | |||
@@ -1,335 +0,0 @@ | |||
1 | #include "mailtypes.h" | ||
2 | #include <stdlib.h> | ||
3 | |||
4 | RecMail::RecMail() | ||
5 | :subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) | ||
6 | { | ||
7 | init(); | ||
8 | } | ||
9 | |||
10 | RecMail::RecMail(const RecMail&old) | ||
11 | :subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) | ||
12 | { | ||
13 | init(); | ||
14 | copy_old(old); | ||
15 | qDebug("Copy constructor RecMail"); | ||
16 | } | ||
17 | |||
18 | RecMail::~RecMail() | ||
19 | { | ||
20 | wrapper = 0; | ||
21 | } | ||
22 | |||
23 | void RecMail::copy_old(const RecMail&old) | ||
24 | { | ||
25 | subject = old.subject; | ||
26 | date = old.date; | ||
27 | mbox = old.mbox; | ||
28 | msg_id = old.msg_id; | ||
29 | msg_size = old.msg_size; | ||
30 | msg_number = old.msg_number; | ||
31 | from = old.from; | ||
32 | msg_flags = old.msg_flags; | ||
33 | to = old.to; | ||
34 | cc = old.cc; | ||
35 | bcc = old.bcc; | ||
36 | wrapper = old.wrapper; | ||
37 | } | ||
38 | |||
39 | void RecMail::init() | ||
40 | { | ||
41 | to.clear(); | ||
42 | cc.clear(); | ||
43 | bcc.clear(); | ||
44 | wrapper = 0; | ||
45 | } | ||
46 | |||
47 | void RecMail::setWrapper(AbstractMail*awrapper) | ||
48 | { | ||
49 | wrapper = awrapper; | ||
50 | } | ||
51 | |||
52 | AbstractMail* RecMail::Wrapper() | ||
53 | { | ||
54 | return wrapper; | ||
55 | } | ||
56 | |||
57 | void RecMail::setTo(const QStringList&list) | ||
58 | { | ||
59 | to = list; | ||
60 | } | ||
61 | |||
62 | const QStringList&RecMail::To()const | ||
63 | { | ||
64 | return to; | ||
65 | } | ||
66 | |||
67 | void RecMail::setCC(const QStringList&list) | ||
68 | { | ||
69 | cc = list; | ||
70 | } | ||
71 | |||
72 | const QStringList&RecMail::CC()const | ||
73 | { | ||
74 | return cc; | ||
75 | } | ||
76 | |||
77 | void RecMail::setBcc(const QStringList&list) | ||
78 | { | ||
79 | bcc = list; | ||
80 | } | ||
81 | |||
82 | const QStringList& RecMail::Bcc()const | ||
83 | { | ||
84 | return bcc; | ||
85 | } | ||
86 | |||
87 | RecPart::RecPart() | ||
88 | : m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) | ||
89 | { | ||
90 | m_Parameters.clear(); | ||
91 | m_poslist.clear(); | ||
92 | } | ||
93 | |||
94 | RecPart::~RecPart() | ||
95 | { | ||
96 | } | ||
97 | |||
98 | void RecPart::setSize(unsigned int size) | ||
99 | { | ||
100 | m_size = size; | ||
101 | } | ||
102 | |||
103 | const unsigned int RecPart::Size()const | ||
104 | { | ||
105 | return m_size; | ||
106 | } | ||
107 | |||
108 | void RecPart::setLines(unsigned int lines) | ||
109 | { | ||
110 | m_lines = lines; | ||
111 | } | ||
112 | |||
113 | const unsigned int RecPart::Lines()const | ||
114 | { | ||
115 | return m_lines; | ||
116 | } | ||
117 | |||
118 | const QString& RecPart::Type()const | ||
119 | { | ||
120 | return m_type; | ||
121 | } | ||
122 | |||
123 | void RecPart::setType(const QString&type) | ||
124 | { | ||
125 | m_type = type; | ||
126 | } | ||
127 | |||
128 | const QString& RecPart::Subtype()const | ||
129 | { | ||
130 | return m_subtype; | ||
131 | } | ||
132 | |||
133 | void RecPart::setSubtype(const QString&subtype) | ||
134 | { | ||
135 | m_subtype = subtype; | ||
136 | } | ||
137 | |||
138 | const QString& RecPart::Identifier()const | ||
139 | { | ||
140 | return m_identifier; | ||
141 | } | ||
142 | |||
143 | void RecPart::setIdentifier(const QString&identifier) | ||
144 | { | ||
145 | m_identifier = identifier; | ||
146 | } | ||
147 | |||
148 | const QString& RecPart::Encoding()const | ||
149 | { | ||
150 | return m_encoding; | ||
151 | } | ||
152 | |||
153 | void RecPart::setEncoding(const QString&encoding) | ||
154 | { | ||
155 | m_encoding = encoding; | ||
156 | } | ||
157 | |||
158 | const QString& RecPart::Description()const | ||
159 | { | ||
160 | return m_description; | ||
161 | } | ||
162 | |||
163 | void RecPart::setDescription(const QString&desc) | ||
164 | { | ||
165 | m_description = desc; | ||
166 | } | ||
167 | |||
168 | void RecPart::setParameters(const part_plist_t&list) | ||
169 | { | ||
170 | m_Parameters = list; | ||
171 | } | ||
172 | |||
173 | const part_plist_t& RecPart::Parameters()const | ||
174 | { | ||
175 | return m_Parameters; | ||
176 | } | ||
177 | |||
178 | void RecPart::addParameter(const QString&key,const QString&value) | ||
179 | { | ||
180 | m_Parameters[key]=value; | ||
181 | } | ||
182 | |||
183 | const QString RecPart::searchParamter(const QString&key)const | ||
184 | { | ||
185 | QString value(""); | ||
186 | part_plist_t::ConstIterator it = m_Parameters.find(key); | ||
187 | if (it != m_Parameters.end()) { | ||
188 | value = it.data(); | ||
189 | } | ||
190 | return value; | ||
191 | } | ||
192 | |||
193 | void RecPart::setPositionlist(const QValueList<int>&poslist) | ||
194 | { | ||
195 | m_poslist = poslist; | ||
196 | } | ||
197 | |||
198 | const QValueList<int>& RecPart::Positionlist()const | ||
199 | { | ||
200 | return m_poslist; | ||
201 | } | ||
202 | |||
203 | RecBody::RecBody() | ||
204 | : m_BodyText(),m_PartsList(),m_description() | ||
205 | { | ||
206 | m_PartsList.clear(); | ||
207 | } | ||
208 | |||
209 | RecBody::~RecBody() | ||
210 | { | ||
211 | } | ||
212 | |||
213 | void RecBody::setBodytext(const QString&bodyText) | ||
214 | { | ||
215 | m_BodyText = bodyText; | ||
216 | } | ||
217 | |||
218 | const QString& RecBody::Bodytext()const | ||
219 | { | ||
220 | return m_BodyText; | ||
221 | } | ||
222 | |||
223 | void RecBody::setParts(const QValueList<RecPart>&parts) | ||
224 | { | ||
225 | m_PartsList.clear(); | ||
226 | m_PartsList = parts; | ||
227 | } | ||
228 | |||
229 | const QValueList<RecPart>& RecBody::Parts()const | ||
230 | { | ||
231 | return m_PartsList; | ||
232 | } | ||
233 | |||
234 | void RecBody::addPart(const RecPart& part) | ||
235 | { | ||
236 | m_PartsList.append(part); | ||
237 | } | ||
238 | |||
239 | void RecBody::setDescription(const RecPart&des) | ||
240 | { | ||
241 | m_description = des; | ||
242 | } | ||
243 | |||
244 | const RecPart& RecBody::Description()const | ||
245 | { | ||
246 | return m_description; | ||
247 | } | ||
248 | |||
249 | /* handling encoded content */ | ||
250 | encodedString::encodedString() | ||
251 | { | ||
252 | init(); | ||
253 | } | ||
254 | |||
255 | encodedString::encodedString(const char*nContent,unsigned int nSize) | ||
256 | { | ||
257 | init(); | ||
258 | setContent(nContent,nSize); | ||
259 | } | ||
260 | |||
261 | encodedString::encodedString(char*nContent,unsigned int nSize) | ||
262 | { | ||
263 | init(); | ||
264 | setContent(nContent,nSize); | ||
265 | } | ||
266 | |||
267 | encodedString::encodedString(const encodedString&old) | ||
268 | { | ||
269 | init(); | ||
270 | copy_old(old); | ||
271 | qDebug("encodedeString: copy constructor!"); | ||
272 | } | ||
273 | |||
274 | encodedString& encodedString::operator=(const encodedString&old) | ||
275 | { | ||
276 | init(); | ||
277 | copy_old(old); | ||
278 | qDebug("encodedString: assign operator!"); | ||
279 | return *this; | ||
280 | } | ||
281 | |||
282 | encodedString::~encodedString() | ||
283 | { | ||
284 | clean(); | ||
285 | } | ||
286 | |||
287 | void encodedString::init() | ||
288 | { | ||
289 | content = 0; | ||
290 | size = 0; | ||
291 | } | ||
292 | |||
293 | void encodedString::clean() | ||
294 | { | ||
295 | if (content) { | ||
296 | free(content); | ||
297 | } | ||
298 | content = 0; | ||
299 | size = 0; | ||
300 | } | ||
301 | |||
302 | void encodedString::copy_old(const encodedString&old) | ||
303 | { | ||
304 | clean(); | ||
305 | if (old.size>0 && old.content) { | ||
306 | content = (char*)malloc(old.size*sizeof(char)); | ||
307 | memcpy(content,old.content,size); | ||
308 | size = old.size; | ||
309 | } | ||
310 | } | ||
311 | |||
312 | const char*encodedString::Content()const | ||
313 | { | ||
314 | return content; | ||
315 | } | ||
316 | |||
317 | const int encodedString::Length()const | ||
318 | { | ||
319 | return size; | ||
320 | } | ||
321 | |||
322 | void encodedString::setContent(const char*nContent,int nSize) | ||
323 | { | ||
324 | if (nSize>0 && nContent) { | ||
325 | content = (char*)malloc(nSize*sizeof(char)); | ||
326 | memcpy(content,nContent,nSize); | ||
327 | size = nSize; | ||
328 | } | ||
329 | } | ||
330 | |||
331 | void encodedString::setContent(char*nContent,int nSize) | ||
332 | { | ||
333 | content = nContent; | ||
334 | size = nSize; | ||
335 | } | ||