author | alwin <alwin> | 2003-12-19 19:30:47 (UTC) |
---|---|---|
committer | alwin <alwin> | 2003-12-19 19:30:47 (UTC) |
commit | 00a0c8cf03fe746c1e3ba608bf298c8e66d065f9 (patch) (side-by-side diff) | |
tree | 15cd3d961b3f974945f63e86dd314a12eb183575 | |
parent | b66e2d718769a3ac1ae6bc1fc135c04f532bdbf3 (diff) | |
download | opie-00a0c8cf03fe746c1e3ba608bf298c8e66d065f9.zip opie-00a0c8cf03fe746c1e3ba608bf298c8e66d065f9.tar.gz opie-00a0c8cf03fe746c1e3ba608bf298c8e66d065f9.tar.bz2 |
receiving and splitting a mail finished
next step: setup unique ids for attachmenst if not given an cache them.
Note: this could can used later for MH access, too. Means, pop3 and
MH wrapper should get a baseclass for the parsing funs.
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.cpp | 33 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.h | 1 | ||||
-rw-r--r-- | noncore/net/mail/pop3wrapper.cpp | 33 | ||||
-rw-r--r-- | noncore/net/mail/pop3wrapper.h | 1 |
4 files changed, 52 insertions, 16 deletions
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index 2c2a42a..65cd4ba 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp @@ -447,17 +447,12 @@ void POP3wrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mime, size_t len; clistiter * cur = 0; - mailmime_single_fields fields; int res; QString b; - memset(&fields, 0, sizeof(struct mailmime_single_fields)); RecPart part; - if (mime->mm_mime_fields != NULL) { - mailmime_single_fields_init(&fields, mime->mm_mime_fields, - mime->mm_content_type); - } switch (mime->mm_type) { case MAILMIME_SINGLE: r = mailmessage_fetch_section(message,mime,&data,&len); + part.setSize(len); fillSingleBody(part,message,mime); if (part.Type()=="text" && target.Bodytext().isNull()) { @@ -524,6 +519,13 @@ void POP3wrapper::fillSingleBody(RecPart&target,mailmessage*,mailmime*mime) return; } - mailmime_content*type = mime->mm_content_type; mailmime_field*field = 0; + mailmime_single_fields fields; + memset(&fields, 0, sizeof(struct mailmime_single_fields)); + if (mime->mm_mime_fields != NULL) { + mailmime_single_fields_init(&fields, mime->mm_mime_fields, + mime->mm_content_type); + } + + mailmime_content*type = fields.fld_content; clistcell*current; if (!type) { @@ -555,4 +557,7 @@ void POP3wrapper::fillSingleBody(RecPart&target,mailmessage*,mailmime*mime) break; } + if (type->ct_parameters) { + fillParameters(target,type->ct_parameters); + } } if (mime->mm_mime_fields && mime->mm_mime_fields->fld_list) { @@ -574,4 +579,16 @@ void POP3wrapper::fillSingleBody(RecPart&target,mailmessage*,mailmime*mime) } } - // TODO search the parameter list for unique id and so on +} + +void POP3wrapper::fillParameters(RecPart&target,clist*parameters) +{ + if (!parameters) {return;} + clistcell*current=0; + mailmime_parameter*param; + for (current=clist_begin(parameters);current!=0;current=clist_next(current)) { + param = (mailmime_parameter*)current->data; + if (param) { + target.addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); + } + } } diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h index 4171a76..b17928e 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.h +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h @@ -47,4 +47,5 @@ protected: static void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,unsigned int current_rek=0); static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime); + static void fillParameters(RecPart&target,clist*parameters); static QString POP3wrapper::getencoding(mailmime_mechanism*aEnc); diff --git a/noncore/net/mail/pop3wrapper.cpp b/noncore/net/mail/pop3wrapper.cpp index 2c2a42a..65cd4ba 100644 --- a/noncore/net/mail/pop3wrapper.cpp +++ b/noncore/net/mail/pop3wrapper.cpp @@ -447,17 +447,12 @@ void POP3wrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mime, size_t len; clistiter * cur = 0; - mailmime_single_fields fields; int res; QString b; - memset(&fields, 0, sizeof(struct mailmime_single_fields)); RecPart part; - if (mime->mm_mime_fields != NULL) { - mailmime_single_fields_init(&fields, mime->mm_mime_fields, - mime->mm_content_type); - } switch (mime->mm_type) { case MAILMIME_SINGLE: r = mailmessage_fetch_section(message,mime,&data,&len); + part.setSize(len); fillSingleBody(part,message,mime); if (part.Type()=="text" && target.Bodytext().isNull()) { @@ -524,6 +519,13 @@ void POP3wrapper::fillSingleBody(RecPart&target,mailmessage*,mailmime*mime) return; } - mailmime_content*type = mime->mm_content_type; mailmime_field*field = 0; + mailmime_single_fields fields; + memset(&fields, 0, sizeof(struct mailmime_single_fields)); + if (mime->mm_mime_fields != NULL) { + mailmime_single_fields_init(&fields, mime->mm_mime_fields, + mime->mm_content_type); + } + + mailmime_content*type = fields.fld_content; clistcell*current; if (!type) { @@ -555,4 +557,7 @@ void POP3wrapper::fillSingleBody(RecPart&target,mailmessage*,mailmime*mime) break; } + if (type->ct_parameters) { + fillParameters(target,type->ct_parameters); + } } if (mime->mm_mime_fields && mime->mm_mime_fields->fld_list) { @@ -574,4 +579,16 @@ void POP3wrapper::fillSingleBody(RecPart&target,mailmessage*,mailmime*mime) } } - // TODO search the parameter list for unique id and so on +} + +void POP3wrapper::fillParameters(RecPart&target,clist*parameters) +{ + if (!parameters) {return;} + clistcell*current=0; + mailmime_parameter*param; + for (current=clist_begin(parameters);current!=0;current=clist_next(current)) { + param = (mailmime_parameter*)current->data; + if (param) { + target.addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); + } + } } diff --git a/noncore/net/mail/pop3wrapper.h b/noncore/net/mail/pop3wrapper.h index 4171a76..b17928e 100644 --- a/noncore/net/mail/pop3wrapper.h +++ b/noncore/net/mail/pop3wrapper.h @@ -47,4 +47,5 @@ protected: static void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,unsigned int current_rek=0); static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime); + static void fillParameters(RecPart&target,clist*parameters); static QString POP3wrapper::getencoding(mailmime_mechanism*aEnc); |