summaryrefslogtreecommitdiff
authoralwin <alwin>2004-03-08 03:04:35 (UTC)
committer alwin <alwin>2004-03-08 03:04:35 (UTC)
commit25d95c1b4e61445c695177c79049ccf7741e83f7 (patch) (side-by-side diff)
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
@@ -233,93 +233,16 @@ RecBody Genericwrapper::parseMail( mailmessage * msg )
RecBody body;
memset(&fields, 0, sizeof(struct mailmime_single_fields));
err = mailmessage_get_bodystructure(msg,&mime);
QValueList<int>recList;
traverseBody(body,msg,mime,recList);
return body;
}
-RecMail *Genericwrapper::parseHeader( const char *header )
-{
- int err = MAILIMF_NO_ERROR;
- size_t curTok = 0;
- RecMail *mail = new RecMail();
- mailimf_fields *fields = 0;
- mailimf_references * refs = 0;
- mailimf_keywords*keys = 0;
- QString status;
- QString value;
- QBitArray mFlags(7);
-
- err = mailimf_fields_parse( (char *) header, strlen( header ), &curTok, &fields );
- for ( clistiter *current = clist_begin( fields->fld_list ); current != NULL; current = current->next ) {
- mailimf_field *field = (mailimf_field *) current->data;
- switch ( field->fld_type ) {
- case MAILIMF_FIELD_FROM:
- mail->setFrom( parseMailboxList( field->fld_data.fld_from->frm_mb_list ) );
- break;
- case MAILIMF_FIELD_TO:
- mail->setTo( parseAddressList( field->fld_data.fld_to->to_addr_list ) );
- break;
- case MAILIMF_FIELD_CC:
- mail->setCC( parseAddressList( field->fld_data.fld_cc->cc_addr_list ) );
- break;
- case MAILIMF_FIELD_BCC:
- mail->setBcc( parseAddressList( field->fld_data.fld_bcc->bcc_addr_list ) );
- break;
- case MAILIMF_FIELD_SUBJECT:
- mail->setSubject(convert_String( field->fld_data.fld_subject->sbj_value ) );
- break;
- case MAILIMF_FIELD_ORIG_DATE:
- mail->setDate( parseDateTime( field->fld_data.fld_orig_date->dt_date_time ) );
- break;
- case MAILIMF_FIELD_MESSAGE_ID:
- mail->setMsgid(QString(field->fld_data.fld_message_id->mid_value));
- break;
- case MAILIMF_FIELD_REFERENCES:
- refs = field->fld_data.fld_references;
- if (refs && refs->mid_list && clist_count(refs->mid_list)) {
- char * text = (char*)refs->mid_list->first->data;
- mail->setReplyto(QString(text));
- }
- break;
- case MAILIMF_FIELD_KEYWORDS:
- keys = field->fld_data.fld_keywords;
- for (clistcell*cur = clist_begin(keys->kw_list);cur!=0;cur=clist_next(cur)) {
- qDebug("Keyword: %s",(char*)cur->data);
- }
- break;
- case MAILIMF_FIELD_OPTIONAL_FIELD:
- status = field->fld_data.fld_optional_field->fld_name;
- value = field->fld_data.fld_optional_field->fld_value;
- if (status.lower()=="status") {
- if (value.lower()=="ro") {
- mFlags.setBit(FLAG_SEEN);
- }
- } else if (status.lower()=="x-status") {
- qDebug("X-Status: %s",value.latin1());
- if (value.lower()=="a") {
- mFlags.setBit(FLAG_ANSWERED);
- }
- } else {
-// qDebug("Optionales feld: %s -> %s)",field->fld_data.fld_optional_field->fld_name,
-// field->fld_data.fld_optional_field->fld_value);
- }
- break;
- default:
- qDebug("Non parsed field");
- break;
- }
- }
- if (fields) mailimf_fields_free(fields);
- mail->setFlags(mFlags);
- return mail;
-}
-
QString Genericwrapper::parseDateTime( mailimf_date_time *date )
{
char tmp[23];
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 );
@@ -495,19 +418,21 @@ void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const
mail->setTo(mailbox);
}
if (single_fields.fld_cc)
mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) );
if (single_fields.fld_bcc)
mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) );
if (single_fields.fld_orig_date)
mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) );
- // crashes when accessing pop3 account
- // if (single_fields.fld_message_id->mid_value)
- // mail->setMsgid(QString(single_fields.fld_message_id->mid_value));
+ // crashes when accessing pop3 account?
+ if (single_fields.fld_message_id->mid_value) {
+ mail->setMsgid(QString(single_fields.fld_message_id->mid_value));
+ qDebug("Msqgid == %s",mail->Msgid().latin1());
+ }
refs = single_fields.fld_references;
if (refs && refs->mid_list && clist_count(refs->mid_list)) {
char * text = (char*)refs->mid_list->first->data;
mail->setReplyto(QString(text));
}
target.append(mail);
}
if (env_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
@@ -37,17 +37,16 @@ public:
virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part);
virtual QString fetchTextPart(const RecMail&mail,const RecPart&part);
virtual void cleanMimeCache();
virtual int deleteMbox(const Folder*){return 1;}
virtual void logout(){};
virtual void storeMessage(const char*msg,size_t length, const QString&folder){};
protected:
- RecMail *parseHeader( const char *header );
RecBody parseMail( mailmessage * msg );
QString parseMailboxList( mailimf_mailbox_list *list );
QString parseMailbox( mailimf_mailbox *box );
QString parseGroup( mailimf_group *group );
QString parseAddressList( mailimf_address_list *list );
QString parseDateTime( mailimf_date_time *date );
void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1);