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 @@ | |||
5 | #include <libetpan/mailmime.h> | 5 | #include <libetpan/mailmime.h> |
6 | #include <libetpan/data_message_driver.h> | ||
6 | #include <qfile.h> | 7 | #include <qfile.h> |
7 | 8 | ||
9 | /* we don't fetch messages larger than 5 MB */ | ||
10 | #define HARD_MSG_SIZE_LIMIT 5242880 | ||
11 | |||
8 | POP3wrapper::POP3wrapper( POP3account *a ) | 12 | POP3wrapper::POP3wrapper( POP3account *a ) |
@@ -39,2 +43,3 @@ RecBody POP3wrapper::fetchBody( const RecMail &mail ) | |||
39 | } | 43 | } |
44 | |||
40 | RecBody body; | 45 | RecBody body; |
@@ -43,2 +48,6 @@ RecBody POP3wrapper::fetchBody( const RecMail &mail ) | |||
43 | 48 | ||
49 | if (mail.Msgsize()>HARD_MSG_SIZE_LIMIT) { | ||
50 | qDebug("Message to large: %i",mail.Msgsize()); | ||
51 | return body; | ||
52 | } | ||
44 | if (mail.getNumber()!=last_msg_id) { | 53 | if (mail.getNumber()!=last_msg_id) { |
@@ -81,2 +90,6 @@ RecBody POP3wrapper::parseMail( char *message ) | |||
81 | mailimf_message *result = 0; | 90 | mailimf_message *result = 0; |
91 | mailmessage * msg=0; | ||
92 | struct mailmime * mime=0; | ||
93 | struct mailmime_single_fields fields; | ||
94 | |||
82 | RecBody body; | 95 | RecBody body; |
@@ -89,7 +102,27 @@ RecBody POP3wrapper::parseMail( char *message ) | |||
89 | } | 102 | } |
90 | 103 | ||
91 | struct mailimf_body * b = 0; | 104 | #if 0 |
92 | struct mailimf_fields * f = 0; | 105 | char*body_msg = message; |
93 | 106 | if ( result && result->msg_body && result->msg_body->bd_text ) { | |
94 | 107 | body_msg = (char*)result->msg_body->bd_text; | |
108 | result->msg_body->bd_text = 0; | ||
109 | } | ||
110 | |||
111 | msg = mailmessage_new(); | ||
112 | mailmessage_init(msg, NULL, data_message_driver, 0, strlen(body_msg)); | ||
113 | generic_message_t * msg_data; | ||
114 | msg_data = (generic_message_t *)msg->msg_data; | ||
115 | msg_data->msg_fetched = 1; | ||
116 | msg_data->msg_message = body_msg; | ||
117 | msg_data->msg_length = strlen(body_msg); | ||
118 | memset(&fields, 0, sizeof(struct mailmime_single_fields)); | ||
119 | err = mailmessage_get_bodystructure(msg,&mime); | ||
120 | |||
121 | if (mime->mm_mime_fields != NULL) { | ||
122 | mailmime_single_fields_init(&fields, mime->mm_mime_fields, | ||
123 | mime->mm_content_type); | ||
124 | } | ||
125 | #endif | ||
126 | |||
127 | #if 1 | ||
95 | if ( result && result->msg_body && result->msg_body->bd_text ) { | 128 | if ( result && result->msg_body && result->msg_body->bd_text ) { |
@@ -110,2 +143,3 @@ RecBody POP3wrapper::parseMail( char *message ) | |||
110 | } | 143 | } |
144 | #endif | ||
111 | return body; | 145 | return body; |
@@ -174,3 +208,3 @@ RecMail *POP3wrapper::parseHeader( const char *header ) | |||
174 | case MAILIMF_FIELD_SUBJECT: | 208 | case MAILIMF_FIELD_SUBJECT: |
175 | mail->setSubject( QString( field->fld_data.fld_subject->sbj_value ) ); | 209 | mail->setSubject(convert_String( field->fld_data.fld_subject->sbj_value ) ); |
176 | break; | 210 | break; |
@@ -205,3 +239,2 @@ RecMail *POP3wrapper::parseHeader( const char *header ) | |||
205 | if (value.lower()=="a") { | 239 | if (value.lower()=="a") { |
206 | |||
207 | mFlags.setBit(FLAG_ANSWERED); | 240 | mFlags.setBit(FLAG_ANSWERED); |
@@ -286,3 +319,3 @@ QString POP3wrapper::parseMailbox( mailimf_mailbox *box ) | |||
286 | } else { | 319 | } else { |
287 | result.append( box->mb_display_name ); | 320 | result.append( convert_String(box->mb_display_name).latin1() ); |
288 | result.append( " <" ); | 321 | result.append( " <" ); |