author | alwin <alwin> | 2004-03-08 21:43:14 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-08 21:43:14 (UTC) |
commit | 25434cbbcd2d2473c9cd3d486cec7a96a6a6323e (patch) (side-by-side diff) | |
tree | 31cfa6ceaebe0e2e1e0094e4905d05509e778364 /noncore/net/mail/libmailwrapper/genericwrapper.cpp | |
parent | f3f2b2b3389d62af0f1a3aabac87f6c3cf147379 (diff) | |
download | opie-25434cbbcd2d2473c9cd3d486cec7a96a6a6323e.zip opie-25434cbbcd2d2473c9cd3d486cec7a96a6a6323e.tar.gz opie-25434cbbcd2d2473c9cd3d486cec7a96a6a6323e.tar.bz2 |
some required code restructuring in preparation of new features
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) mime->mm_content_type); } - + mailmime_content*type = fields.fld_content; clistcell*current; @@ -146,5 +146,5 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi QString b; RecPart part; - + switch (mime->mm_type) { case MAILMIME_SINGLE: @@ -242,8 +242,8 @@ QString Genericwrapper::parseDateTime( mailimf_date_time *date ) { char tmp[23]; - - snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i", + + snprintf( tmp, 23, "%02i.%02i.%04i %02i:%02i:%02i %+05i", date->dt_day, date->dt_month, date->dt_year, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); - + return QString( tmp ); } @@ -257,5 +257,5 @@ QString Genericwrapper::parseAddressList( mailimf_address_list *list ) for ( clistiter *current = clist_begin( list->ad_list ); current != NULL; current = current->next ) { mailimf_address *addr = (mailimf_address *) current->data; - + if ( !first ) { result.append( "," ); @@ -276,5 +276,5 @@ QString Genericwrapper::parseAddressList( mailimf_address_list *list ) } } - + return result; } @@ -292,5 +292,5 @@ QString Genericwrapper::parseGroup( mailimf_group *group ) result.append( ";" ); - + return result; } @@ -308,5 +308,5 @@ QString Genericwrapper::parseMailbox( mailimf_mailbox *box ) result.append( ">" ); } - + return result; } @@ -325,8 +325,8 @@ QString Genericwrapper::parseMailboxList( mailimf_mailbox_list *list ) first = false; } - + result.append( parseMailbox( box ) ); } - + return result; } @@ -368,4 +368,24 @@ void Genericwrapper::cleanMimeCache() } +QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies) +{ + QStringList res; + if (!in_replies || !in_replies->mid_list) return res; + clistiter * current = 0; + for ( current = clist_begin( in_replies->mid_list ); current != NULL; current = current->next ) { + QString h((char*)current->data); + while (h.length()>0 && h[0]=='<') { + h.remove(0,1); + } + while (h.length()>0 && h[h.length()-1]=='>') { + h.remove(h.length()-1,1); + } + if (h.length()>0) { + res.append(h); + } + } + return res; +} + void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const QString&mailbox,bool mbox_as_to) { @@ -385,5 +405,6 @@ void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const return; } - mailimf_references * refs; + mailimf_references * refs = 0; + mailimf_in_reply_to * in_replies = 0; uint32_t i = 0; for(; i < carray_count(env_list->msg_tab) ; ++i) { @@ -427,6 +448,7 @@ void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const if (single_fields.fld_message_id->mid_value) { mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); - qDebug("Msqgid == %s",mail->Msgid().latin1()); + qDebug("Msgid == %s",mail->Msgid().latin1()); } + refs = single_fields.fld_references; if (refs && refs->mid_list && clist_count(refs->mid_list)) { @@ -434,4 +456,8 @@ void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const mail->setReplyto(QString(text)); } + if (single_fields.fld_in_reply_to && single_fields.fld_in_reply_to->mid_list && + clist_count(single_fields.fld_in_reply_to->mid_list)) { + mail->setInreply(parseInreplies(single_fields.fld_in_reply_to)); + } target.append(mail); } |