summaryrefslogtreecommitdiff
authoralwin <alwin>2004-01-02 02:46:27 (UTC)
committer alwin <alwin>2004-01-02 02:46:27 (UTC)
commit5fbf2a6b9cda98ab16fa1f0e1ac848a9bb523a72 (patch) (side-by-side diff)
tree3056d87b4ef4f5684f357b3aa45dd654f3b49e14
parent8bd5873a04bc8c506694d00be4111549d969fd2a (diff)
downloadopie-5fbf2a6b9cda98ab16fa1f0e1ac848a9bb523a72.zip
opie-5fbf2a6b9cda98ab16fa1f0e1ac848a9bb523a72.tar.gz
opie-5fbf2a6b9cda98ab16fa1f0e1ac848a9bb523a72.tar.bz2
mail-parts will get a path id for hierarchic structure of the content
while displaying enclosed rfc mails (like forwards) will be marked as a body-part.
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/genericwrapper.cpp41
-rw-r--r--noncore/net/mail/genericwrapper.h2
-rw-r--r--noncore/net/mail/libmailwrapper/genericwrapper.cpp41
-rw-r--r--noncore/net/mail/libmailwrapper/genericwrapper.h2
4 files changed, 72 insertions, 14 deletions
diff --git a/noncore/net/mail/genericwrapper.cpp b/noncore/net/mail/genericwrapper.cpp
index bef6ae5..5de9299 100644
--- a/noncore/net/mail/genericwrapper.cpp
+++ b/noncore/net/mail/genericwrapper.cpp
@@ -125,3 +125,3 @@ QString Genericwrapper::getencoding(mailmime_mechanism*aEnc)
-void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mime,unsigned int current_rec)
+void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count)
{
@@ -140,6 +140,14 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi
+ //current_count;
+
switch (mime->mm_type) {
case MAILMIME_SINGLE:
+ {
+ QValueList<int>countlist = recList;
+ countlist.append(current_count);
r = mailmessage_fetch_section(message,mime,&data,&len);
part.setSize(len);
+ part.setPositionlist(countlist);
+ b = gen_attachment_id();
+ part.setIdentifier(b);
fillSingleBody(part,message,mime);
@@ -155,4 +163,2 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi
} else {
- b = gen_attachment_id();
- part.setIdentifier(b);
bodyCache[b]=new encodedString(data,len);
@@ -160,6 +166,11 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi
}
+ }
break;
case MAILMIME_MULTIPLE:
+ {
+ unsigned int ccount = current_count;
for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) {
- traverseBody(target,message, (mailmime*)clist_content(cur),current_rec+1);
+ traverseBody(target,message, (mailmime*)clist_content(cur),recList,current_rec+1,ccount);
+ ++ccount;
+ }
}
@@ -167,4 +178,21 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi
case MAILMIME_MESSAGE:
+ {
+ QValueList<int>countlist = recList;
+ countlist.append(current_count);
+ /* the own header is always at recursion 0 - we don't need that */
+ if (current_rec > 0) {
+ part.setPositionlist(countlist);
+ r = mailmessage_fetch_section(message,mime,&data,&len);
+ part.setSize(len);
+ part.setPositionlist(countlist);
+ b = gen_attachment_id();
+ part.setIdentifier(b);
+ part.setType("message");
+ part.setSubtype("rfc822");
+ bodyCache[b]=new encodedString(data,len);
+ target.addPart(part);
+ }
if (mime->mm_data.mm_message.mm_msg_mime != NULL) {
- traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,current_rec+1);
+ traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1);
+ }
}
@@ -183,3 +211,4 @@ RecBody Genericwrapper::parseMail( mailmessage * msg )
err = mailmessage_get_bodystructure(msg,&mime);
- traverseBody(body,msg,mime);
+ QValueList<int>recList;
+ traverseBody(body,msg,mime,recList);
return body;
diff --git a/noncore/net/mail/genericwrapper.h b/noncore/net/mail/genericwrapper.h
index 54d6ea9..c00d864 100644
--- a/noncore/net/mail/genericwrapper.h
+++ b/noncore/net/mail/genericwrapper.h
@@ -47,3 +47,3 @@ protected:
- void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,unsigned int current_rek=0);
+ void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=0);
static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime);
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp
index bef6ae5..5de9299 100644
--- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp
@@ -125,3 +125,3 @@ QString Genericwrapper::getencoding(mailmime_mechanism*aEnc)
-void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mime,unsigned int current_rec)
+void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count)
{
@@ -140,6 +140,14 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi
+ //current_count;
+
switch (mime->mm_type) {
case MAILMIME_SINGLE:
+ {
+ QValueList<int>countlist = recList;
+ countlist.append(current_count);
r = mailmessage_fetch_section(message,mime,&data,&len);
part.setSize(len);
+ part.setPositionlist(countlist);
+ b = gen_attachment_id();
+ part.setIdentifier(b);
fillSingleBody(part,message,mime);
@@ -155,4 +163,2 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi
} else {
- b = gen_attachment_id();
- part.setIdentifier(b);
bodyCache[b]=new encodedString(data,len);
@@ -160,6 +166,11 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi
}
+ }
break;
case MAILMIME_MULTIPLE:
+ {
+ unsigned int ccount = current_count;
for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) {
- traverseBody(target,message, (mailmime*)clist_content(cur),current_rec+1);
+ traverseBody(target,message, (mailmime*)clist_content(cur),recList,current_rec+1,ccount);
+ ++ccount;
+ }
}
@@ -167,4 +178,21 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi
case MAILMIME_MESSAGE:
+ {
+ QValueList<int>countlist = recList;
+ countlist.append(current_count);
+ /* the own header is always at recursion 0 - we don't need that */
+ if (current_rec > 0) {
+ part.setPositionlist(countlist);
+ r = mailmessage_fetch_section(message,mime,&data,&len);
+ part.setSize(len);
+ part.setPositionlist(countlist);
+ b = gen_attachment_id();
+ part.setIdentifier(b);
+ part.setType("message");
+ part.setSubtype("rfc822");
+ bodyCache[b]=new encodedString(data,len);
+ target.addPart(part);
+ }
if (mime->mm_data.mm_message.mm_msg_mime != NULL) {
- traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,current_rec+1);
+ traverseBody(target,message,mime->mm_data.mm_message.mm_msg_mime,countlist,current_rec+1);
+ }
}
@@ -183,3 +211,4 @@ RecBody Genericwrapper::parseMail( mailmessage * msg )
err = mailmessage_get_bodystructure(msg,&mime);
- traverseBody(body,msg,mime);
+ QValueList<int>recList;
+ traverseBody(body,msg,mime,recList);
return body;
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.h b/noncore/net/mail/libmailwrapper/genericwrapper.h
index 54d6ea9..c00d864 100644
--- a/noncore/net/mail/libmailwrapper/genericwrapper.h
+++ b/noncore/net/mail/libmailwrapper/genericwrapper.h
@@ -47,3 +47,3 @@ protected:
- void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,unsigned int current_rek=0);
+ void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=0);
static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime);