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 | |||
@@ -34,5 +34,5 @@ void Genericwrapper::fillSingleBody(RecPart&target,mailmessage*,mailmime*mime) | |||
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; |
@@ -146,5 +146,5 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi | |||
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: |
@@ -242,8 +242,8 @@ 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 | } |
@@ -257,5 +257,5 @@ QString Genericwrapper::parseAddressList( mailimf_address_list *list ) | |||
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( "," ); |
@@ -276,5 +276,5 @@ QString Genericwrapper::parseAddressList( mailimf_address_list *list ) | |||
276 | } | 276 | } |
277 | } | 277 | } |
278 | 278 | ||
279 | return result; | 279 | return result; |
280 | } | 280 | } |
@@ -292,5 +292,5 @@ QString Genericwrapper::parseGroup( mailimf_group *group ) | |||
292 | 292 | ||
293 | result.append( ";" ); | 293 | result.append( ";" ); |
294 | 294 | ||
295 | return result; | 295 | return result; |
296 | } | 296 | } |
@@ -308,5 +308,5 @@ QString Genericwrapper::parseMailbox( mailimf_mailbox *box ) | |||
308 | result.append( ">" ); | 308 | result.append( ">" ); |
309 | } | 309 | } |
310 | 310 | ||
311 | return result; | 311 | return result; |
312 | } | 312 | } |
@@ -325,8 +325,8 @@ QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list ) | |||
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 | } |
@@ -368,4 +368,24 @@ void Genericwrapper::cleanMimeCache() | |||
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 | { |
@@ -385,5 +405,6 @@ void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const | |||
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) { |
@@ -427,6 +448,7 @@ void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const | |||
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)) { |
@@ -434,4 +456,8 @@ void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const | |||
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 | } |