Diffstat (limited to 'noncore/net/mail/libmailwrapper/imapwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 3375e69..e29a0a0 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -104,40 +104,40 @@ void IMAPwrapper::login() | |||
104 | /* TODO: setup a timer holding the line or if connection closed - delete the value */ | 104 | /* TODO: setup a timer holding the line or if connection closed - delete the value */ |
105 | if (m_imap) { | 105 | if (m_imap) { |
106 | err = mailimap_noop(m_imap); | 106 | err = mailimap_noop(m_imap); |
107 | if (err!=MAILIMAP_NO_ERROR) { | 107 | if (err!=MAILIMAP_NO_ERROR) { |
108 | logout(); | 108 | logout(); |
109 | } else { | 109 | } else { |
110 | mailstream_flush(m_imap->imap_stream); | 110 | mailstream_flush(m_imap->imap_stream); |
111 | return; | 111 | return; |
112 | } | 112 | } |
113 | } | 113 | } |
114 | server = account->getServer().latin1(); | 114 | server = account->getServer().latin1(); |
115 | port = account->getPort().toUInt(); | 115 | port = account->getPort().toUInt(); |
116 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { | 116 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { |
117 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); | 117 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); |
118 | login.show(); | 118 | login.show(); |
119 | if ( QDialog::Accepted == login.exec() ) { | 119 | if ( QDialog::Accepted == login.exec() ) { |
120 | // ok | 120 | // ok |
121 | user = login.getUser().latin1(); | 121 | user = login.getUser().latin1(); |
122 | pass = login.getPassword().latin1(); | 122 | pass = login.getPassword().latin1(); |
123 | } else { | 123 | } else { |
124 | // cancel | 124 | // cancel |
125 | qDebug( "IMAP: Login canceled" ); | 125 | qDebug( "IMAP: Login canceled" ); |
126 | return; | 126 | return; |
127 | } | 127 | } |
128 | } else { | 128 | } else { |
129 | user = account->getUser().latin1(); | 129 | user = account->getUser().latin1(); |
130 | pass = account->getPassword().latin1(); | 130 | pass = account->getPassword().latin1(); |
131 | } | 131 | } |
132 | 132 | ||
133 | m_imap = mailimap_new( 20, &imap_progress ); | 133 | m_imap = mailimap_new( 20, &imap_progress ); |
134 | 134 | ||
135 | /* connect */ | 135 | /* connect */ |
136 | bool ssl = false; | 136 | bool ssl = false; |
137 | bool try_tls = false; | 137 | bool try_tls = false; |
138 | bool force_tls = false; | 138 | bool force_tls = false; |
139 | 139 | ||
140 | if ( account->ConnectionType() == 2 ) { | 140 | if ( account->ConnectionType() == 2 ) { |
141 | ssl = true; | 141 | ssl = true; |
142 | } | 142 | } |
143 | if (account->ConnectionType()==1) { | 143 | if (account->ConnectionType()==1) { |
@@ -429,31 +429,46 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
429 | if (head->env_to!=NULL) { | 429 | if (head->env_to!=NULL) { |
430 | addresslist = address_list_to_stringlist(head->env_to->to_list); | 430 | addresslist = address_list_to_stringlist(head->env_to->to_list); |
431 | m->setTo(addresslist); | 431 | m->setTo(addresslist); |
432 | } | 432 | } |
433 | if (head->env_cc!=NULL) { | 433 | if (head->env_cc!=NULL) { |
434 | addresslist = address_list_to_stringlist(head->env_cc->cc_list); | 434 | addresslist = address_list_to_stringlist(head->env_cc->cc_list); |
435 | m->setCC(addresslist); | 435 | m->setCC(addresslist); |
436 | } | 436 | } |
437 | if (head->env_bcc!=NULL) { | 437 | if (head->env_bcc!=NULL) { |
438 | addresslist = address_list_to_stringlist(head->env_bcc->bcc_list); | 438 | addresslist = address_list_to_stringlist(head->env_bcc->bcc_list); |
439 | m->setBcc(addresslist); | 439 | m->setBcc(addresslist); |
440 | } | 440 | } |
441 | /* reply to address, eg. email. */ | ||
441 | if (head->env_reply_to!=NULL) { | 442 | if (head->env_reply_to!=NULL) { |
442 | addresslist = address_list_to_stringlist(head->env_reply_to->rt_list); | 443 | addresslist = address_list_to_stringlist(head->env_reply_to->rt_list); |
443 | if (addresslist.count()) { | 444 | if (addresslist.count()) { |
444 | m->setReplyto(addresslist.first()); | 445 | m->setReplyto(addresslist.first()); |
445 | } | 446 | } |
446 | } | 447 | } |
447 | m->setMsgid(QString(head->env_message_id)); | 448 | if (head->env_in_reply_to!=NULL) { |
449 | QString h(head->env_in_reply_to); | ||
450 | while (h.length()>0 && h[0]=='<') { | ||
451 | h.remove(0,1); | ||
452 | } | ||
453 | while (h.length()>0 && h[h.length()-1]=='>') { | ||
454 | h.remove(h.length()-1,1); | ||
455 | } | ||
456 | if (h.length()>0) { | ||
457 | m->setInreply(QStringList(h)); | ||
458 | } | ||
459 | } | ||
460 | if (head->env_message_id) { | ||
461 | m->setMsgid(QString(head->env_message_id)); | ||
462 | } | ||
448 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) { | 463 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) { |
449 | #if 0 | 464 | #if 0 |
450 | mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date; | 465 | mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date; |
451 | QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); | 466 | QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); |
452 | 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); | 467 | 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); |
453 | qDebug(da.toString()); | 468 | qDebug(da.toString()); |
454 | #endif | 469 | #endif |
455 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { | 470 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { |
456 | size = item->att_data.att_static->att_data.att_rfc822_size; | 471 | size = item->att_data.att_static->att_data.att_rfc822_size; |
457 | } | 472 | } |
458 | } | 473 | } |
459 | /* msg is already deleted */ | 474 | /* msg is already deleted */ |