Diffstat (limited to 'noncore/net/mail/libmailwrapper/genericwrapper.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/genericwrapper.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
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 | |||
@@ -129,57 +129,73 @@ void Genericwrapper::traverseBody(RecBody&target,mailmessage*message,mailmime*mi | |||
129 | qDebug("too deep recursion!"); | 129 | qDebug("too deep recursion!"); |
130 | } | 130 | } |
131 | if (!message || !mime) { | 131 | if (!message || !mime) { |
132 | return; | 132 | return; |
133 | } | 133 | } |
134 | int r; | 134 | int r; |
135 | char*data = 0; | 135 | char*data = 0; |
136 | size_t len; | 136 | size_t len; |
137 | clistiter * cur = 0; | 137 | clistiter * cur = 0; |
138 | QString b; | 138 | QString b; |
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: |
145 | { | 143 | { |
146 | QValueList<int>countlist = recList; | 144 | QValueList<int>countlist = recList; |
147 | countlist.append(current_count); | 145 | countlist.append(current_count); |
148 | r = mailmessage_fetch_section(message,mime,&data,&len); | 146 | r = mailmessage_fetch_section(message,mime,&data,&len); |
149 | part.setSize(len); | 147 | part.setSize(len); |
150 | part.setPositionlist(countlist); | 148 | part.setPositionlist(countlist); |
151 | b = gen_attachment_id(); | 149 | b = gen_attachment_id(); |
152 | part.setIdentifier(b); | 150 | part.setIdentifier(b); |
153 | fillSingleBody(part,message,mime); | 151 | fillSingleBody(part,message,mime); |
154 | if (part.Type()=="text" && target.Bodytext().isNull()) { | 152 | if (part.Type()=="text" && target.Bodytext().isNull()) { |
155 | encodedString*r = new encodedString(); | 153 | encodedString*r = new encodedString(); |
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()); |
158 | b = QString(res->Content()); | 156 | if (countlist.count()>2) { |
157 | bodyCache[b]=r; | ||
158 | target.addPart(part); | ||
159 | } else { | ||
159 | delete r; | 160 | delete r; |
161 | } | ||
162 | b = QString(res->Content()); | ||
160 | delete res; | 163 | delete res; |
161 | target.setBodytext(b); | 164 | target.setBodytext(b); |
162 | target.setDescription(part); | 165 | target.setDescription(part); |
163 | } else { | 166 | } else { |
164 | bodyCache[b]=new encodedString(data,len); | 167 | bodyCache[b]=new encodedString(data,len); |
165 | target.addPart(part); | 168 | target.addPart(part); |
166 | } | 169 | } |
167 | } | 170 | } |
168 | break; | 171 | break; |
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 | } |
176 | } | 192 | } |
177 | break; | 193 | break; |
178 | case MAILMIME_MESSAGE: | 194 | case MAILMIME_MESSAGE: |
179 | { | 195 | { |
180 | QValueList<int>countlist = recList; | 196 | QValueList<int>countlist = recList; |
181 | countlist.append(current_count); | 197 | countlist.append(current_count); |
182 | /* the own header is always at recursion 0 - we don't need that */ | 198 | /* the own header is always at recursion 0 - we don't need that */ |
183 | if (current_rec > 0) { | 199 | if (current_rec > 0) { |
184 | part.setPositionlist(countlist); | 200 | part.setPositionlist(countlist); |
185 | r = mailmessage_fetch_section(message,mime,&data,&len); | 201 | r = mailmessage_fetch_section(message,mime,&data,&len); |