Diffstat (limited to 'kmicromail/libmailwrapper/mailtypes.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kmicromail/libmailwrapper/mailtypes.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/kmicromail/libmailwrapper/mailtypes.cpp b/kmicromail/libmailwrapper/mailtypes.cpp index 70a0ab5..84ccf9f 100644 --- a/kmicromail/libmailwrapper/mailtypes.cpp +++ b/kmicromail/libmailwrapper/mailtypes.cpp | |||
@@ -1,457 +1,459 @@ | |||
1 | #include "mailtypes.h" | 1 | #include "mailtypes.h" |
2 | 2 | ||
3 | //#include <opie2/odebug.h> | 3 | //#include <opie2/odebug.h> |
4 | 4 | ||
5 | #include <stdlib.h> | 5 | #include <stdlib.h> |
6 | //Added by qt3to4: | ||
7 | #include <Q3ValueList> | ||
6 | 8 | ||
7 | using namespace Opie::Core; | 9 | using namespace Opie::Core; |
8 | RecMail::RecMail() | 10 | RecMail::RecMail() |
9 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) | 11 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) |
10 | { | 12 | { |
11 | init(); | 13 | init(); |
12 | } | 14 | } |
13 | 15 | ||
14 | RecMail::RecMail(const RecMail&old) | 16 | RecMail::RecMail(const RecMail&old) |
15 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) | 17 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) |
16 | { | 18 | { |
17 | init(); | 19 | init(); |
18 | copy_old(old); | 20 | copy_old(old); |
19 | // odebug << "Copy constructor RecMail" << oendl; | 21 | // odebug << "Copy constructor RecMail" << oendl; |
20 | } | 22 | } |
21 | 23 | ||
22 | RecMail::~RecMail() | 24 | RecMail::~RecMail() |
23 | { | 25 | { |
24 | wrapper = 0; | 26 | wrapper = 0; |
25 | } | 27 | } |
26 | static bool stringCompareRec( const QString& s1, const QString& s2 ) | 28 | static bool stringCompareRec( const QString& s1, const QString& s2 ) |
27 | { | 29 | { |
28 | if ( s1.isEmpty() && s2.isEmpty() ) | 30 | if ( s1.isEmpty() && s2.isEmpty() ) |
29 | return true; | 31 | return true; |
30 | return s1 == s2; | 32 | return s1 == s2; |
31 | } | 33 | } |
32 | #if 0 | 34 | #if 0 |
33 | QString RecMail::MsgsizeString() const | 35 | QString RecMail::MsgsizeString() const |
34 | { | 36 | { |
35 | 37 | ||
36 | double s = msg_size; | 38 | double s = msg_size; |
37 | int w = 0; | 39 | int w = 0; |
38 | s/=1024; | 40 | s/=1024; |
39 | if (s>999.0) { | 41 | if (s>999.0) { |
40 | s/=1024.0; | 42 | s/=1024.0; |
41 | ++w; | 43 | ++w; |
42 | } | 44 | } |
43 | QString fsize = QString::number( s, 'f', 2 ); | 45 | QString fsize = QString::number( s, 'f', 2 ); |
44 | if ( w == 0 ) { | 46 | if ( w == 0 ) { |
45 | fsize += "kB" ; | 47 | fsize += "kB" ; |
46 | } else | 48 | } else |
47 | fsize += "MB" ; | 49 | fsize += "MB" ; |
48 | return fsize; | 50 | return fsize; |
49 | } | 51 | } |
50 | #endif | 52 | #endif |
51 | bool RecMail::isEqual( RecMail* r1 ) | 53 | bool RecMail::isEqual( RecMail* r1 ) |
52 | { | 54 | { |
53 | if ( !stringCompareRec( isodate, r1->isodate ) ) { | 55 | if ( !stringCompareRec( isodate, r1->isodate ) ) { |
54 | //qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1()); | 56 | //qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1()); |
55 | return false; | 57 | return false; |
56 | } | 58 | } |
57 | if ( !stringCompareRec( subject.left(40), r1->subject.left(40) ) ) { | 59 | if ( !stringCompareRec( subject.left(40), r1->subject.left(40) ) ) { |
58 | //qDebug("sub *%s* *%s*", subject.latin1(), r1->subject.latin1()); | 60 | //qDebug("sub *%s* *%s*", subject.latin1(), r1->subject.latin1()); |
59 | return false; | 61 | return false; |
60 | } | 62 | } |
61 | 63 | ||
62 | //qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1()); | 64 | //qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1()); |
63 | if ( !stringCompareRec( from.left(40), r1->from.left(40)) ) { | 65 | if ( !stringCompareRec( from.left(40), r1->from.left(40)) ) { |
64 | if ( r1->from.find ( from ) < 0 ) { | 66 | if ( r1->from.find ( from ) < 0 ) { |
65 | if ( !stringCompareRec( from.simplifyWhiteSpace ().left(40), r1->from.simplifyWhiteSpace ().left(40)) ) { | 67 | if ( !stringCompareRec( from.simplifyWhiteSpace ().left(40), r1->from.simplifyWhiteSpace ().left(40)) ) { |
66 | //qDebug("from *%s* *%s* ", from.left(40).latin1(), r1->from.left(20).latin1()); | 68 | //qDebug("from *%s* *%s* ", from.left(40).latin1(), r1->from.left(20).latin1()); |
67 | return false; | 69 | return false; |
68 | } | 70 | } |
69 | } | 71 | } |
70 | } | 72 | } |
71 | 73 | ||
72 | return true; | 74 | return true; |
73 | } | 75 | } |
74 | void RecMail::copy_old(const RecMail&old) | 76 | void RecMail::copy_old(const RecMail&old) |
75 | { | 77 | { |
76 | subject = old.subject; | 78 | subject = old.subject; |
77 | date = old.date; | 79 | date = old.date; |
78 | mbox = old.mbox; | 80 | mbox = old.mbox; |
79 | msg_id = old.msg_id; | 81 | msg_id = old.msg_id; |
80 | msg_size = old.msg_size; | 82 | msg_size = old.msg_size; |
81 | msg_number = old.msg_number; | 83 | msg_number = old.msg_number; |
82 | from = old.from; | 84 | from = old.from; |
83 | msg_flags = old.msg_flags; | 85 | msg_flags = old.msg_flags; |
84 | to = old.to; | 86 | to = old.to; |
85 | cc = old.cc; | 87 | cc = old.cc; |
86 | bcc = old.bcc; | 88 | bcc = old.bcc; |
87 | wrapper = old.wrapper; | 89 | wrapper = old.wrapper; |
88 | in_reply_to = old.in_reply_to; | 90 | in_reply_to = old.in_reply_to; |
89 | references = old.references; | 91 | references = old.references; |
90 | replyto = old.replyto; | 92 | replyto = old.replyto; |
91 | } | 93 | } |
92 | 94 | ||
93 | void RecMail::init() | 95 | void RecMail::init() |
94 | { | 96 | { |
95 | to.clear(); | 97 | to.clear(); |
96 | cc.clear(); | 98 | cc.clear(); |
97 | bcc.clear(); | 99 | bcc.clear(); |
98 | in_reply_to.clear(); | 100 | in_reply_to.clear(); |
99 | references.clear(); | 101 | references.clear(); |
100 | wrapper = 0; | 102 | wrapper = 0; |
101 | } | 103 | } |
102 | 104 | ||
103 | void RecMail::setWrapper(AbstractMail*awrapper) | 105 | void RecMail::setWrapper(AbstractMail*awrapper) |
104 | { | 106 | { |
105 | wrapper = awrapper; | 107 | wrapper = awrapper; |
106 | } | 108 | } |
107 | 109 | ||
108 | AbstractMail* RecMail::Wrapper() | 110 | AbstractMail* RecMail::Wrapper() |
109 | { | 111 | { |
110 | return wrapper; | 112 | return wrapper; |
111 | } | 113 | } |
112 | 114 | ||
113 | void RecMail::setTo(const QStringList&list) | 115 | void RecMail::setTo(const QStringList&list) |
114 | { | 116 | { |
115 | to = list; | 117 | to = list; |
116 | } | 118 | } |
117 | 119 | ||
118 | const QStringList&RecMail::To()const | 120 | const QStringList&RecMail::To()const |
119 | { | 121 | { |
120 | return to; | 122 | return to; |
121 | } | 123 | } |
122 | 124 | ||
123 | void RecMail::setCC(const QStringList&list) | 125 | void RecMail::setCC(const QStringList&list) |
124 | { | 126 | { |
125 | cc = list; | 127 | cc = list; |
126 | } | 128 | } |
127 | 129 | ||
128 | const QStringList&RecMail::CC()const | 130 | const QStringList&RecMail::CC()const |
129 | { | 131 | { |
130 | return cc; | 132 | return cc; |
131 | } | 133 | } |
132 | 134 | ||
133 | void RecMail::setBcc(const QStringList&list) | 135 | void RecMail::setBcc(const QStringList&list) |
134 | { | 136 | { |
135 | bcc = list; | 137 | bcc = list; |
136 | } | 138 | } |
137 | 139 | ||
138 | const QStringList& RecMail::Bcc()const | 140 | const QStringList& RecMail::Bcc()const |
139 | { | 141 | { |
140 | return bcc; | 142 | return bcc; |
141 | } | 143 | } |
142 | 144 | ||
143 | void RecMail::setInreply(const QStringList&list) | 145 | void RecMail::setInreply(const QStringList&list) |
144 | { | 146 | { |
145 | in_reply_to = list; | 147 | in_reply_to = list; |
146 | } | 148 | } |
147 | 149 | ||
148 | const QStringList& RecMail::Inreply()const | 150 | const QStringList& RecMail::Inreply()const |
149 | { | 151 | { |
150 | return in_reply_to; | 152 | return in_reply_to; |
151 | } | 153 | } |
152 | 154 | ||
153 | void RecMail::setReferences(const QStringList&list) | 155 | void RecMail::setReferences(const QStringList&list) |
154 | { | 156 | { |
155 | references = list; | 157 | references = list; |
156 | } | 158 | } |
157 | 159 | ||
158 | const QStringList& RecMail::References()const | 160 | const QStringList& RecMail::References()const |
159 | { | 161 | { |
160 | return references; | 162 | return references; |
161 | } | 163 | } |
162 | 164 | ||
163 | RecPart::RecPart() | 165 | RecPart::RecPart() |
164 | : Opie::Core::ORefCount(), | 166 | : Opie::Core::ORefCount(), |
165 | m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) | 167 | m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) |
166 | { | 168 | { |
167 | m_Parameters.clear(); | 169 | m_Parameters.clear(); |
168 | m_poslist.clear(); | 170 | m_poslist.clear(); |
169 | } | 171 | } |
170 | 172 | ||
171 | RecPart::RecPart(const RecPart&old) | 173 | RecPart::RecPart(const RecPart&old) |
172 | : Opie::Core::ORefCount(), | 174 | : Opie::Core::ORefCount(), |
173 | m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) | 175 | m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) |
174 | { | 176 | { |
175 | m_type = old.m_type; | 177 | m_type = old.m_type; |
176 | m_subtype = old.m_subtype; | 178 | m_subtype = old.m_subtype; |
177 | m_identifier = old.m_identifier; | 179 | m_identifier = old.m_identifier; |
178 | m_encoding = old.m_encoding; | 180 | m_encoding = old.m_encoding; |
179 | m_description = old.m_description; | 181 | m_description = old.m_description; |
180 | m_lines = old.m_lines; | 182 | m_lines = old.m_lines; |
181 | m_size = old.m_size; | 183 | m_size = old.m_size; |
182 | m_Parameters = old.m_Parameters; | 184 | m_Parameters = old.m_Parameters; |
183 | m_poslist = old.m_poslist; | 185 | m_poslist = old.m_poslist; |
184 | // odebug << "RecPart copy constructor" << oendl; | 186 | // odebug << "RecPart copy constructor" << oendl; |
185 | } | 187 | } |
186 | 188 | ||
187 | RecPart::~RecPart() | 189 | RecPart::~RecPart() |
188 | { | 190 | { |
189 | } | 191 | } |
190 | 192 | ||
191 | void RecPart::setSize(unsigned int size) | 193 | void RecPart::setSize(unsigned int size) |
192 | { | 194 | { |
193 | m_size = size; | 195 | m_size = size; |
194 | } | 196 | } |
195 | 197 | ||
196 | const unsigned int RecPart::Size()const | 198 | const unsigned int RecPart::Size()const |
197 | { | 199 | { |
198 | return m_size; | 200 | return m_size; |
199 | } | 201 | } |
200 | 202 | ||
201 | void RecPart::setLines(unsigned int lines) | 203 | void RecPart::setLines(unsigned int lines) |
202 | { | 204 | { |
203 | m_lines = lines; | 205 | m_lines = lines; |
204 | } | 206 | } |
205 | 207 | ||
206 | const unsigned int RecPart::Lines()const | 208 | const unsigned int RecPart::Lines()const |
207 | { | 209 | { |
208 | return m_lines; | 210 | return m_lines; |
209 | } | 211 | } |
210 | 212 | ||
211 | const QString& RecPart::Type()const | 213 | const QString& RecPart::Type()const |
212 | { | 214 | { |
213 | return m_type; | 215 | return m_type; |
214 | } | 216 | } |
215 | 217 | ||
216 | void RecPart::setType(const QString&type) | 218 | void RecPart::setType(const QString&type) |
217 | { | 219 | { |
218 | m_type = type; | 220 | m_type = type; |
219 | } | 221 | } |
220 | 222 | ||
221 | const QString& RecPart::Subtype()const | 223 | const QString& RecPart::Subtype()const |
222 | { | 224 | { |
223 | return m_subtype; | 225 | return m_subtype; |
224 | } | 226 | } |
225 | 227 | ||
226 | void RecPart::setSubtype(const QString&subtype) | 228 | void RecPart::setSubtype(const QString&subtype) |
227 | { | 229 | { |
228 | m_subtype = subtype; | 230 | m_subtype = subtype; |
229 | } | 231 | } |
230 | 232 | ||
231 | const QString& RecPart::Identifier()const | 233 | const QString& RecPart::Identifier()const |
232 | { | 234 | { |
233 | return m_identifier; | 235 | return m_identifier; |
234 | } | 236 | } |
235 | 237 | ||
236 | void RecPart::setIdentifier(const QString&identifier) | 238 | void RecPart::setIdentifier(const QString&identifier) |
237 | { | 239 | { |
238 | m_identifier = identifier; | 240 | m_identifier = identifier; |
239 | } | 241 | } |
240 | 242 | ||
241 | const QString& RecPart::Encoding()const | 243 | const QString& RecPart::Encoding()const |
242 | { | 244 | { |
243 | return m_encoding; | 245 | return m_encoding; |
244 | } | 246 | } |
245 | 247 | ||
246 | void RecPart::setEncoding(const QString&encoding) | 248 | void RecPart::setEncoding(const QString&encoding) |
247 | { | 249 | { |
248 | m_encoding = encoding; | 250 | m_encoding = encoding; |
249 | } | 251 | } |
250 | 252 | ||
251 | const QString& RecPart::Description()const | 253 | const QString& RecPart::Description()const |
252 | { | 254 | { |
253 | return m_description; | 255 | return m_description; |
254 | } | 256 | } |
255 | 257 | ||
256 | void RecPart::setDescription(const QString&desc) | 258 | void RecPart::setDescription(const QString&desc) |
257 | { | 259 | { |
258 | m_description = desc; | 260 | m_description = desc; |
259 | } | 261 | } |
260 | 262 | ||
261 | void RecPart::setParameters(const part_plist_t&list) | 263 | void RecPart::setParameters(const part_plist_t&list) |
262 | { | 264 | { |
263 | m_Parameters = list; | 265 | m_Parameters = list; |
264 | } | 266 | } |
265 | 267 | ||
266 | const part_plist_t& RecPart::Parameters()const | 268 | const part_plist_t& RecPart::Parameters()const |
267 | { | 269 | { |
268 | return m_Parameters; | 270 | return m_Parameters; |
269 | } | 271 | } |
270 | 272 | ||
271 | void RecPart::addParameter(const QString&key,const QString&value) | 273 | void RecPart::addParameter(const QString&key,const QString&value) |
272 | { | 274 | { |
273 | m_Parameters[key]=value; | 275 | m_Parameters[key]=value; |
274 | } | 276 | } |
275 | 277 | ||
276 | const QString RecPart::searchParamter(const QString&key)const | 278 | const QString RecPart::searchParamter(const QString&key)const |
277 | { | 279 | { |
278 | QString value(""); | 280 | QString value(""); |
279 | part_plist_t::ConstIterator it = m_Parameters.find(key); | 281 | part_plist_t::ConstIterator it = m_Parameters.find(key); |
280 | if (it != m_Parameters.end()) { | 282 | if (it != m_Parameters.end()) { |
281 | value = it.data(); | 283 | value = it.data(); |
282 | } | 284 | } |
283 | return value; | 285 | return value; |
284 | } | 286 | } |
285 | 287 | ||
286 | void RecPart::setPositionlist(const QValueList<int>&poslist) | 288 | void RecPart::setPositionlist(const Q3ValueList<int>&poslist) |
287 | { | 289 | { |
288 | m_poslist = poslist; | 290 | m_poslist = poslist; |
289 | } | 291 | } |
290 | 292 | ||
291 | const QValueList<int>& RecPart::Positionlist()const | 293 | const Q3ValueList<int>& RecPart::Positionlist()const |
292 | { | 294 | { |
293 | return m_poslist; | 295 | return m_poslist; |
294 | } | 296 | } |
295 | 297 | ||
296 | RecBody::RecBody() | 298 | RecBody::RecBody() |
297 | : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart()) | 299 | : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart()) |
298 | { | 300 | { |
299 | m_PartsList.clear(); | 301 | m_PartsList.clear(); |
300 | } | 302 | } |
301 | 303 | ||
302 | RecBody::RecBody(const RecBody&old) | 304 | RecBody::RecBody(const RecBody&old) |
303 | :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart()) | 305 | :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart()) |
304 | { | 306 | { |
305 | m_BodyText = old.m_BodyText; | 307 | m_BodyText = old.m_BodyText; |
306 | m_PartsList = old.m_PartsList; | 308 | m_PartsList = old.m_PartsList; |
307 | m_description = old.m_description; | 309 | m_description = old.m_description; |
308 | mCharset = old.mCharset; | 310 | mCharset = old.mCharset; |
309 | // odebug << "Recbody copy constructor" << oendl; | 311 | // odebug << "Recbody copy constructor" << oendl; |
310 | } | 312 | } |
311 | 313 | ||
312 | RecBody::~RecBody() | 314 | RecBody::~RecBody() |
313 | { | 315 | { |
314 | } | 316 | } |
315 | 317 | ||
316 | void RecBody::setBodytext(const QString&bodyText) | 318 | void RecBody::setBodytext(const QString&bodyText) |
317 | { | 319 | { |
318 | m_BodyText = bodyText; | 320 | m_BodyText = bodyText; |
319 | } | 321 | } |
320 | 322 | ||
321 | const QString& RecBody::Bodytext()const | 323 | const QString& RecBody::Bodytext()const |
322 | { | 324 | { |
323 | return m_BodyText; | 325 | return m_BodyText; |
324 | } | 326 | } |
325 | 327 | ||
326 | void RecBody::setParts(const QValueList<RecPartP>&parts) | 328 | void RecBody::setParts(const Q3ValueList<RecPartP>&parts) |
327 | { | 329 | { |
328 | m_PartsList.clear(); | 330 | m_PartsList.clear(); |
329 | m_PartsList = parts; | 331 | m_PartsList = parts; |
330 | } | 332 | } |
331 | 333 | ||
332 | const QValueList<RecPartP>& RecBody::Parts()const | 334 | const Q3ValueList<RecPartP>& RecBody::Parts()const |
333 | { | 335 | { |
334 | return m_PartsList; | 336 | return m_PartsList; |
335 | } | 337 | } |
336 | 338 | ||
337 | void RecBody::addPart(const RecPartP& part) | 339 | void RecBody::addPart(const RecPartP& part) |
338 | { | 340 | { |
339 | m_PartsList.append(part); | 341 | m_PartsList.append(part); |
340 | } | 342 | } |
341 | 343 | ||
342 | void RecBody::setDescription(const RecPartP&des) | 344 | void RecBody::setDescription(const RecPartP&des) |
343 | { | 345 | { |
344 | m_description = des; | 346 | m_description = des; |
345 | } | 347 | } |
346 | 348 | ||
347 | const RecPartP& RecBody::Description()const | 349 | const RecPartP& RecBody::Description()const |
348 | { | 350 | { |
349 | return m_description; | 351 | return m_description; |
350 | } | 352 | } |
351 | 353 | ||
352 | void RecBody::setCharset(const QString& str) | 354 | void RecBody::setCharset(const QString& str) |
353 | { | 355 | { |
354 | mCharset = str; | 356 | mCharset = str; |
355 | } | 357 | } |
356 | 358 | ||
357 | QString RecBody::getCharset()const | 359 | QString RecBody::getCharset()const |
358 | { | 360 | { |
359 | return mCharset; | 361 | return mCharset; |
360 | } | 362 | } |
361 | 363 | ||
362 | /* handling encoded content */ | 364 | /* handling encoded content */ |
363 | encodedString::encodedString() | 365 | encodedString::encodedString() |
364 | { | 366 | { |
365 | init(); | 367 | init(); |
366 | } | 368 | } |
367 | 369 | ||
368 | encodedString::encodedString(const char*nContent,unsigned int nSize) | 370 | encodedString::encodedString(const char*nContent,unsigned int nSize) |
369 | { | 371 | { |
370 | init(); | 372 | init(); |
371 | setContent(nContent,nSize); | 373 | setContent(nContent,nSize); |
372 | } | 374 | } |
373 | 375 | ||
374 | encodedString::encodedString(char*nContent,unsigned int nSize) | 376 | encodedString::encodedString(char*nContent,unsigned int nSize) |
375 | { | 377 | { |
376 | init(); | 378 | init(); |
377 | setContent(nContent,nSize); | 379 | setContent(nContent,nSize); |
378 | } | 380 | } |
379 | 381 | ||
380 | encodedString::encodedString(const encodedString&old) | 382 | encodedString::encodedString(const encodedString&old) |
381 | { | 383 | { |
382 | init(); | 384 | init(); |
383 | copy_old(old); | 385 | copy_old(old); |
384 | // odebug << "encodedeString: copy constructor!" << oendl; | 386 | // odebug << "encodedeString: copy constructor!" << oendl; |
385 | } | 387 | } |
386 | 388 | ||
387 | encodedString& encodedString::operator=(const encodedString&old) | 389 | encodedString& encodedString::operator=(const encodedString&old) |
388 | { | 390 | { |
389 | init(); | 391 | init(); |
390 | copy_old(old); | 392 | copy_old(old); |
391 | // odebug << "encodedString: assign operator!" << oendl; | 393 | // odebug << "encodedString: assign operator!" << oendl; |
392 | return *this; | 394 | return *this; |
393 | } | 395 | } |
394 | 396 | ||
395 | encodedString::~encodedString() | 397 | encodedString::~encodedString() |
396 | { | 398 | { |
397 | clean(); | 399 | clean(); |
398 | } | 400 | } |
399 | 401 | ||
400 | void encodedString::init() | 402 | void encodedString::init() |
401 | { | 403 | { |
402 | content = 0; | 404 | content = 0; |
403 | size = 0; | 405 | size = 0; |
404 | } | 406 | } |
405 | 407 | ||
406 | void encodedString::clean() | 408 | void encodedString::clean() |
407 | { | 409 | { |
408 | if (content) { | 410 | if (content) { |
409 | free(content); | 411 | free(content); |
410 | } | 412 | } |
411 | content = 0; | 413 | content = 0; |
412 | size = 0; | 414 | size = 0; |
413 | } | 415 | } |
414 | 416 | ||
415 | void encodedString::copy_old(const encodedString&old) | 417 | void encodedString::copy_old(const encodedString&old) |
416 | { | 418 | { |
417 | clean(); | 419 | clean(); |
418 | if (old.size>0 && old.content) { | 420 | if (old.size>0 && old.content) { |
419 | content = (char*)malloc(old.size*sizeof(char)); | 421 | content = (char*)malloc(old.size*sizeof(char)); |
420 | memcpy(content,old.content,size); | 422 | memcpy(content,old.content,size); |
421 | size = old.size; | 423 | size = old.size; |
422 | } | 424 | } |
423 | } | 425 | } |
424 | 426 | ||
425 | const char*encodedString::Content()const | 427 | const char*encodedString::Content()const |
426 | { | 428 | { |
427 | return content; | 429 | return content; |
428 | } | 430 | } |
429 | 431 | ||
430 | const int encodedString::Length()const | 432 | const int encodedString::Length()const |
431 | { | 433 | { |
432 | return size; | 434 | return size; |
433 | } | 435 | } |
434 | 436 | ||
435 | void encodedString::setContent(const char*nContent,int nSize) | 437 | void encodedString::setContent(const char*nContent,int nSize) |
436 | { | 438 | { |
437 | if (nSize>0 && nContent) { | 439 | if (nSize>0 && nContent) { |
438 | content = (char*)malloc(nSize*sizeof(char)); | 440 | content = (char*)malloc(nSize*sizeof(char)); |
439 | memcpy(content,nContent,nSize); | 441 | memcpy(content,nContent,nSize); |
440 | size = nSize; | 442 | size = nSize; |
441 | } | 443 | } |
442 | } | 444 | } |
443 | 445 | ||
444 | void encodedString::setContent(char*nContent,int nSize) | 446 | void encodedString::setContent(char*nContent,int nSize) |
445 | { | 447 | { |
446 | content = nContent; | 448 | content = nContent; |
447 | size = nSize; | 449 | size = nSize; |
448 | } | 450 | } |
449 | 451 | ||
450 | folderStat&folderStat::operator=(const folderStat&old) | 452 | folderStat&folderStat::operator=(const folderStat&old) |
451 | { | 453 | { |
452 | message_count = old.message_count; | 454 | message_count = old.message_count; |
453 | message_unseen = old.message_unseen; | 455 | message_unseen = old.message_unseen; |
454 | message_recent = old.message_recent; | 456 | message_recent = old.message_recent; |
455 | return *this; | 457 | return *this; |
456 | } | 458 | } |
457 | 459 | ||