-rw-r--r-- | noncore/net/mail/libmailwrapper/genericwrapper.cpp | 85 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/genericwrapper.h | 1 |
2 files changed, 5 insertions, 81 deletions
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp index 3fe319b..eb2c031 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp | |||
@@ -239,81 +239,4 @@ RecBody Genericwrapper::parseMail( mailmessage * msg ) | |||
239 | } | 239 | } |
240 | 240 | ||
241 | RecMail *Genericwrapper::parseHeader( const char *header ) | ||
242 | { | ||
243 | int err = MAILIMF_NO_ERROR; | ||
244 | size_t curTok = 0; | ||
245 | RecMail *mail = new RecMail(); | ||
246 | mailimf_fields *fields = 0; | ||
247 | mailimf_references * refs = 0; | ||
248 | mailimf_keywords*keys = 0; | ||
249 | QString status; | ||
250 | QString value; | ||
251 | QBitArray mFlags(7); | ||
252 | |||
253 | err = mailimf_fields_parse( (char *) header, strlen( header ), &curTok, &fields ); | ||
254 | for ( clistiter *current = clist_begin( fields->fld_list ); current != NULL; current = current->next ) { | ||
255 | mailimf_field *field = (mailimf_field *) current->data; | ||
256 | switch ( field->fld_type ) { | ||
257 | case MAILIMF_FIELD_FROM: | ||
258 | mail->setFrom( parseMailboxList( field->fld_data.fld_from->frm_mb_list ) ); | ||
259 | break; | ||
260 | case MAILIMF_FIELD_TO: | ||
261 | mail->setTo( parseAddressList( field->fld_data.fld_to->to_addr_list ) ); | ||
262 | break; | ||
263 | case MAILIMF_FIELD_CC: | ||
264 | mail->setCC( parseAddressList( field->fld_data.fld_cc->cc_addr_list ) ); | ||
265 | break; | ||
266 | case MAILIMF_FIELD_BCC: | ||
267 | mail->setBcc( parseAddressList( field->fld_data.fld_bcc->bcc_addr_list ) ); | ||
268 | break; | ||
269 | case MAILIMF_FIELD_SUBJECT: | ||
270 | mail->setSubject(convert_String( field->fld_data.fld_subject->sbj_value ) ); | ||
271 | break; | ||
272 | case MAILIMF_FIELD_ORIG_DATE: | ||
273 | mail->setDate( parseDateTime( field->fld_data.fld_orig_date->dt_date_time ) ); | ||
274 | break; | ||
275 | case MAILIMF_FIELD_MESSAGE_ID: | ||
276 | mail->setMsgid(QString(field->fld_data.fld_message_id->mid_value)); | ||
277 | break; | ||
278 | case MAILIMF_FIELD_REFERENCES: | ||
279 | refs = field->fld_data.fld_references; | ||
280 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { | ||
281 | char * text = (char*)refs->mid_list->first->data; | ||
282 | mail->setReplyto(QString(text)); | ||
283 | } | ||
284 | break; | ||
285 | case MAILIMF_FIELD_KEYWORDS: | ||
286 | keys = field->fld_data.fld_keywords; | ||
287 | for (clistcell*cur = clist_begin(keys->kw_list);cur!=0;cur=clist_next(cur)) { | ||
288 | qDebug("Keyword: %s",(char*)cur->data); | ||
289 | } | ||
290 | break; | ||
291 | case MAILIMF_FIELD_OPTIONAL_FIELD: | ||
292 | status = field->fld_data.fld_optional_field->fld_name; | ||
293 | value = field->fld_data.fld_optional_field->fld_value; | ||
294 | if (status.lower()=="status") { | ||
295 | if (value.lower()=="ro") { | ||
296 | mFlags.setBit(FLAG_SEEN); | ||
297 | } | ||
298 | } else if (status.lower()=="x-status") { | ||
299 | qDebug("X-Status: %s",value.latin1()); | ||
300 | if (value.lower()=="a") { | ||
301 | mFlags.setBit(FLAG_ANSWERED); | ||
302 | } | ||
303 | } else { | ||
304 | // qDebug("Optionales feld: %s -> %s)",field->fld_data.fld_optional_field->fld_name, | ||
305 | // field->fld_data.fld_optional_field->fld_value); | ||
306 | } | ||
307 | break; | ||
308 | default: | ||
309 | qDebug("Non parsed field"); | ||
310 | break; | ||
311 | } | ||
312 | } | ||
313 | if (fields) mailimf_fields_free(fields); | ||
314 | mail->setFlags(mFlags); | ||
315 | return mail; | ||
316 | } | ||
317 | |||
318 | QString Genericwrapper::parseDateTime( mailimf_date_time *date ) | 241 | QString Genericwrapper::parseDateTime( mailimf_date_time *date ) |
319 | { | 242 | { |
@@ -501,7 +424,9 @@ void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const | |||
501 | if (single_fields.fld_orig_date) | 424 | if (single_fields.fld_orig_date) |
502 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); | 425 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); |
503 | // crashes when accessing pop3 account | 426 | // crashes when accessing pop3 account? |
504 | // if (single_fields.fld_message_id->mid_value) | 427 | if (single_fields.fld_message_id->mid_value) { |
505 | // mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); | 428 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); |
429 | qDebug("Msqgid == %s",mail->Msgid().latin1()); | ||
430 | } | ||
506 | refs = single_fields.fld_references; | 431 | refs = single_fields.fld_references; |
507 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { | 432 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { |
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.h b/noncore/net/mail/libmailwrapper/genericwrapper.h index b451416..0870912 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.h +++ b/noncore/net/mail/libmailwrapper/genericwrapper.h | |||
@@ -43,5 +43,4 @@ public: | |||
43 | 43 | ||
44 | protected: | 44 | protected: |
45 | RecMail *parseHeader( const char *header ); | ||
46 | RecBody parseMail( mailmessage * msg ); | 45 | RecBody parseMail( mailmessage * msg ); |
47 | QString parseMailboxList( mailimf_mailbox_list *list ); | 46 | QString parseMailboxList( mailimf_mailbox_list *list ); |