Diffstat (limited to 'noncore/net/mail/libmailwrapper/genericwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/genericwrapper.cpp | 52 |
1 files changed, 39 insertions, 13 deletions
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp index eb2c031..137a6ef 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp | |||
@@ -12,49 +12,49 @@ Genericwrapper::Genericwrapper() | |||
12 | 12 | ||
13 | Genericwrapper::~Genericwrapper() | 13 | Genericwrapper::~Genericwrapper() |
14 | { | 14 | { |
15 | if (m_folder) { | 15 | if (m_folder) { |
16 | mailfolder_free(m_folder); | 16 | mailfolder_free(m_folder); |
17 | } | 17 | } |
18 | if (m_storage) { | 18 | if (m_storage) { |
19 | mailstorage_free(m_storage); | 19 | mailstorage_free(m_storage); |
20 | } | 20 | } |
21 | cleanMimeCache(); | 21 | cleanMimeCache(); |
22 | } | 22 | } |
23 | 23 | ||
24 | void Genericwrapper::fillSingleBody(RecPart&target,mailmessage*,mailmime*mime) | 24 | void Genericwrapper::fillSingleBody(RecPart&target,mailmessage*,mailmime*mime) |
25 | { | 25 | { |
26 | if (!mime) { | 26 | if (!mime) { |
27 | return; | 27 | return; |
28 | } | 28 | } |
29 | mailmime_field*field = 0; | 29 | mailmime_field*field = 0; |
30 | mailmime_single_fields fields; | 30 | mailmime_single_fields fields; |
31 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); | 31 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); |
32 | if (mime->mm_mime_fields != NULL) { | 32 | if (mime->mm_mime_fields != NULL) { |
33 | mailmime_single_fields_init(&fields, mime->mm_mime_fields, | 33 | mailmime_single_fields_init(&fields, mime->mm_mime_fields, |
34 | mime->mm_content_type); | 34 | mime->mm_content_type); |
35 | } | 35 | } |
36 | 36 | ||
37 | mailmime_content*type = fields.fld_content; | 37 | mailmime_content*type = fields.fld_content; |
38 | clistcell*current; | 38 | clistcell*current; |
39 | if (!type) { | 39 | if (!type) { |
40 | target.setType("text"); | 40 | target.setType("text"); |
41 | target.setSubtype("plain"); | 41 | target.setSubtype("plain"); |
42 | } else { | 42 | } else { |
43 | target.setSubtype(type->ct_subtype); | 43 | target.setSubtype(type->ct_subtype); |
44 | switch(type->ct_type->tp_data.tp_discrete_type->dt_type) { | 44 | switch(type->ct_type->tp_data.tp_discrete_type->dt_type) { |
45 | case MAILMIME_DISCRETE_TYPE_TEXT: | 45 | case MAILMIME_DISCRETE_TYPE_TEXT: |
46 | target.setType("text"); | 46 | target.setType("text"); |
47 | break; | 47 | break; |
48 | case MAILMIME_DISCRETE_TYPE_IMAGE: | 48 | case MAILMIME_DISCRETE_TYPE_IMAGE: |
49 | target.setType("image"); | 49 | target.setType("image"); |
50 | break; | 50 | break; |
51 | case MAILMIME_DISCRETE_TYPE_AUDIO: | 51 | case MAILMIME_DISCRETE_TYPE_AUDIO: |
52 | target.setType("audio"); | 52 | target.setType("audio"); |
53 | break; | 53 | break; |
54 | case MAILMIME_DISCRETE_TYPE_VIDEO: | 54 | case MAILMIME_DISCRETE_TYPE_VIDEO: |
55 | target.setType("video"); | 55 | target.setType("video"); |
56 | break; | 56 | break; |
57 | case MAILMIME_DISCRETE_TYPE_APPLICATION: | 57 | case MAILMIME_DISCRETE_TYPE_APPLICATION: |
58 | target.setType("application"); | 58 | target.setType("application"); |
59 | break; | 59 | break; |
60 | case MAILMIME_DISCRETE_TYPE_EXTENSION: | 60 | case MAILMIME_DISCRETE_TYPE_EXTENSION: |
@@ -124,49 +124,49 @@ QString Genericwrapper::getencoding(mailmime_mechanism*aEnc) | |||
124 | case MAILMIME_MECHANISM_TOKEN: | 124 | case MAILMIME_MECHANISM_TOKEN: |
125 | default: | 125 | default: |
126 | if (aEnc->enc_token) { | 126 | if (aEnc->enc_token) { |
127 | enc = QString(aEnc->enc_token); | 127 | enc = QString(aEnc->enc_token); |
128 | } | 128 | } |
129 | break; | 129 | break; |
130 | } | 130 | } |
131 | return enc; | 131 | return enc; |
132 | } | 132 | } |
133 | 133 | ||
134 | void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count) | 134 | void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count) |
135 | { | 135 | { |
136 | if (current_rec >= 10) { | 136 | if (current_rec >= 10) { |
137 | qDebug("too deep recursion!"); | 137 | qDebug("too deep recursion!"); |
138 | } | 138 | } |
139 | if (!message || !mime) { | 139 | if (!message || !mime) { |
140 | return; | 140 | return; |
141 | } | 141 | } |
142 | int r; | 142 | int r; |
143 | char*data = 0; | 143 | char*data = 0; |
144 | size_t len; | 144 | size_t len; |
145 | clistiter * cur = 0; | 145 | clistiter * cur = 0; |
146 | QString b; | 146 | QString b; |
147 | RecPart part; | 147 | RecPart part; |
148 | 148 | ||
149 | switch (mime->mm_type) { | 149 | switch (mime->mm_type) { |
150 | case MAILMIME_SINGLE: | 150 | case MAILMIME_SINGLE: |
151 | { | 151 | { |
152 | QValueList<int>countlist = recList; | 152 | QValueList<int>countlist = recList; |
153 | countlist.append(current_count); | 153 | countlist.append(current_count); |
154 | r = mailmessage_fetch_section(message,mime,&data,&len); | 154 | r = mailmessage_fetch_section(message,mime,&data,&len); |
155 | part.setSize(len); | 155 | part.setSize(len); |
156 | part.setPositionlist(countlist); | 156 | part.setPositionlist(countlist); |
157 | b = gen_attachment_id(); | 157 | b = gen_attachment_id(); |
158 | part.setIdentifier(b); | 158 | part.setIdentifier(b); |
159 | fillSingleBody(part,message,mime); | 159 | fillSingleBody(part,message,mime); |
160 | if (part.Type()=="text" && target.Bodytext().isNull()) { | 160 | if (part.Type()=="text" && target.Bodytext().isNull()) { |
161 | encodedString*r = new encodedString(); | 161 | encodedString*r = new encodedString(); |
162 | r->setContent(data,len); | 162 | r->setContent(data,len); |
163 | encodedString*res = decode_String(r,part.Encoding()); | 163 | encodedString*res = decode_String(r,part.Encoding()); |
164 | if (countlist.count()>2) { | 164 | if (countlist.count()>2) { |
165 | bodyCache[b]=r; | 165 | bodyCache[b]=r; |
166 | target.addPart(part); | 166 | target.addPart(part); |
167 | } else { | 167 | } else { |
168 | delete r; | 168 | delete r; |
169 | } | 169 | } |
170 | b = QString(res->Content()); | 170 | b = QString(res->Content()); |
171 | delete res; | 171 | delete res; |
172 | target.setBodytext(b); | 172 | target.setBodytext(b); |
@@ -220,222 +220,248 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi | |||
220 | traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1); | 220 | traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1); |
221 | } | 221 | } |
222 | } | 222 | } |
223 | break; | 223 | break; |
224 | } | 224 | } |
225 | } | 225 | } |
226 | 226 | ||
227 | RecBody Genericwrapper::parseMail( mailmessage * msg ) | 227 | RecBody Genericwrapper::parseMail( mailmessage * msg ) |
228 | { | 228 | { |
229 | int err = MAILIMF_NO_ERROR; | 229 | int err = MAILIMF_NO_ERROR; |
230 | mailmime_single_fields fields; | 230 | mailmime_single_fields fields; |
231 | /* is bound to msg and will be freed there */ | 231 | /* is bound to msg and will be freed there */ |
232 | mailmime * mime=0; | 232 | mailmime * mime=0; |
233 | RecBody body; | 233 | RecBody body; |
234 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); | 234 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); |
235 | err = mailmessage_get_bodystructure(msg,&mime); | 235 | err = mailmessage_get_bodystructure(msg,&mime); |
236 | QValueList<int>recList; | 236 | QValueList<int>recList; |
237 | traverseBody(body,msg,mime,recList); | 237 | traverseBody(body,msg,mime,recList); |
238 | return body; | 238 | return body; |
239 | } | 239 | } |
240 | 240 | ||
241 | QString Genericwrapper::parseDateTime( mailimf_date_time *date ) | 241 | QString Genericwrapper::parseDateTime( mailimf_date_time *date ) |
242 | { | 242 | { |
243 | char tmp[23]; | 243 | char tmp[23]; |
244 | 244 | ||
245 | snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i", | 245 | snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i", |
246 | date->dt_day, date->dt_month, date->dt_year, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); | 246 | date->dt_day, date->dt_month, date->dt_year, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); |
247 | 247 | ||
248 | return QString( tmp ); | 248 | return QString( tmp ); |
249 | } | 249 | } |
250 | 250 | ||
251 | QString Genericwrapper::parseAddressList( mailimf_address_list *list ) | 251 | QString Genericwrapper::parseAddressList( mailimf_address_list *list ) |
252 | { | 252 | { |
253 | QString result( "" ); | 253 | QString result( "" ); |
254 | 254 | ||
255 | bool first = true; | 255 | bool first = true; |
256 | if (list == 0) return result; | 256 | if (list == 0) return result; |
257 | for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) { | 257 | for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) { |
258 | mailimf_address *addr = (mailimf_address *) current->data; | 258 | mailimf_address *addr = (mailimf_address *) current->data; |
259 | 259 | ||
260 | if ( !first ) { | 260 | if ( !first ) { |
261 | result.append( "," ); | 261 | result.append( "," ); |
262 | } else { | 262 | } else { |
263 | first = false; | 263 | first = false; |
264 | } | 264 | } |
265 | 265 | ||
266 | switch ( addr->ad_type ) { | 266 | switch ( addr->ad_type ) { |
267 | case MAILIMF_ADDRESS_MAILBOX: | 267 | case MAILIMF_ADDRESS_MAILBOX: |
268 | result.append( parseMailbox( addr->ad_data.ad_mailbox ) ); | 268 | result.append( parseMailbox( addr->ad_data.ad_mailbox ) ); |
269 | break; | 269 | break; |
270 | case MAILIMF_ADDRESS_GROUP: | 270 | case MAILIMF_ADDRESS_GROUP: |
271 | result.append( parseGroup( addr->ad_data.ad_group ) ); | 271 | result.append( parseGroup( addr->ad_data.ad_group ) ); |
272 | break; | 272 | break; |
273 | default: | 273 | default: |
274 | qDebug( "Generic: unkown mailimf address type" ); | 274 | qDebug( "Generic: unkown mailimf address type" ); |
275 | break; | 275 | break; |
276 | } | 276 | } |
277 | } | 277 | } |
278 | 278 | ||
279 | return result; | 279 | return result; |
280 | } | 280 | } |
281 | 281 | ||
282 | QString Genericwrapper::parseGroup( mailimf_group *group ) | 282 | QString Genericwrapper::parseGroup( mailimf_group *group ) |
283 | { | 283 | { |
284 | QString result( "" ); | 284 | QString result( "" ); |
285 | 285 | ||
286 | result.append( group->grp_display_name ); | 286 | result.append( group->grp_display_name ); |
287 | result.append( ": " ); | 287 | result.append( ": " ); |
288 | 288 | ||
289 | if ( group->grp_mb_list != NULL ) { | 289 | if ( group->grp_mb_list != NULL ) { |
290 | result.append( parseMailboxList( group->grp_mb_list ) ); | 290 | result.append( parseMailboxList( group->grp_mb_list ) ); |
291 | } | 291 | } |
292 | 292 | ||
293 | result.append( ";" ); | 293 | result.append( ";" ); |
294 | 294 | ||
295 | return result; | 295 | return result; |
296 | } | 296 | } |
297 | 297 | ||
298 | QString Genericwrapper::parseMailbox( mailimf_mailbox *box ) | 298 | QString Genericwrapper::parseMailbox( mailimf_mailbox *box ) |
299 | { | 299 | { |
300 | QString result( "" ); | 300 | QString result( "" ); |
301 | 301 | ||
302 | if ( box->mb_display_name == NULL ) { | 302 | if ( box->mb_display_name == NULL ) { |
303 | result.append( box->mb_addr_spec ); | 303 | result.append( box->mb_addr_spec ); |
304 | } else { | 304 | } else { |
305 | result.append( convert_String(box->mb_display_name).latin1() ); | 305 | result.append( convert_String(box->mb_display_name).latin1() ); |
306 | result.append( " <" ); | 306 | result.append( " <" ); |
307 | result.append( box->mb_addr_spec ); | 307 | result.append( box->mb_addr_spec ); |
308 | result.append( ">" ); | 308 | result.append( ">" ); |
309 | } | 309 | } |
310 | 310 | ||
311 | return result; | 311 | return result; |
312 | } | 312 | } |
313 | 313 | ||
314 | QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list ) | 314 | QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list ) |
315 | { | 315 | { |
316 | QString result( "" ); | 316 | QString result( "" ); |
317 | 317 | ||
318 | bool first = true; | 318 | bool first = true; |
319 | for ( clistiter *current = clist_begin( list->mb_list ); current != NULL; current = current->next ) { | 319 | for ( clistiter *current = clist_begin( list->mb_list ); current != NULL; current = current->next ) { |
320 | mailimf_mailbox *box = (mailimf_mailbox *) current->data; | 320 | mailimf_mailbox *box = (mailimf_mailbox *) current->data; |
321 | 321 | ||
322 | if ( !first ) { | 322 | if ( !first ) { |
323 | result.append( "," ); | 323 | result.append( "," ); |
324 | } else { | 324 | } else { |
325 | first = false; | 325 | first = false; |
326 | } | 326 | } |
327 | 327 | ||
328 | result.append( parseMailbox( box ) ); | 328 | result.append( parseMailbox( box ) ); |
329 | } | 329 | } |
330 | 330 | ||
331 | return result; | 331 | return result; |
332 | } | 332 | } |
333 | 333 | ||
334 | encodedString* Genericwrapper::fetchDecodedPart(const RecMail&,const RecPart&part) | 334 | encodedString* Genericwrapper::fetchDecodedPart(const RecMail&,const RecPart&part) |
335 | { | 335 | { |
336 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); | 336 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); |
337 | if (it==bodyCache.end()) return new encodedString(); | 337 | if (it==bodyCache.end()) return new encodedString(); |
338 | encodedString*t = decode_String(it.data(),part.Encoding()); | 338 | encodedString*t = decode_String(it.data(),part.Encoding()); |
339 | return t; | 339 | return t; |
340 | } | 340 | } |
341 | 341 | ||
342 | encodedString* Genericwrapper::fetchRawPart(const RecMail&mail,const RecPart&part) | 342 | encodedString* Genericwrapper::fetchRawPart(const RecMail&mail,const RecPart&part) |
343 | { | 343 | { |
344 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); | 344 | QMap<QString,encodedString*>::ConstIterator it = bodyCache.find(part.Identifier()); |
345 | if (it==bodyCache.end()) return new encodedString(); | 345 | if (it==bodyCache.end()) return new encodedString(); |
346 | encodedString*t = it.data(); | 346 | encodedString*t = it.data(); |
347 | return t; | 347 | return t; |
348 | } | 348 | } |
349 | 349 | ||
350 | QString Genericwrapper::fetchTextPart(const RecMail&mail,const RecPart&part) | 350 | QString Genericwrapper::fetchTextPart(const RecMail&mail,const RecPart&part) |
351 | { | 351 | { |
352 | encodedString*t = fetchDecodedPart(mail,part); | 352 | encodedString*t = fetchDecodedPart(mail,part); |
353 | QString text=t->Content(); | 353 | QString text=t->Content(); |
354 | delete t; | 354 | delete t; |
355 | return text; | 355 | return text; |
356 | } | 356 | } |
357 | 357 | ||
358 | void Genericwrapper::cleanMimeCache() | 358 | void Genericwrapper::cleanMimeCache() |
359 | { | 359 | { |
360 | QMap<QString,encodedString*>::Iterator it = bodyCache.begin(); | 360 | QMap<QString,encodedString*>::Iterator it = bodyCache.begin(); |
361 | for (;it!=bodyCache.end();++it) { | 361 | for (;it!=bodyCache.end();++it) { |
362 | encodedString*t = it.data(); | 362 | encodedString*t = it.data(); |
363 | //it.setValue(0); | 363 | //it.setValue(0); |
364 | if (t) delete t; | 364 | if (t) delete t; |
365 | } | 365 | } |
366 | bodyCache.clear(); | 366 | bodyCache.clear(); |
367 | qDebug("Genericwrapper: cache cleaned"); | 367 | qDebug("Genericwrapper: cache cleaned"); |
368 | } | 368 | } |
369 | 369 | ||
370 | QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies) | ||
371 | { | ||
372 | QStringList res; | ||
373 | if (!in_replies || !in_replies->mid_list) return res; | ||
374 | clistiter * current = 0; | ||
375 | for ( current = clist_begin( in_replies->mid_list ); current != NULL; current = current->next ) { | ||
376 | QString h((char*)current->data); | ||
377 | while (h.length()>0 && h[0]=='<') { | ||
378 | h.remove(0,1); | ||
379 | } | ||
380 | while (h.length()>0 && h[h.length()-1]=='>') { | ||
381 | h.remove(h.length()-1,1); | ||
382 | } | ||
383 | if (h.length()>0) { | ||
384 | res.append(h); | ||
385 | } | ||
386 | } | ||
387 | return res; | ||
388 | } | ||
389 | |||
370 | void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox,bool mbox_as_to) | 390 | void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox,bool mbox_as_to) |
371 | { | 391 | { |
372 | int r; | 392 | int r; |
373 | mailmessage_list * env_list = 0; | 393 | mailmessage_list * env_list = 0; |
374 | r = mailsession_get_messages_list(session,&env_list); | 394 | r = mailsession_get_messages_list(session,&env_list); |
375 | if (r != MAIL_NO_ERROR) { | 395 | if (r != MAIL_NO_ERROR) { |
376 | qDebug("Error message list"); | 396 | qDebug("Error message list"); |
377 | return; | 397 | return; |
378 | } | 398 | } |
379 | r = mailsession_get_envelopes_list(session, env_list); | 399 | r = mailsession_get_envelopes_list(session, env_list); |
380 | if (r != MAIL_NO_ERROR) { | 400 | if (r != MAIL_NO_ERROR) { |
381 | qDebug("Error filling message list"); | 401 | qDebug("Error filling message list"); |
382 | if (env_list) { | 402 | if (env_list) { |
383 | mailmessage_list_free(env_list); | 403 | mailmessage_list_free(env_list); |
384 | } | 404 | } |
385 | return; | 405 | return; |
386 | } | 406 | } |
387 | mailimf_references * refs; | 407 | mailimf_references * refs = 0; |
408 | mailimf_in_reply_to * in_replies = 0; | ||
388 | uint32_t i = 0; | 409 | uint32_t i = 0; |
389 | for(; i < carray_count(env_list->msg_tab) ; ++i) { | 410 | for(; i < carray_count(env_list->msg_tab) ; ++i) { |
390 | mailmessage * msg; | 411 | mailmessage * msg; |
391 | QBitArray mFlags(7); | 412 | QBitArray mFlags(7); |
392 | msg = (mailmessage*)carray_get(env_list->msg_tab, i); | 413 | msg = (mailmessage*)carray_get(env_list->msg_tab, i); |
393 | if (msg->msg_fields == NULL) { | 414 | if (msg->msg_fields == NULL) { |
394 | //qDebug("could not fetch envelope of message %i", i); | 415 | //qDebug("could not fetch envelope of message %i", i); |
395 | continue; | 416 | continue; |
396 | } | 417 | } |
397 | RecMail * mail = new RecMail(); | 418 | RecMail * mail = new RecMail(); |
398 | mail->setWrapper(this); | 419 | mail->setWrapper(this); |
399 | mail_flags * flag_result = 0; | 420 | mail_flags * flag_result = 0; |
400 | r = mailmessage_get_flags(msg,&flag_result); | 421 | r = mailmessage_get_flags(msg,&flag_result); |
401 | if (r == MAIL_ERROR_NOT_IMPLEMENTED) { | 422 | if (r == MAIL_ERROR_NOT_IMPLEMENTED) { |
402 | mFlags.setBit(FLAG_SEEN); | 423 | mFlags.setBit(FLAG_SEEN); |
403 | } | 424 | } |
404 | mailimf_single_fields single_fields; | 425 | mailimf_single_fields single_fields; |
405 | mailimf_single_fields_init(&single_fields, msg->msg_fields); | 426 | mailimf_single_fields_init(&single_fields, msg->msg_fields); |
406 | mail->setMsgsize(msg->msg_size); | 427 | mail->setMsgsize(msg->msg_size); |
407 | mail->setFlags(mFlags); | 428 | mail->setFlags(mFlags); |
408 | mail->setMbox(mailbox); | 429 | mail->setMbox(mailbox); |
409 | mail->setNumber(msg->msg_index); | 430 | mail->setNumber(msg->msg_index); |
410 | if (single_fields.fld_subject) | 431 | if (single_fields.fld_subject) |
411 | mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); | 432 | mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); |
412 | if (single_fields.fld_from) | 433 | if (single_fields.fld_from) |
413 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); | 434 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); |
414 | if (!mbox_as_to) { | 435 | if (!mbox_as_to) { |
415 | if (single_fields.fld_to) | 436 | if (single_fields.fld_to) |
416 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); | 437 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); |
417 | } else { | 438 | } else { |
418 | mail->setTo(mailbox); | 439 | mail->setTo(mailbox); |
419 | } | 440 | } |
420 | if (single_fields.fld_cc) | 441 | if (single_fields.fld_cc) |
421 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); | 442 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); |
422 | if (single_fields.fld_bcc) | 443 | if (single_fields.fld_bcc) |
423 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); | 444 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); |
424 | if (single_fields.fld_orig_date) | 445 | if (single_fields.fld_orig_date) |
425 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); | 446 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); |
426 | // crashes when accessing pop3 account? | 447 | // crashes when accessing pop3 account? |
427 | if (single_fields.fld_message_id->mid_value) { | 448 | if (single_fields.fld_message_id->mid_value) { |
428 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); | 449 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); |
429 | qDebug("Msqgid == %s",mail->Msgid().latin1()); | 450 | qDebug("Msgid == %s",mail->Msgid().latin1()); |
430 | } | 451 | } |
452 | |||
431 | refs = single_fields.fld_references; | 453 | refs = single_fields.fld_references; |
432 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { | 454 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { |
433 | char * text = (char*)refs->mid_list->first->data; | 455 | char * text = (char*)refs->mid_list->first->data; |
434 | mail->setReplyto(QString(text)); | 456 | mail->setReplyto(QString(text)); |
435 | } | 457 | } |
458 | if (single_fields.fld_in_reply_to && single_fields.fld_in_reply_to->mid_list && | ||
459 | clist_count(single_fields.fld_in_reply_to->mid_list)) { | ||
460 | mail->setInreply(parseInreplies(single_fields.fld_in_reply_to)); | ||
461 | } | ||
436 | target.append(mail); | 462 | target.append(mail); |
437 | } | 463 | } |
438 | if (env_list) { | 464 | if (env_list) { |
439 | mailmessage_list_free(env_list); | 465 | mailmessage_list_free(env_list); |
440 | } | 466 | } |
441 | } | 467 | } |