-rw-r--r-- | noncore/net/mail/imapwrapper.cpp | 9 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 9 |
2 files changed, 16 insertions, 2 deletions
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp index a01a2a9..9ee0dff 100644 --- a/noncore/net/mail/imapwrapper.cpp +++ b/noncore/net/mail/imapwrapper.cpp | |||
@@ -252,99 +252,101 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
252 | break; | 252 | break; |
253 | case MAILIMAP_FLAG_DRAFT: /* \Draft flag */ | 253 | case MAILIMAP_FLAG_DRAFT: /* \Draft flag */ |
254 | mFlags.setBit(FLAG_DRAFT); | 254 | mFlags.setBit(FLAG_DRAFT); |
255 | break; | 255 | break; |
256 | case MAILIMAP_FLAG_KEYWORD: /* keyword flag */ | 256 | case MAILIMAP_FLAG_KEYWORD: /* keyword flag */ |
257 | break; | 257 | break; |
258 | case MAILIMAP_FLAG_EXTENSION: /* \extension flag */ | 258 | case MAILIMAP_FLAG_EXTENSION: /* \extension flag */ |
259 | break; | 259 | break; |
260 | default: | 260 | default: |
261 | break; | 261 | break; |
262 | } | 262 | } |
263 | } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) { | 263 | } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) { |
264 | mFlags.setBit(FLAG_RECENT); | 264 | mFlags.setBit(FLAG_RECENT); |
265 | } | 265 | } |
266 | } | 266 | } |
267 | continue; | 267 | continue; |
268 | } | 268 | } |
269 | if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { | 269 | if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { |
270 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; | 270 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; |
271 | m->setDate(head->env_date); | 271 | m->setDate(head->env_date); |
272 | m->setSubject(head->env_subject); | 272 | m->setSubject(head->env_subject); |
273 | if (head->env_from!=NULL) { | 273 | if (head->env_from!=NULL) { |
274 | addresslist = address_list_to_stringlist(head->env_from->frm_list); | 274 | addresslist = address_list_to_stringlist(head->env_from->frm_list); |
275 | if (addresslist.count()) { | 275 | if (addresslist.count()) { |
276 | m->setFrom(addresslist.first()); | 276 | m->setFrom(addresslist.first()); |
277 | } | 277 | } |
278 | } | 278 | } |
279 | if (head->env_to!=NULL) { | 279 | if (head->env_to!=NULL) { |
280 | addresslist = address_list_to_stringlist(head->env_to->to_list); | 280 | addresslist = address_list_to_stringlist(head->env_to->to_list); |
281 | m->setTo(addresslist); | 281 | m->setTo(addresslist); |
282 | } | 282 | } |
283 | if (head->env_cc!=NULL) { | 283 | if (head->env_cc!=NULL) { |
284 | addresslist = address_list_to_stringlist(head->env_cc->cc_list); | 284 | addresslist = address_list_to_stringlist(head->env_cc->cc_list); |
285 | m->setCC(addresslist); | 285 | m->setCC(addresslist); |
286 | } | 286 | } |
287 | if (head->env_bcc!=NULL) { | 287 | if (head->env_bcc!=NULL) { |
288 | addresslist = address_list_to_stringlist(head->env_bcc->bcc_list); | 288 | addresslist = address_list_to_stringlist(head->env_bcc->bcc_list); |
289 | m->setBcc(addresslist); | 289 | m->setBcc(addresslist); |
290 | } | 290 | } |
291 | if (head->env_reply_to!=NULL) { | 291 | if (head->env_reply_to!=NULL) { |
292 | addresslist = address_list_to_stringlist(head->env_reply_to->rt_list); | 292 | addresslist = address_list_to_stringlist(head->env_reply_to->rt_list); |
293 | if (addresslist.count()) { | 293 | if (addresslist.count()) { |
294 | m->setReplyto(addresslist.first()); | 294 | m->setReplyto(addresslist.first()); |
295 | } | 295 | } |
296 | } | 296 | } |
297 | m->setMsgid(QString(head->env_message_id)); | 297 | m->setMsgid(QString(head->env_message_id)); |
298 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) { | 298 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) { |
299 | mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date; | 299 | mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date; |
300 | #if 0 | ||
300 | QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); | 301 | QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); |
301 | qDebug("%i %i %i - %i %i %i",d->dt_year,d->dt_month,d->dt_day,d->dt_hour,d->dt_min,d->dt_sec); | 302 | qDebug("%i %i %i - %i %i %i",d->dt_year,d->dt_month,d->dt_day,d->dt_hour,d->dt_min,d->dt_sec); |
302 | qDebug(da.toString()); | 303 | qDebug(da.toString()); |
304 | #endif | ||
303 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { | 305 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { |
304 | size = item->att_data.att_static->att_data.att_rfc822_size; | 306 | size = item->att_data.att_static->att_data.att_rfc822_size; |
305 | } | 307 | } |
306 | } | 308 | } |
307 | /* msg is already deleted */ | 309 | /* msg is already deleted */ |
308 | if (mFlags.testBit(FLAG_DELETED) && m) { | 310 | if (mFlags.testBit(FLAG_DELETED) && m) { |
309 | delete m; | 311 | delete m; |
310 | m = 0; | 312 | m = 0; |
311 | } | 313 | } |
312 | if (m) { | 314 | if (m) { |
313 | m->setFlags(mFlags); | 315 | m->setFlags(mFlags); |
314 | m->setMsgsize(size); | 316 | m->setMsgsize(size); |
315 | } | 317 | } |
316 | return m; | 318 | return m; |
317 | } | 319 | } |
318 | 320 | ||
319 | RecBody IMAPwrapper::fetchBody(const RecMail&mail) | 321 | RecBody IMAPwrapper::fetchBody(const RecMail&mail) |
320 | { | 322 | { |
321 | RecBody body; | 323 | RecBody body; |
322 | const char *mb; | 324 | const char *mb; |
323 | int err = MAILIMAP_NO_ERROR; | 325 | int err = MAILIMAP_NO_ERROR; |
324 | clist *result; | 326 | clist *result; |
325 | clistcell *current; | 327 | clistcell *current; |
326 | mailimap_fetch_att *fetchAtt; | 328 | mailimap_fetch_att *fetchAtt; |
327 | mailimap_fetch_type *fetchType; | 329 | mailimap_fetch_type *fetchType; |
328 | mailimap_set *set; | 330 | mailimap_set *set; |
329 | mailimap_body*body_desc; | 331 | mailimap_body*body_desc; |
330 | 332 | ||
331 | mb = mail.getMbox().latin1(); | 333 | mb = mail.getMbox().latin1(); |
332 | 334 | ||
333 | login(); | 335 | login(); |
334 | if (!m_imap) { | 336 | if (!m_imap) { |
335 | return body; | 337 | return body; |
336 | } | 338 | } |
337 | 339 | ||
338 | err = mailimap_select( m_imap, (char*)mb); | 340 | err = mailimap_select( m_imap, (char*)mb); |
339 | if ( err != MAILIMAP_NO_ERROR ) { | 341 | if ( err != MAILIMAP_NO_ERROR ) { |
340 | qDebug("error selecting mailbox: %s",m_imap->imap_response); | 342 | qDebug("error selecting mailbox: %s",m_imap->imap_response); |
341 | return body; | 343 | return body; |
342 | } | 344 | } |
343 | 345 | ||
344 | result = clist_new(); | 346 | result = clist_new(); |
345 | /* the range has to start at 1!!! not with 0!!!! */ | 347 | /* the range has to start at 1!!! not with 0!!!! */ |
346 | set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() ); | 348 | set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() ); |
347 | fetchAtt = mailimap_fetch_att_new_bodystructure(); | 349 | fetchAtt = mailimap_fetch_att_new_bodystructure(); |
348 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); | 350 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); |
349 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | 351 | err = mailimap_fetch( m_imap, set, fetchType, &result ); |
350 | mailimap_set_free( set ); | 352 | mailimap_set_free( set ); |
@@ -673,58 +675,63 @@ void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) | |||
673 | case MAILIMAP_BODY_FLD_ENC_BINARY: | 675 | case MAILIMAP_BODY_FLD_ENC_BINARY: |
674 | encoding="binary"; | 676 | encoding="binary"; |
675 | break; | 677 | break; |
676 | case MAILIMAP_BODY_FLD_ENC_BASE64: | 678 | case MAILIMAP_BODY_FLD_ENC_BASE64: |
677 | encoding="base64"; | 679 | encoding="base64"; |
678 | break; | 680 | break; |
679 | case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE: | 681 | case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE: |
680 | encoding="quoted-printable"; | 682 | encoding="quoted-printable"; |
681 | break; | 683 | break; |
682 | case MAILIMAP_BODY_FLD_ENC_OTHER: | 684 | case MAILIMAP_BODY_FLD_ENC_OTHER: |
683 | default: | 685 | default: |
684 | if (enc->enc_value) { | 686 | if (enc->enc_value) { |
685 | char*t=enc->enc_value; | 687 | char*t=enc->enc_value; |
686 | encoding=QString(enc->enc_value); | 688 | encoding=QString(enc->enc_value); |
687 | enc->enc_value=0L; | 689 | enc->enc_value=0L; |
688 | free(t); | 690 | free(t); |
689 | } | 691 | } |
690 | } | 692 | } |
691 | target_part.setEncoding(encoding); | 693 | target_part.setEncoding(encoding); |
692 | target_part.setSize(which->bd_size); | 694 | target_part.setSize(which->bd_size); |
693 | } | 695 | } |
694 | 696 | ||
695 | QString IMAPwrapper::fetchPart(const RecMail&mail,const RecPart&part) | 697 | QString IMAPwrapper::fetchPart(const RecMail&mail,const RecPart&part) |
696 | { | 698 | { |
697 | return fetchPart(mail,part.Positionlist(),false); | 699 | return fetchPart(mail,part.Positionlist(),false); |
698 | } | 700 | } |
699 | 701 | ||
700 | void IMAPwrapper::deleteMail(const RecMail&mail) | 702 | void IMAPwrapper::deleteMail(const RecMail&mail) |
701 | { | 703 | { |
702 | mailimap_flag_list*flist; | 704 | mailimap_flag_list*flist; |
703 | mailimap_set *set; | 705 | mailimap_set *set; |
704 | mailimap_store_att_flags * store_flags; | 706 | mailimap_store_att_flags * store_flags; |
705 | int err; | 707 | int err; |
706 | login(); | 708 | login(); |
707 | if (!m_imap) { | 709 | if (!m_imap) { |
708 | return; | 710 | return; |
709 | } | 711 | } |
710 | const char *mb = mail.getMbox().latin1(); | 712 | const char *mb = mail.getMbox().latin1(); |
711 | err = mailimap_select( m_imap, (char*)mb); | 713 | err = mailimap_select( m_imap, (char*)mb); |
712 | if ( err != MAILIMAP_NO_ERROR ) { | 714 | if ( err != MAILIMAP_NO_ERROR ) { |
713 | qDebug("error selecting mailbox for delete: %s",m_imap->imap_response); | 715 | qDebug("error selecting mailbox for delete: %s",m_imap->imap_response); |
714 | return; | 716 | return; |
715 | } | 717 | } |
716 | flist = mailimap_flag_list_new_empty(); | 718 | flist = mailimap_flag_list_new_empty(); |
717 | mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); | 719 | mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); |
718 | store_flags = mailimap_store_att_flags_new_set_flags(flist); | 720 | store_flags = mailimap_store_att_flags_new_set_flags(flist); |
719 | set = mailimap_set_new_single(mail.getNumber()); | 721 | set = mailimap_set_new_single(mail.getNumber()); |
720 | err = mailimap_store(m_imap,set,store_flags); | 722 | err = mailimap_store(m_imap,set,store_flags); |
723 | mailimap_set_free( set ); | ||
724 | mailimap_store_att_flags_free(store_flags); | ||
725 | |||
721 | if (err != MAILIMAP_NO_ERROR) { | 726 | if (err != MAILIMAP_NO_ERROR) { |
722 | qDebug("error deleting mail: %s",m_imap->imap_response); | 727 | qDebug("error deleting mail: %s",m_imap->imap_response); |
723 | return; | 728 | return; |
724 | } | 729 | } |
730 | qDebug("deleting mail: %s",m_imap->imap_response); | ||
731 | /* should we realy do that at this moment? */ | ||
725 | err = mailimap_expunge(m_imap); | 732 | err = mailimap_expunge(m_imap); |
726 | if (err != MAILIMAP_NO_ERROR) { | 733 | if (err != MAILIMAP_NO_ERROR) { |
727 | qDebug("error deleting mail: %s",m_imap->imap_response); | 734 | qDebug("error deleting mail: %s",m_imap->imap_response); |
728 | } | 735 | } |
729 | qDebug("Delete successfull"); | 736 | qDebug("Delete successfull %s",m_imap->imap_response); |
730 | } | 737 | } |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index a01a2a9..9ee0dff 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -252,99 +252,101 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
252 | break; | 252 | break; |
253 | case MAILIMAP_FLAG_DRAFT: /* \Draft flag */ | 253 | case MAILIMAP_FLAG_DRAFT: /* \Draft flag */ |
254 | mFlags.setBit(FLAG_DRAFT); | 254 | mFlags.setBit(FLAG_DRAFT); |
255 | break; | 255 | break; |
256 | case MAILIMAP_FLAG_KEYWORD: /* keyword flag */ | 256 | case MAILIMAP_FLAG_KEYWORD: /* keyword flag */ |
257 | break; | 257 | break; |
258 | case MAILIMAP_FLAG_EXTENSION: /* \extension flag */ | 258 | case MAILIMAP_FLAG_EXTENSION: /* \extension flag */ |
259 | break; | 259 | break; |
260 | default: | 260 | default: |
261 | break; | 261 | break; |
262 | } | 262 | } |
263 | } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) { | 263 | } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) { |
264 | mFlags.setBit(FLAG_RECENT); | 264 | mFlags.setBit(FLAG_RECENT); |
265 | } | 265 | } |
266 | } | 266 | } |
267 | continue; | 267 | continue; |
268 | } | 268 | } |
269 | if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { | 269 | if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { |
270 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; | 270 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; |
271 | m->setDate(head->env_date); | 271 | m->setDate(head->env_date); |
272 | m->setSubject(head->env_subject); | 272 | m->setSubject(head->env_subject); |
273 | if (head->env_from!=NULL) { | 273 | if (head->env_from!=NULL) { |
274 | addresslist = address_list_to_stringlist(head->env_from->frm_list); | 274 | addresslist = address_list_to_stringlist(head->env_from->frm_list); |
275 | if (addresslist.count()) { | 275 | if (addresslist.count()) { |
276 | m->setFrom(addresslist.first()); | 276 | m->setFrom(addresslist.first()); |
277 | } | 277 | } |
278 | } | 278 | } |
279 | if (head->env_to!=NULL) { | 279 | if (head->env_to!=NULL) { |
280 | addresslist = address_list_to_stringlist(head->env_to->to_list); | 280 | addresslist = address_list_to_stringlist(head->env_to->to_list); |
281 | m->setTo(addresslist); | 281 | m->setTo(addresslist); |
282 | } | 282 | } |
283 | if (head->env_cc!=NULL) { | 283 | if (head->env_cc!=NULL) { |
284 | addresslist = address_list_to_stringlist(head->env_cc->cc_list); | 284 | addresslist = address_list_to_stringlist(head->env_cc->cc_list); |
285 | m->setCC(addresslist); | 285 | m->setCC(addresslist); |
286 | } | 286 | } |
287 | if (head->env_bcc!=NULL) { | 287 | if (head->env_bcc!=NULL) { |
288 | addresslist = address_list_to_stringlist(head->env_bcc->bcc_list); | 288 | addresslist = address_list_to_stringlist(head->env_bcc->bcc_list); |
289 | m->setBcc(addresslist); | 289 | m->setBcc(addresslist); |
290 | } | 290 | } |
291 | if (head->env_reply_to!=NULL) { | 291 | if (head->env_reply_to!=NULL) { |
292 | addresslist = address_list_to_stringlist(head->env_reply_to->rt_list); | 292 | addresslist = address_list_to_stringlist(head->env_reply_to->rt_list); |
293 | if (addresslist.count()) { | 293 | if (addresslist.count()) { |
294 | m->setReplyto(addresslist.first()); | 294 | m->setReplyto(addresslist.first()); |
295 | } | 295 | } |
296 | } | 296 | } |
297 | m->setMsgid(QString(head->env_message_id)); | 297 | m->setMsgid(QString(head->env_message_id)); |
298 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) { | 298 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) { |
299 | mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date; | 299 | mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date; |
300 | #if 0 | ||
300 | QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); | 301 | QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); |
301 | qDebug("%i %i %i - %i %i %i",d->dt_year,d->dt_month,d->dt_day,d->dt_hour,d->dt_min,d->dt_sec); | 302 | qDebug("%i %i %i - %i %i %i",d->dt_year,d->dt_month,d->dt_day,d->dt_hour,d->dt_min,d->dt_sec); |
302 | qDebug(da.toString()); | 303 | qDebug(da.toString()); |
304 | #endif | ||
303 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { | 305 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { |
304 | size = item->att_data.att_static->att_data.att_rfc822_size; | 306 | size = item->att_data.att_static->att_data.att_rfc822_size; |
305 | } | 307 | } |
306 | } | 308 | } |
307 | /* msg is already deleted */ | 309 | /* msg is already deleted */ |
308 | if (mFlags.testBit(FLAG_DELETED) && m) { | 310 | if (mFlags.testBit(FLAG_DELETED) && m) { |
309 | delete m; | 311 | delete m; |
310 | m = 0; | 312 | m = 0; |
311 | } | 313 | } |
312 | if (m) { | 314 | if (m) { |
313 | m->setFlags(mFlags); | 315 | m->setFlags(mFlags); |
314 | m->setMsgsize(size); | 316 | m->setMsgsize(size); |
315 | } | 317 | } |
316 | return m; | 318 | return m; |
317 | } | 319 | } |
318 | 320 | ||
319 | RecBody IMAPwrapper::fetchBody(const RecMail&mail) | 321 | RecBody IMAPwrapper::fetchBody(const RecMail&mail) |
320 | { | 322 | { |
321 | RecBody body; | 323 | RecBody body; |
322 | const char *mb; | 324 | const char *mb; |
323 | int err = MAILIMAP_NO_ERROR; | 325 | int err = MAILIMAP_NO_ERROR; |
324 | clist *result; | 326 | clist *result; |
325 | clistcell *current; | 327 | clistcell *current; |
326 | mailimap_fetch_att *fetchAtt; | 328 | mailimap_fetch_att *fetchAtt; |
327 | mailimap_fetch_type *fetchType; | 329 | mailimap_fetch_type *fetchType; |
328 | mailimap_set *set; | 330 | mailimap_set *set; |
329 | mailimap_body*body_desc; | 331 | mailimap_body*body_desc; |
330 | 332 | ||
331 | mb = mail.getMbox().latin1(); | 333 | mb = mail.getMbox().latin1(); |
332 | 334 | ||
333 | login(); | 335 | login(); |
334 | if (!m_imap) { | 336 | if (!m_imap) { |
335 | return body; | 337 | return body; |
336 | } | 338 | } |
337 | 339 | ||
338 | err = mailimap_select( m_imap, (char*)mb); | 340 | err = mailimap_select( m_imap, (char*)mb); |
339 | if ( err != MAILIMAP_NO_ERROR ) { | 341 | if ( err != MAILIMAP_NO_ERROR ) { |
340 | qDebug("error selecting mailbox: %s",m_imap->imap_response); | 342 | qDebug("error selecting mailbox: %s",m_imap->imap_response); |
341 | return body; | 343 | return body; |
342 | } | 344 | } |
343 | 345 | ||
344 | result = clist_new(); | 346 | result = clist_new(); |
345 | /* the range has to start at 1!!! not with 0!!!! */ | 347 | /* the range has to start at 1!!! not with 0!!!! */ |
346 | set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() ); | 348 | set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() ); |
347 | fetchAtt = mailimap_fetch_att_new_bodystructure(); | 349 | fetchAtt = mailimap_fetch_att_new_bodystructure(); |
348 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); | 350 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); |
349 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | 351 | err = mailimap_fetch( m_imap, set, fetchType, &result ); |
350 | mailimap_set_free( set ); | 352 | mailimap_set_free( set ); |
@@ -673,58 +675,63 @@ void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) | |||
673 | case MAILIMAP_BODY_FLD_ENC_BINARY: | 675 | case MAILIMAP_BODY_FLD_ENC_BINARY: |
674 | encoding="binary"; | 676 | encoding="binary"; |
675 | break; | 677 | break; |
676 | case MAILIMAP_BODY_FLD_ENC_BASE64: | 678 | case MAILIMAP_BODY_FLD_ENC_BASE64: |
677 | encoding="base64"; | 679 | encoding="base64"; |
678 | break; | 680 | break; |
679 | case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE: | 681 | case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE: |
680 | encoding="quoted-printable"; | 682 | encoding="quoted-printable"; |
681 | break; | 683 | break; |
682 | case MAILIMAP_BODY_FLD_ENC_OTHER: | 684 | case MAILIMAP_BODY_FLD_ENC_OTHER: |
683 | default: | 685 | default: |
684 | if (enc->enc_value) { | 686 | if (enc->enc_value) { |
685 | char*t=enc->enc_value; | 687 | char*t=enc->enc_value; |
686 | encoding=QString(enc->enc_value); | 688 | encoding=QString(enc->enc_value); |
687 | enc->enc_value=0L; | 689 | enc->enc_value=0L; |
688 | free(t); | 690 | free(t); |
689 | } | 691 | } |
690 | } | 692 | } |
691 | target_part.setEncoding(encoding); | 693 | target_part.setEncoding(encoding); |
692 | target_part.setSize(which->bd_size); | 694 | target_part.setSize(which->bd_size); |
693 | } | 695 | } |
694 | 696 | ||
695 | QString IMAPwrapper::fetchPart(const RecMail&mail,const RecPart&part) | 697 | QString IMAPwrapper::fetchPart(const RecMail&mail,const RecPart&part) |
696 | { | 698 | { |
697 | return fetchPart(mail,part.Positionlist(),false); | 699 | return fetchPart(mail,part.Positionlist(),false); |
698 | } | 700 | } |
699 | 701 | ||
700 | void IMAPwrapper::deleteMail(const RecMail&mail) | 702 | void IMAPwrapper::deleteMail(const RecMail&mail) |
701 | { | 703 | { |
702 | mailimap_flag_list*flist; | 704 | mailimap_flag_list*flist; |
703 | mailimap_set *set; | 705 | mailimap_set *set; |
704 | mailimap_store_att_flags * store_flags; | 706 | mailimap_store_att_flags * store_flags; |
705 | int err; | 707 | int err; |
706 | login(); | 708 | login(); |
707 | if (!m_imap) { | 709 | if (!m_imap) { |
708 | return; | 710 | return; |
709 | } | 711 | } |
710 | const char *mb = mail.getMbox().latin1(); | 712 | const char *mb = mail.getMbox().latin1(); |
711 | err = mailimap_select( m_imap, (char*)mb); | 713 | err = mailimap_select( m_imap, (char*)mb); |
712 | if ( err != MAILIMAP_NO_ERROR ) { | 714 | if ( err != MAILIMAP_NO_ERROR ) { |
713 | qDebug("error selecting mailbox for delete: %s",m_imap->imap_response); | 715 | qDebug("error selecting mailbox for delete: %s",m_imap->imap_response); |
714 | return; | 716 | return; |
715 | } | 717 | } |
716 | flist = mailimap_flag_list_new_empty(); | 718 | flist = mailimap_flag_list_new_empty(); |
717 | mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); | 719 | mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); |
718 | store_flags = mailimap_store_att_flags_new_set_flags(flist); | 720 | store_flags = mailimap_store_att_flags_new_set_flags(flist); |
719 | set = mailimap_set_new_single(mail.getNumber()); | 721 | set = mailimap_set_new_single(mail.getNumber()); |
720 | err = mailimap_store(m_imap,set,store_flags); | 722 | err = mailimap_store(m_imap,set,store_flags); |
723 | mailimap_set_free( set ); | ||
724 | mailimap_store_att_flags_free(store_flags); | ||
725 | |||
721 | if (err != MAILIMAP_NO_ERROR) { | 726 | if (err != MAILIMAP_NO_ERROR) { |
722 | qDebug("error deleting mail: %s",m_imap->imap_response); | 727 | qDebug("error deleting mail: %s",m_imap->imap_response); |
723 | return; | 728 | return; |
724 | } | 729 | } |
730 | qDebug("deleting mail: %s",m_imap->imap_response); | ||
731 | /* should we realy do that at this moment? */ | ||
725 | err = mailimap_expunge(m_imap); | 732 | err = mailimap_expunge(m_imap); |
726 | if (err != MAILIMAP_NO_ERROR) { | 733 | if (err != MAILIMAP_NO_ERROR) { |
727 | qDebug("error deleting mail: %s",m_imap->imap_response); | 734 | qDebug("error deleting mail: %s",m_imap->imap_response); |
728 | } | 735 | } |
729 | qDebug("Delete successfull"); | 736 | qDebug("Delete successfull %s",m_imap->imap_response); |
730 | } | 737 | } |