summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper
authorzautrix <zautrix>2004-11-07 19:40:36 (UTC)
committer zautrix <zautrix>2004-11-07 19:40:36 (UTC)
commit90e33436f6d1c502a5620760ac6592b9881ee4ab (patch) (unidiff)
treef493a1eeecd3dc8124bb4c0373b7bda9e85e9863 /kmicromail/libmailwrapper
parentd90d17044d7daf6677074b0964d59f94407157d5 (diff)
downloadkdepimpi-90e33436f6d1c502a5620760ac6592b9881ee4ab.zip
kdepimpi-90e33436f6d1c502a5620760ac6592b9881ee4ab.tar.gz
kdepimpi-90e33436f6d1c502a5620760ac6592b9881ee4ab.tar.bz2
compile fixes and translation updates
Diffstat (limited to 'kmicromail/libmailwrapper') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/genericwrapper.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp
index eac05e5..1ed9f34 100644
--- a/kmicromail/libmailwrapper/genericwrapper.cpp
+++ b/kmicromail/libmailwrapper/genericwrapper.cpp
@@ -180,107 +180,109 @@ QString Genericwrapper::getencoding(mailmime_mechanism*aEnc)
180 break; 180 break;
181 } 181 }
182 return enc; 182 return enc;
183} 183}
184 184
185void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count) 185void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*mime,QValueList<int>recList,unsigned int current_rec,int current_count)
186{ 186{
187 if (current_rec >= 10) { 187 if (current_rec >= 10) {
188 ; // odebug << "too deep recursion!" << oendl; 188 ; // odebug << "too deep recursion!" << oendl;
189 } 189 }
190 if (!message || !mime) { 190 if (!message || !mime) {
191 return; 191 return;
192 } 192 }
193 int r; 193 int r;
194 char*data = 0; 194 char*data = 0;
195 size_t len; 195 size_t len;
196 clistiter * cur = 0; 196 clistiter * cur = 0;
197 QString b; 197 QString b;
198 RecPartP part = new RecPart(); 198 RecPartP part = new RecPart();
199 199
200 switch (mime->mm_type) { 200 switch (mime->mm_type) {
201 case MAILMIME_SINGLE: 201 case MAILMIME_SINGLE:
202 { 202 {
203 QValueList<int>countlist = recList; 203 QValueList<int>countlist = recList;
204 countlist.append(current_count); 204 countlist.append(current_count);
205 r = mailmessage_fetch_section(message,mime,&data,&len); 205 r = mailmessage_fetch_section(message,mime,&data,&len);
206 part->setSize(len); 206 part->setSize(len);
207 part->setPositionlist(countlist); 207 part->setPositionlist(countlist);
208 b = gen_attachment_id(); 208 b = gen_attachment_id();
209 part->setIdentifier(b); 209 part->setIdentifier(b);
210 fillSingleBody(part,message,mime); 210 fillSingleBody(part,message,mime);
211 if (part->Type()=="text" && target->Bodytext().isNull()) { 211 if (part->Type()=="text" && target->Bodytext().isNull()) {
212 encodedString*rs = new encodedString(); 212 encodedString*rs = new encodedString();
213 rs->setContent(data,len); 213 rs->setContent(data,len);
214 encodedString*res = decode_String(rs,part->Encoding()); 214 encodedString*res = decode_String(rs,part->Encoding());
215 if (countlist.count()>2) { 215 if (countlist.count()>2) {
216 bodyCache[b]=rs; 216 bodyCache[b]=rs;
217 target->addPart(part); 217 target->addPart(part);
218 } else { 218 } else {
219 delete rs; 219 delete rs;
220 } 220 }
221 b = QString(res->Content()); 221 b = QString(res->Content());
222 delete res; 222 delete res;
223 size_t index = 0; 223 size_t index = 0;
224 char*resu = 0; 224 char*resu = 0;
225 int err = MAILIMF_NO_ERROR; 225 int err = MAILIMF_NO_ERROR;
226 QString charset = part->searchParamter( "charset"); 226 QString charset = part->searchParamter( "charset");
227 qDebug("CHARSET %s ",charset.latin1() ); 227 qDebug("CHARSET %s ",charset.latin1() );
228#if 0
228 if (false ) { 229 if (false ) {
229 //if ( !charset.isEmpty() ) { 230 //if ( !charset.isEmpty() ) {
230 target->setCharset( charset ); 231 target->setCharset( charset );
231 err = mailmime_encoded_phrase_parse(charset.latin1(), 232 err = mailmime_encoded_phrase_parse(charset.latin1(),
232 b.latin1(), b.length(),&index, "utf-8",&resu); 233 b.latin1(), b.length(),&index, "utf-8",&resu);
233 if (err == MAILIMF_NO_ERROR && resu && strlen(resu)) { 234 if (err == MAILIMF_NO_ERROR && resu && strlen(resu)) {
234 //qDebug("res %d %s ", index, resu); 235 //qDebug("res %d %s ", index, resu);
235 b = QString::fromUtf8(resu); 236 b = QString::fromUtf8(resu);
236 } 237 }
237 if (resu) free(resu); 238 if (resu) free(resu);
238 } 239 }
240#endif
239 target->setBodytext(b); 241 target->setBodytext(b);
240 target->setDescription(part); 242 target->setDescription(part);
241 } else { 243 } else {
242 bodyCache[b]=new encodedString(data,len); 244 bodyCache[b]=new encodedString(data,len);
243 target->addPart(part); 245 target->addPart(part);
244 } 246 }
245 } 247 }
246 break; 248 break;
247 case MAILMIME_MULTIPLE: 249 case MAILMIME_MULTIPLE:
248 { 250 {
249 unsigned int ccount = 1; 251 unsigned int ccount = 1;
250 mailmime*cbody=0; 252 mailmime*cbody=0;
251 QValueList<int>countlist = recList; 253 QValueList<int>countlist = recList;
252 for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) { 254 for (cur = clist_begin(mime->mm_data.mm_multipart.mm_mp_list) ; cur != NULL ; cur = clist_next(cur)) {
253 cbody = (mailmime*)clist_content(cur); 255 cbody = (mailmime*)clist_content(cur);
254 if (cbody->mm_type==MAILMIME_MULTIPLE) { 256 if (cbody->mm_type==MAILMIME_MULTIPLE) {
255 RecPartP targetPart = new RecPart(); 257 RecPartP targetPart = new RecPart();
256 targetPart->setType("multipart"); 258 targetPart->setType("multipart");
257 countlist.append(current_count); 259 countlist.append(current_count);
258 targetPart->setPositionlist(countlist); 260 targetPart->setPositionlist(countlist);
259 target->addPart(targetPart); 261 target->addPart(targetPart);
260 } 262 }
261 traverseBody(target,message, cbody,countlist,current_rec+1,ccount); 263 traverseBody(target,message, cbody,countlist,current_rec+1,ccount);
262 if (cbody->mm_type==MAILMIME_MULTIPLE) { 264 if (cbody->mm_type==MAILMIME_MULTIPLE) {
263 countlist = recList; 265 countlist = recList;
264 } 266 }
265 ++ccount; 267 ++ccount;
266 } 268 }
267 } 269 }
268 break; 270 break;
269 case MAILMIME_MESSAGE: 271 case MAILMIME_MESSAGE:
270 { 272 {
271 QValueList<int>countlist = recList; 273 QValueList<int>countlist = recList;
272 countlist.append(current_count); 274 countlist.append(current_count);
273 /* the own header is always at recursion 0 - we don't need that */ 275 /* the own header is always at recursion 0 - we don't need that */
274 if (current_rec > 0) { 276 if (current_rec > 0) {
275 part->setPositionlist(countlist); 277 part->setPositionlist(countlist);
276 r = mailmessage_fetch_section(message,mime,&data,&len); 278 r = mailmessage_fetch_section(message,mime,&data,&len);
277 part->setSize(len); 279 part->setSize(len);
278 part->setPositionlist(countlist); 280 part->setPositionlist(countlist);
279 b = gen_attachment_id(); 281 b = gen_attachment_id();
280 part->setIdentifier(b); 282 part->setIdentifier(b);
281 part->setType("message"); 283 part->setType("message");
282 part->setSubtype("rfc822"); 284 part->setSubtype("rfc822");
283 bodyCache[b]=new encodedString(data,len); 285 bodyCache[b]=new encodedString(data,len);
284 target->addPart(part); 286 target->addPart(part);
285 } 287 }
286 if (mime->mm_data.mm_message.mm_msg_mime != NULL) { 288 if (mime->mm_data.mm_message.mm_msg_mime != NULL) {