author | alwin <alwin> | 2004-01-03 13:09:15 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-01-03 13:09:15 (UTC) |
commit | 622bddce6d0cd41c765225f4743b23bf1667f3db (patch) (unidiff) | |
tree | fbe4e839e111e09fce0e64cc68f70f1deb4f7ee0 | |
parent | 22564b62e15c1ea3feada5b2f9b6ec4d98b40c6b (diff) | |
download | opie-622bddce6d0cd41c765225f4743b23bf1667f3db.zip opie-622bddce6d0cd41c765225f4743b23bf1667f3db.tar.gz opie-622bddce6d0cd41c765225f4743b23bf1667f3db.tar.bz2 |
better parsing of mails with recursive multipart content
-rw-r--r-- | noncore/net/mail/genericwrapper.cpp | 26 | ||||
-rw-r--r-- | noncore/net/mail/genericwrapper.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/genericwrapper.cpp | 26 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/genericwrapper.h | 2 |
4 files changed, 44 insertions, 12 deletions
diff --git a/noncore/net/mail/genericwrapper.cpp b/noncore/net/mail/genericwrapper.cpp index 62116ba..714396b 100644 --- a/noncore/net/mail/genericwrapper.cpp +++ b/noncore/net/mail/genericwrapper.cpp | |||
@@ -139,6 +139,4 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi | |||
139 | RecPart part; | 139 | RecPart part; |
140 | 140 | ||
141 | //current_count; | ||
142 | |||
143 | switch (mime->mm_type) { | 141 | switch (mime->mm_type) { |
144 | case MAILMIME_SINGLE: | 142 | case MAILMIME_SINGLE: |
@@ -156,6 +154,11 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi | |||
156 | r->setContent(data,len); | 154 | r->setContent(data,len); |
157 | encodedString*res = decode_String(r,part.Encoding()); | 155 | encodedString*res = decode_String(r,part.Encoding()); |
156 | if (countlist.count()>2) { | ||
157 | bodyCache[b]=r; | ||
158 | target.addPart(part); | ||
159 | } else { | ||
160 | delete r; | ||
161 | } | ||
158 | b = QString(res->Content()); | 162 | b = QString(res->Content()); |
159 | delete r; | ||
160 | delete res; | 163 | delete res; |
161 | target.setBodytext(b); | 164 | target.setBodytext(b); |
@@ -169,7 +172,20 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi | |||
169 | case MAILMIME_MULTIPLE: | 172 | case MAILMIME_MULTIPLE: |
170 | { | 173 | { |
171 | unsigned int ccount = current_count; | 174 | unsigned int ccount = 1; |
175 | mailmime*cbody=0; | ||
176 | QValueList<int>countlist = recList; | ||
172 | for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { | 177 | for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { |
173 | traverseBody(target,message, (mailmime*)clist_content(cur),recList,current_rec+1,ccount); | 178 | cbody = (mailmime*)clist_content(cur); |
179 | if (cbody->mm_type==MAILMIME_MULTIPLE) { | ||
180 | RecPart targetPart; | ||
181 | targetPart.setType("multipart"); | ||
182 | countlist.append(current_count); | ||
183 | targetPart.setPositionlist(countlist); | ||
184 | target.addPart(targetPart); | ||
185 | } | ||
186 | traverseBody(target,message, cbody,countlist,current_rec+1,ccount); | ||
187 | if (cbody->mm_type==MAILMIME_MULTIPLE) { | ||
188 | countlist = recList; | ||
189 | } | ||
174 | ++ccount; | 190 | ++ccount; |
175 | } | 191 | } |
diff --git a/noncore/net/mail/genericwrapper.h b/noncore/net/mail/genericwrapper.h index c00d864..32b75c8 100644 --- a/noncore/net/mail/genericwrapper.h +++ b/noncore/net/mail/genericwrapper.h | |||
@@ -46,5 +46,5 @@ protected: | |||
46 | QString parseDateTime( mailimf_date_time *date ); | 46 | QString parseDateTime( mailimf_date_time *date ); |
47 | 47 | ||
48 | void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=0); | 48 | void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1); |
49 | static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime); | 49 | static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime); |
50 | static void fillParameters(RecPart&target,clist*parameters); | 50 | static void fillParameters(RecPart&target,clist*parameters); |
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp index 62116ba..714396b 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp | |||
@@ -139,6 +139,4 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi | |||
139 | RecPart part; | 139 | RecPart part; |
140 | 140 | ||
141 | //current_count; | ||
142 | |||
143 | switch (mime->mm_type) { | 141 | switch (mime->mm_type) { |
144 | case MAILMIME_SINGLE: | 142 | case MAILMIME_SINGLE: |
@@ -156,6 +154,11 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi | |||
156 | r->setContent(data,len); | 154 | r->setContent(data,len); |
157 | encodedString*res = decode_String(r,part.Encoding()); | 155 | encodedString*res = decode_String(r,part.Encoding()); |
156 | if (countlist.count()>2) { | ||
157 | bodyCache[b]=r; | ||
158 | target.addPart(part); | ||
159 | } else { | ||
160 | delete r; | ||
161 | } | ||
158 | b = QString(res->Content()); | 162 | b = QString(res->Content()); |
159 | delete r; | ||
160 | delete res; | 163 | delete res; |
161 | target.setBodytext(b); | 164 | target.setBodytext(b); |
@@ -169,7 +172,20 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi | |||
169 | case MAILMIME_MULTIPLE: | 172 | case MAILMIME_MULTIPLE: |
170 | { | 173 | { |
171 | unsigned int ccount = current_count; | 174 | unsigned int ccount = 1; |
175 | mailmime*cbody=0; | ||
176 | QValueList<int>countlist = recList; | ||
172 | for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { | 177 | for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { |
173 | traverseBody(target,message, (mailmime*)clist_content(cur),recList,current_rec+1,ccount); | 178 | cbody = (mailmime*)clist_content(cur); |
179 | if (cbody->mm_type==MAILMIME_MULTIPLE) { | ||
180 | RecPart targetPart; | ||
181 | targetPart.setType("multipart"); | ||
182 | countlist.append(current_count); | ||
183 | targetPart.setPositionlist(countlist); | ||
184 | target.addPart(targetPart); | ||
185 | } | ||
186 | traverseBody(target,message, cbody,countlist,current_rec+1,ccount); | ||
187 | if (cbody->mm_type==MAILMIME_MULTIPLE) { | ||
188 | countlist = recList; | ||
189 | } | ||
174 | ++ccount; | 190 | ++ccount; |
175 | } | 191 | } |
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.h b/noncore/net/mail/libmailwrapper/genericwrapper.h index c00d864..32b75c8 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.h +++ b/noncore/net/mail/libmailwrapper/genericwrapper.h | |||
@@ -46,5 +46,5 @@ protected: | |||
46 | QString parseDateTime( mailimf_date_time *date ); | 46 | QString parseDateTime( mailimf_date_time *date ); |
47 | 47 | ||
48 | void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=0); | 48 | void traverseBody(RecBody&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rek=0,int current_count=1); |
49 | static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime); | 49 | static void fillSingleBody(RecPart&target,mailmessage*message,mailmime*mime); |
50 | static void fillParameters(RecPart&target,clist*parameters); | 50 | static void fillParameters(RecPart&target,clist*parameters); |