Diffstat (limited to 'noncore/net/mail/libmailwrapper/pop3wrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.cpp | 49 |
1 files changed, 41 insertions, 8 deletions
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index 30f80ff..22a4c70 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp @@ -5,4 +5,8 @@ #include <libetpan/mailmime.h> +#include <libetpan/data_message_driver.h> #include <qfile.h> +/* we don't fetch messages larger than 5 MB */ +#define HARD_MSG_SIZE_LIMIT 5242880 + POP3wrapper::POP3wrapper( POP3account *a ) @@ -39,2 +43,3 @@ RecBody POP3wrapper::fetchBody( const RecMail &mail ) } + RecBody body; @@ -43,2 +48,6 @@ RecBody POP3wrapper::fetchBody( const RecMail &mail ) + if (mail.Msgsize()>HARD_MSG_SIZE_LIMIT) { + qDebug("Message to large: %i",mail.Msgsize()); + return body; + } if (mail.getNumber()!=last_msg_id) { @@ -81,2 +90,6 @@ RecBody POP3wrapper::parseMail( char *message ) mailimf_message *result = 0; + mailmessage * msg=0; + struct mailmime * mime=0; + struct mailmime_single_fields fields; + RecBody body; @@ -89,7 +102,27 @@ RecBody POP3wrapper::parseMail( char *message ) } - - struct mailimf_body * b = 0; - struct mailimf_fields * f = 0; - - + +#if 0 + char*body_msg = message; + if ( result && result->msg_body && result->msg_body->bd_text ) { + body_msg = (char*)result->msg_body->bd_text; + result->msg_body->bd_text = 0; + } + + msg = mailmessage_new(); + mailmessage_init(msg, NULL, data_message_driver, 0, strlen(body_msg)); + generic_message_t * msg_data; + msg_data = (generic_message_t *)msg->msg_data; + msg_data->msg_fetched = 1; + msg_data->msg_message = body_msg; + msg_data->msg_length = strlen(body_msg); + memset(&fields, 0, sizeof(struct mailmime_single_fields)); + err = mailmessage_get_bodystructure(msg,&mime); + + if (mime->mm_mime_fields != NULL) { + mailmime_single_fields_init(&fields, mime->mm_mime_fields, + mime->mm_content_type); + } +#endif + +#if 1 if ( result && result->msg_body && result->msg_body->bd_text ) { @@ -110,2 +143,3 @@ RecBody POP3wrapper::parseMail( char *message ) } +#endif return body; @@ -174,3 +208,3 @@ RecMail *POP3wrapper::parseHeader( const char *header ) case MAILIMF_FIELD_SUBJECT: - mail->setSubject( QString( field->fld_data.fld_subject->sbj_value ) ); + mail->setSubject(convert_String( field->fld_data.fld_subject->sbj_value ) ); break; @@ -205,3 +239,2 @@ RecMail *POP3wrapper::parseHeader( const char *header ) if (value.lower()=="a") { - mFlags.setBit(FLAG_ANSWERED); @@ -286,3 +319,3 @@ QString POP3wrapper::parseMailbox( mailimf_mailbox *box ) } else { - result.append( box->mb_display_name ); + result.append( convert_String(box->mb_display_name).latin1() ); result.append( " <" ); |