summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/imapwrapper.cpp144
-rw-r--r--noncore/net/mail/imapwrapper.h1
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp144
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.h1
4 files changed, 156 insertions, 134 deletions
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp
index dc02780..e6e9fc9 100644
--- a/noncore/net/mail/imapwrapper.cpp
+++ b/noncore/net/mail/imapwrapper.cpp
@@ -47,3 +47,3 @@ void IMAPwrapper::login()
47 err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) { 47 err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) {
48 qDebug("error connecting server: %s",m_imap->response); 48 qDebug("error connecting server: %s",m_imap->imap_response);
49 mailimap_free( m_imap ); 49 mailimap_free( m_imap );
@@ -56,3 +56,3 @@ void IMAPwrapper::login()
56 if ( err != MAILIMAP_NO_ERROR ) { 56 if ( err != MAILIMAP_NO_ERROR ) {
57 qDebug("error logging in imap: %s",m_imap->response); 57 qDebug("error logging in imap: %s",m_imap->imap_response);
58 err = mailimap_close( m_imap ); 58 err = mailimap_close( m_imap );
@@ -91,3 +91,3 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target )
91 if ( err != MAILIMAP_NO_ERROR ) { 91 if ( err != MAILIMAP_NO_ERROR ) {
92 qDebug("error selecting mailbox: %s",m_imap->response); 92 qDebug("error selecting mailbox: %s",m_imap->imap_response);
93 logout(); 93 logout();
@@ -96,3 +96,3 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target )
96 96
97 int last = m_imap->selection_info->exists; 97 int last = m_imap->imap_selection_info->sel_exists;
98 98
@@ -140,3 +140,3 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target )
140 } else { 140 } else {
141 qDebug("Error fetching headers: %s",m_imap->response); 141 qDebug("Error fetching headers: %s",m_imap->imap_response);
142 } 142 }
@@ -176,3 +176,3 @@ QList<IMAPFolder>* IMAPwrapper::listFolders()
176 // instead of using strdup! 176 // instead of using strdup!
177 temp = list->mb; 177 temp = list->mb_name;
178 folders->append( new IMAPFolder(temp)); 178 folders->append( new IMAPFolder(temp));
@@ -181,3 +181,3 @@ QList<IMAPFolder>* IMAPwrapper::listFolders()
181 } else { 181 } else {
182 qDebug("error fetching folders: %s",m_imap->response); 182 qDebug("error fetching folders: %s",m_imap->imap_response);
183 } 183 }
@@ -190,2 +190,3 @@ QList<IMAPFolder>* IMAPwrapper::listFolders()
190 path = account->getPrefix().latin1(); 190 path = account->getPrefix().latin1();
191 if (!path) path = "";
191 result = clist_new(); 192 result = clist_new();
@@ -199,3 +200,3 @@ QList<IMAPFolder>* IMAPwrapper::listFolders()
199 // instead of using strdup! 200 // instead of using strdup!
200 temp = list->mb; 201 temp = list->mb_name;
201 current = current->next; 202 current = current->next;
@@ -207,3 +208,3 @@ QList<IMAPFolder>* IMAPwrapper::listFolders()
207 } else { 208 } else {
208 qDebug("error fetching folders %s",m_imap->response); 209 qDebug("error fetching folders %s",m_imap->imap_response);
209 } 210 }
@@ -227,3 +228,3 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
227 228
228 c = clist_begin(m_att->list); 229 c = clist_begin(m_att->att_list);
229 while ( c ) { 230 while ( c ) {
@@ -232,12 +233,12 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
232 item = (mailimap_msg_att_item*)current->data; 233 item = (mailimap_msg_att_item*)current->data;
233 if (item->type!=MAILIMAP_MSG_ATT_ITEM_STATIC) { 234 if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) {
234 flist = (mailimap_msg_att_dynamic*)item->msg_att_dyn; 235 flist = (mailimap_msg_att_dynamic*)item->att_data.att_dyn;
235 if (!flist->list) { 236 if (!flist->att_list) {
236 continue; 237 continue;
237 } 238 }
238 cf = flist->list->first; 239 cf = flist->att_list->first;
239 while (cf) { 240 while (cf) {
240 cflag = (mailimap_flag_fetch*)cf->data; 241 cflag = (mailimap_flag_fetch*)cf->data;
241 if (cflag->type==MAILIMAP_FLAG_FETCH_OTHER && cflag->flag!=0) { 242 if (cflag->fl_type==MAILIMAP_FLAG_FETCH_OTHER && cflag->fl_flag!=0) {
242 switch (cflag->flag->type) { 243 switch (cflag->fl_flag->fl_type) {
243 case MAILIMAP_FLAG_ANSWERED: /* \Answered flag */ 244 case MAILIMAP_FLAG_ANSWERED: /* \Answered flag */
@@ -264,3 +265,3 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
264 } 265 }
265 } else if (cflag->type==MAILIMAP_FLAG_FETCH_RECENT) { 266 } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) {
266 mFlags.setBit(FLAG_RECENT); 267 mFlags.setBit(FLAG_RECENT);
@@ -271,11 +272,11 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
271 } 272 }
272 if ( item->msg_att_static->type == MAILIMAP_MSG_ATT_RFC822_HEADER ) { 273 if ( item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_RFC822_HEADER ) {
273 qDebug( "header: \n%s", item->msg_att_static->rfc822_header ); 274 qDebug( "header: \n%s", item->att_data.att_static->att_data.att_rfc822_header );
274 } else if (item->msg_att_static->type==MAILIMAP_MSG_ATT_ENVELOPE) { 275 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) {
275 mailimap_envelope * head = item->msg_att_static->env; 276 mailimap_envelope * head = item->att_data.att_static->att_data.att_env;
276 m = new RecMail(); 277 m = new RecMail();
277 m->setDate(head->date); 278 m->setDate(head->env_date);
278 m->setSubject(head->subject); 279 m->setSubject(head->env_subject);
279 if (head->from!=NULL) { 280 if (head->env_from!=NULL) {
280 addresslist = address_list_to_stringlist(head->from->list); 281 addresslist = address_list_to_stringlist(head->env_from->frm_list);
281 if (addresslist.count()) { 282 if (addresslist.count()) {
@@ -284,16 +285,16 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
284 } 285 }
285 if (head->to!=NULL) { 286 if (head->env_to!=NULL) {
286 addresslist = address_list_to_stringlist(head->to->list); 287 addresslist = address_list_to_stringlist(head->env_to->to_list);
287 m->setTo(addresslist); 288 m->setTo(addresslist);
288 } 289 }
289 if (head->cc!=NULL) { 290 if (head->env_cc!=NULL) {
290 addresslist = address_list_to_stringlist(head->cc->list); 291 addresslist = address_list_to_stringlist(head->env_cc->cc_list);
291 m->setCC(addresslist); 292 m->setCC(addresslist);
292 } 293 }
293 if (head->bcc!=NULL) { 294 if (head->env_bcc!=NULL) {
294 addresslist = address_list_to_stringlist(head->bcc->list); 295 addresslist = address_list_to_stringlist(head->env_bcc->bcc_list);
295 m->setBcc(addresslist); 296 m->setBcc(addresslist);
296 } 297 }
297 if (head->reply_to!=NULL) { 298 if (head->env_reply_to!=NULL) {
298 addresslist = address_list_to_stringlist(head->bcc->list); 299 addresslist = address_list_to_stringlist(head->env_reply_to->rt_list);
299 if (addresslist.count()) { 300 if (addresslist.count()) {
@@ -302,10 +303,7 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
302 } 303 }
303 m->setMsgid(QString(head->message_id)); 304 m->setMsgid(QString(head->env_message_id));
304 qDebug("header: \nFrom: %s\nSubject: %s\nDate: %s\nMsgid: %s", 305 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) {
305 m->getFrom().latin1(), 306 mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date;
306 m->getSubject().latin1(),m->getDate().latin1(),m->Msgid().latin1()); 307 QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec));
307 } else if (item->msg_att_static->type==MAILIMAP_MSG_ATT_INTERNALDATE) { 308 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);
308 mailimap_date_time*d = item->msg_att_static->internal_date;
309 QDateTime da(QDate(d->year,d->month,d->day),QTime(d->hour,d->min,d->sec));
310 qDebug("%i %i %i - %i %i %i",d->year,d->month,d->day,d->hour,d->min,d->sec);
311 qDebug(da.toString()); 309 qDebug(da.toString());
@@ -347,3 +345,3 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail)
347 if ( err != MAILIMAP_NO_ERROR ) { 345 if ( err != MAILIMAP_NO_ERROR ) {
348 qDebug("error selecting mailbox: %s",m_imap->response); 346 qDebug("error selecting mailbox: %s",m_imap->imap_response);
349 logout(); 347 logout();
@@ -363,6 +361,6 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail)
363 msg_att = (mailimap_msg_att*)current->data; 361 msg_att = (mailimap_msg_att*)current->data;
364 mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->list->first->data; 362 mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data;
365 body_desc = item->msg_att_static->body; 363 body_desc = item->att_data.att_static->att_data.att_body;
366 if (body_desc->type==MAILIMAP_BODY_1PART) { 364 if (body_desc->bd_type==MAILIMAP_BODY_1PART) {
367 searchBodyText(mail,body_desc->body_1part,body); 365 searchBodyText(mail,body_desc->bd_data.bd_body_1part,body);
368 } else { 366 } else {
@@ -371,3 +369,3 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail)
371 } else { 369 } else {
372 qDebug("error fetching body: %s",m_imap->response); 370 qDebug("error fetching body: %s",m_imap->imap_response);
373 } 371 }
@@ -384,5 +382,5 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mai
384 } 382 }
385 switch (mailDescription->type) { 383 switch (mailDescription->bd_type) {
386 case MAILIMAP_BODY_TYPE_1PART_TEXT: 384 case MAILIMAP_BODY_TYPE_1PART_TEXT:
387 fillPlainBody(mail,target_body,mailDescription->body_type_text); 385 fillPlainBody(mail,target_body,mailDescription->bd_data.bd_type_text);
388 break; 386 break;
@@ -394,3 +392,3 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mai
394 392
395void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap_body_type_text * text_body) 393void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap_body_type_text * bd)
396{ 394{
@@ -400,3 +398,3 @@ void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap
400 clist *result; 398 clist *result;
401 clistcell *current; 399 clistcell *current,*cur;
402 mailimap_fetch_att *fetchAtt; 400 mailimap_fetch_att *fetchAtt;
@@ -412,5 +410,5 @@ void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap
412 result = clist_new(); 410 result = clist_new();
413 /* the range has to start at 1!!! not with 0!!!! */ 411 set = set = mailimap_set_new_single(mail.getNumber());
414 set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() ); 412 mailimap_section * section = mailimap_section_new_text();
415 fetchAtt = mailimap_fetch_att_new_rfc822_text(); 413 fetchAtt = mailimap_fetch_att_new_body_peek_section(section);
416 fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); 414 fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt);
@@ -420,2 +418,3 @@ void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap
420 418
419
421 if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { 420 if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) {
@@ -423,10 +422,21 @@ void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap
423 msg_att = (mailimap_msg_att*)current->data; 422 msg_att = (mailimap_msg_att*)current->data;
424 mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->list->first->data; 423 mailimap_msg_att_item*msg_att_item;
425 if (item->msg_att_static && item->msg_att_static->rfc822_text) { 424 for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) {
426 body = item->msg_att_static->rfc822_text; 425 msg_att_item = (mailimap_msg_att_item*)clist_content(cur);
426 if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) {
427 if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) {
428 char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part;
429 int length = msg_att_item->att_data.att_static->att_data.att_body_section->sec_length;
430 msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L;
431 body = QString(text);
432 free(text);
433 }
434 }
427 } 435 }
436
428 } else { 437 } else {
429 qDebug("error fetching text: %s",m_imap->response); 438 qDebug("error fetching text: %s",m_imap->imap_response);
430 } 439 }
431 clist_free(result); 440 //clist_free(result);
441 mailimap_fetch_list_free(result);
432 target_body.setBodytext(body); 442 target_body.setBodytext(body);
@@ -452,4 +462,4 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list)
452 current = current->next; 462 current = current->next;
453 if (current_address->personal_name){ 463 if (current_address->ad_personal_name){
454 from+=QString(current_address->personal_name); 464 from+=QString(current_address->ad_personal_name);
455 from+=" "; 465 from+=" ";
@@ -457,13 +467,13 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list)
457 } 467 }
458 if (named_from && (current_address->mailbox_name || current_address->host_name)) { 468 if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) {
459 from+="<"; 469 from+="<";
460 } 470 }
461 if (current_address->mailbox_name) { 471 if (current_address->ad_mailbox_name) {
462 from+=QString(current_address->mailbox_name); 472 from+=QString(current_address->ad_mailbox_name);
463 from+="@"; 473 from+="@";
464 } 474 }
465 if (current_address->host_name) { 475 if (current_address->ad_host_name) {
466 from+=QString(current_address->host_name); 476 from+=QString(current_address->ad_host_name);
467 } 477 }
468 if (named_from && (current_address->mailbox_name || current_address->host_name)) { 478 if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) {
469 from+=">"; 479 from+=">";
diff --git a/noncore/net/mail/imapwrapper.h b/noncore/net/mail/imapwrapper.h
index faab43c..90f3004 100644
--- a/noncore/net/mail/imapwrapper.h
+++ b/noncore/net/mail/imapwrapper.h
@@ -9,2 +9,3 @@ struct mailimap_body_type_1part;
9struct mailimap_body_type_text; 9struct mailimap_body_type_text;
10struct mailimap_msg_att;
10class RecMail; 11class RecMail;
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index dc02780..e6e9fc9 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -47,3 +47,3 @@ void IMAPwrapper::login()
47 err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) { 47 err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) {
48 qDebug("error connecting server: %s",m_imap->response); 48 qDebug("error connecting server: %s",m_imap->imap_response);
49 mailimap_free( m_imap ); 49 mailimap_free( m_imap );
@@ -56,3 +56,3 @@ void IMAPwrapper::login()
56 if ( err != MAILIMAP_NO_ERROR ) { 56 if ( err != MAILIMAP_NO_ERROR ) {
57 qDebug("error logging in imap: %s",m_imap->response); 57 qDebug("error logging in imap: %s",m_imap->imap_response);
58 err = mailimap_close( m_imap ); 58 err = mailimap_close( m_imap );
@@ -91,3 +91,3 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target )
91 if ( err != MAILIMAP_NO_ERROR ) { 91 if ( err != MAILIMAP_NO_ERROR ) {
92 qDebug("error selecting mailbox: %s",m_imap->response); 92 qDebug("error selecting mailbox: %s",m_imap->imap_response);
93 logout(); 93 logout();
@@ -96,3 +96,3 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target )
96 96
97 int last = m_imap->selection_info->exists; 97 int last = m_imap->imap_selection_info->sel_exists;
98 98
@@ -140,3 +140,3 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target )
140 } else { 140 } else {
141 qDebug("Error fetching headers: %s",m_imap->response); 141 qDebug("Error fetching headers: %s",m_imap->imap_response);
142 } 142 }
@@ -176,3 +176,3 @@ QList<IMAPFolder>* IMAPwrapper::listFolders()
176 // instead of using strdup! 176 // instead of using strdup!
177 temp = list->mb; 177 temp = list->mb_name;
178 folders->append( new IMAPFolder(temp)); 178 folders->append( new IMAPFolder(temp));
@@ -181,3 +181,3 @@ QList<IMAPFolder>* IMAPwrapper::listFolders()
181 } else { 181 } else {
182 qDebug("error fetching folders: %s",m_imap->response); 182 qDebug("error fetching folders: %s",m_imap->imap_response);
183 } 183 }
@@ -190,2 +190,3 @@ QList<IMAPFolder>* IMAPwrapper::listFolders()
190 path = account->getPrefix().latin1(); 190 path = account->getPrefix().latin1();
191 if (!path) path = "";
191 result = clist_new(); 192 result = clist_new();
@@ -199,3 +200,3 @@ QList<IMAPFolder>* IMAPwrapper::listFolders()
199 // instead of using strdup! 200 // instead of using strdup!
200 temp = list->mb; 201 temp = list->mb_name;
201 current = current->next; 202 current = current->next;
@@ -207,3 +208,3 @@ QList<IMAPFolder>* IMAPwrapper::listFolders()
207 } else { 208 } else {
208 qDebug("error fetching folders %s",m_imap->response); 209 qDebug("error fetching folders %s",m_imap->imap_response);
209 } 210 }
@@ -227,3 +228,3 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
227 228
228 c = clist_begin(m_att->list); 229 c = clist_begin(m_att->att_list);
229 while ( c ) { 230 while ( c ) {
@@ -232,12 +233,12 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
232 item = (mailimap_msg_att_item*)current->data; 233 item = (mailimap_msg_att_item*)current->data;
233 if (item->type!=MAILIMAP_MSG_ATT_ITEM_STATIC) { 234 if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) {
234 flist = (mailimap_msg_att_dynamic*)item->msg_att_dyn; 235 flist = (mailimap_msg_att_dynamic*)item->att_data.att_dyn;
235 if (!flist->list) { 236 if (!flist->att_list) {
236 continue; 237 continue;
237 } 238 }
238 cf = flist->list->first; 239 cf = flist->att_list->first;
239 while (cf) { 240 while (cf) {
240 cflag = (mailimap_flag_fetch*)cf->data; 241 cflag = (mailimap_flag_fetch*)cf->data;
241 if (cflag->type==MAILIMAP_FLAG_FETCH_OTHER && cflag->flag!=0) { 242 if (cflag->fl_type==MAILIMAP_FLAG_FETCH_OTHER && cflag->fl_flag!=0) {
242 switch (cflag->flag->type) { 243 switch (cflag->fl_flag->fl_type) {
243 case MAILIMAP_FLAG_ANSWERED: /* \Answered flag */ 244 case MAILIMAP_FLAG_ANSWERED: /* \Answered flag */
@@ -264,3 +265,3 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
264 } 265 }
265 } else if (cflag->type==MAILIMAP_FLAG_FETCH_RECENT) { 266 } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) {
266 mFlags.setBit(FLAG_RECENT); 267 mFlags.setBit(FLAG_RECENT);
@@ -271,11 +272,11 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
271 } 272 }
272 if ( item->msg_att_static->type == MAILIMAP_MSG_ATT_RFC822_HEADER ) { 273 if ( item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_RFC822_HEADER ) {
273 qDebug( "header: \n%s", item->msg_att_static->rfc822_header ); 274 qDebug( "header: \n%s", item->att_data.att_static->att_data.att_rfc822_header );
274 } else if (item->msg_att_static->type==MAILIMAP_MSG_ATT_ENVELOPE) { 275 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) {
275 mailimap_envelope * head = item->msg_att_static->env; 276 mailimap_envelope * head = item->att_data.att_static->att_data.att_env;
276 m = new RecMail(); 277 m = new RecMail();
277 m->setDate(head->date); 278 m->setDate(head->env_date);
278 m->setSubject(head->subject); 279 m->setSubject(head->env_subject);
279 if (head->from!=NULL) { 280 if (head->env_from!=NULL) {
280 addresslist = address_list_to_stringlist(head->from->list); 281 addresslist = address_list_to_stringlist(head->env_from->frm_list);
281 if (addresslist.count()) { 282 if (addresslist.count()) {
@@ -284,16 +285,16 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
284 } 285 }
285 if (head->to!=NULL) { 286 if (head->env_to!=NULL) {
286 addresslist = address_list_to_stringlist(head->to->list); 287 addresslist = address_list_to_stringlist(head->env_to->to_list);
287 m->setTo(addresslist); 288 m->setTo(addresslist);
288 } 289 }
289 if (head->cc!=NULL) { 290 if (head->env_cc!=NULL) {
290 addresslist = address_list_to_stringlist(head->cc->list); 291 addresslist = address_list_to_stringlist(head->env_cc->cc_list);
291 m->setCC(addresslist); 292 m->setCC(addresslist);
292 } 293 }
293 if (head->bcc!=NULL) { 294 if (head->env_bcc!=NULL) {
294 addresslist = address_list_to_stringlist(head->bcc->list); 295 addresslist = address_list_to_stringlist(head->env_bcc->bcc_list);
295 m->setBcc(addresslist); 296 m->setBcc(addresslist);
296 } 297 }
297 if (head->reply_to!=NULL) { 298 if (head->env_reply_to!=NULL) {
298 addresslist = address_list_to_stringlist(head->bcc->list); 299 addresslist = address_list_to_stringlist(head->env_reply_to->rt_list);
299 if (addresslist.count()) { 300 if (addresslist.count()) {
@@ -302,10 +303,7 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
302 } 303 }
303 m->setMsgid(QString(head->message_id)); 304 m->setMsgid(QString(head->env_message_id));
304 qDebug("header: \nFrom: %s\nSubject: %s\nDate: %s\nMsgid: %s", 305 } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) {
305 m->getFrom().latin1(), 306 mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date;
306 m->getSubject().latin1(),m->getDate().latin1(),m->Msgid().latin1()); 307 QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec));
307 } else if (item->msg_att_static->type==MAILIMAP_MSG_ATT_INTERNALDATE) { 308 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);
308 mailimap_date_time*d = item->msg_att_static->internal_date;
309 QDateTime da(QDate(d->year,d->month,d->day),QTime(d->hour,d->min,d->sec));
310 qDebug("%i %i %i - %i %i %i",d->year,d->month,d->day,d->hour,d->min,d->sec);
311 qDebug(da.toString()); 309 qDebug(da.toString());
@@ -347,3 +345,3 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail)
347 if ( err != MAILIMAP_NO_ERROR ) { 345 if ( err != MAILIMAP_NO_ERROR ) {
348 qDebug("error selecting mailbox: %s",m_imap->response); 346 qDebug("error selecting mailbox: %s",m_imap->imap_response);
349 logout(); 347 logout();
@@ -363,6 +361,6 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail)
363 msg_att = (mailimap_msg_att*)current->data; 361 msg_att = (mailimap_msg_att*)current->data;
364 mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->list->first->data; 362 mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data;
365 body_desc = item->msg_att_static->body; 363 body_desc = item->att_data.att_static->att_data.att_body;
366 if (body_desc->type==MAILIMAP_BODY_1PART) { 364 if (body_desc->bd_type==MAILIMAP_BODY_1PART) {
367 searchBodyText(mail,body_desc->body_1part,body); 365 searchBodyText(mail,body_desc->bd_data.bd_body_1part,body);
368 } else { 366 } else {
@@ -371,3 +369,3 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail)
371 } else { 369 } else {
372 qDebug("error fetching body: %s",m_imap->response); 370 qDebug("error fetching body: %s",m_imap->imap_response);
373 } 371 }
@@ -384,5 +382,5 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mai
384 } 382 }
385 switch (mailDescription->type) { 383 switch (mailDescription->bd_type) {
386 case MAILIMAP_BODY_TYPE_1PART_TEXT: 384 case MAILIMAP_BODY_TYPE_1PART_TEXT:
387 fillPlainBody(mail,target_body,mailDescription->body_type_text); 385 fillPlainBody(mail,target_body,mailDescription->bd_data.bd_type_text);
388 break; 386 break;
@@ -394,3 +392,3 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mai
394 392
395void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap_body_type_text * text_body) 393void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap_body_type_text * bd)
396{ 394{
@@ -400,3 +398,3 @@ void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap
400 clist *result; 398 clist *result;
401 clistcell *current; 399 clistcell *current,*cur;
402 mailimap_fetch_att *fetchAtt; 400 mailimap_fetch_att *fetchAtt;
@@ -412,5 +410,5 @@ void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap
412 result = clist_new(); 410 result = clist_new();
413 /* the range has to start at 1!!! not with 0!!!! */ 411 set = set = mailimap_set_new_single(mail.getNumber());
414 set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() ); 412 mailimap_section * section = mailimap_section_new_text();
415 fetchAtt = mailimap_fetch_att_new_rfc822_text(); 413 fetchAtt = mailimap_fetch_att_new_body_peek_section(section);
416 fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); 414 fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt);
@@ -420,2 +418,3 @@ void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap
420 418
419
421 if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { 420 if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) {
@@ -423,10 +422,21 @@ void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap
423 msg_att = (mailimap_msg_att*)current->data; 422 msg_att = (mailimap_msg_att*)current->data;
424 mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->list->first->data; 423 mailimap_msg_att_item*msg_att_item;
425 if (item->msg_att_static && item->msg_att_static->rfc822_text) { 424 for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) {
426 body = item->msg_att_static->rfc822_text; 425 msg_att_item = (mailimap_msg_att_item*)clist_content(cur);
426 if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) {
427 if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) {
428 char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part;
429 int length = msg_att_item->att_data.att_static->att_data.att_body_section->sec_length;
430 msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L;
431 body = QString(text);
432 free(text);
433 }
434 }
427 } 435 }
436
428 } else { 437 } else {
429 qDebug("error fetching text: %s",m_imap->response); 438 qDebug("error fetching text: %s",m_imap->imap_response);
430 } 439 }
431 clist_free(result); 440 //clist_free(result);
441 mailimap_fetch_list_free(result);
432 target_body.setBodytext(body); 442 target_body.setBodytext(body);
@@ -452,4 +462,4 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list)
452 current = current->next; 462 current = current->next;
453 if (current_address->personal_name){ 463 if (current_address->ad_personal_name){
454 from+=QString(current_address->personal_name); 464 from+=QString(current_address->ad_personal_name);
455 from+=" "; 465 from+=" ";
@@ -457,13 +467,13 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list)
457 } 467 }
458 if (named_from && (current_address->mailbox_name || current_address->host_name)) { 468 if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) {
459 from+="<"; 469 from+="<";
460 } 470 }
461 if (current_address->mailbox_name) { 471 if (current_address->ad_mailbox_name) {
462 from+=QString(current_address->mailbox_name); 472 from+=QString(current_address->ad_mailbox_name);
463 from+="@"; 473 from+="@";
464 } 474 }
465 if (current_address->host_name) { 475 if (current_address->ad_host_name) {
466 from+=QString(current_address->host_name); 476 from+=QString(current_address->ad_host_name);
467 } 477 }
468 if (named_from && (current_address->mailbox_name || current_address->host_name)) { 478 if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) {
469 from+=">"; 479 from+=">";
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h
index faab43c..90f3004 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.h
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.h
@@ -9,2 +9,3 @@ struct mailimap_body_type_1part;
9struct mailimap_body_type_text; 9struct mailimap_body_type_text;
10struct mailimap_msg_att;
10class RecMail; 11class RecMail;