summaryrefslogtreecommitdiff
authoralwin <alwin>2004-03-08 03:04:35 (UTC)
committer alwin <alwin>2004-03-08 03:04:35 (UTC)
commit25d95c1b4e61445c695177c79049ccf7741e83f7 (patch) (unidiff)
tree9f90bf01e587fcd6a9bf0b2c52da7ae98f4871f0
parent9553bf83fd98812781b5d15aad9b69daaadec3f5 (diff)
downloadopie-25d95c1b4e61445c695177c79049ccf7741e83f7.zip
opie-25d95c1b4e61445c695177c79049ccf7741e83f7.tar.gz
opie-25d95c1b4e61445c695177c79049ccf7741e83f7.tar.bz2
obsolete methode removed
store msgids when parsing a mail-header
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/genericwrapper.cpp85
-rw-r--r--noncore/net/mail/libmailwrapper/genericwrapper.h1
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
@@ -238,83 +238,6 @@ RecBody Genericwrapper::parseMail( mailmessage * msg )
238 return body; 238 return body;
239} 239}
240 240
241RecMail *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
318QString Genericwrapper::parseDateTime( mailimf_date_time *date ) 241QString Genericwrapper::parseDateTime( mailimf_date_time *date )
319{ 242{
320 char tmp[23]; 243 char tmp[23];
@@ -500,9 +423,11 @@ void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const
500 mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); 423 mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) );
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)) {
508 char * text = (char*)refs->mid_list->first->data; 433 char * text = (char*)refs->mid_list->first->data;
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
@@ -42,7 +42,6 @@ public:
42 virtual void storeMessage(const char*msg,size_t length, const QString&folder){}; 42 virtual void storeMessage(const char*msg,size_t length, const QString&folder){};
43 43
44protected: 44protected:
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 );
48 QString parseMailbox( mailimf_mailbox *box ); 47 QString parseMailbox( mailimf_mailbox *box );