summaryrefslogtreecommitdiff
authoralwin <alwin>2003-12-10 21:35:16 (UTC)
committer alwin <alwin>2003-12-10 21:35:16 (UTC)
commitc80a4d0e0b0ed83757d8494e7f32c8b4b0b6e8d0 (patch) (side-by-side diff)
tree386ef672e71f46763031df60a83a807b7d325e96
parent6dffa571b5bfdd3e353fdabb555a805c2999ef0f (diff)
downloadopie-c80a4d0e0b0ed83757d8494e7f32c8b4b0b6e8d0.zip
opie-c80a4d0e0b0ed83757d8494e7f32c8b4b0b6e8d0.tar.gz
opie-c80a4d0e0b0ed83757d8494e7f32c8b4b0b6e8d0.tar.bz2
change to work with libetpan 0.3.1
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()
err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) {
- qDebug("error connecting server: %s",m_imap->response);
+ qDebug("error connecting server: %s",m_imap->imap_response);
mailimap_free( m_imap );
@@ -56,3 +56,3 @@ void IMAPwrapper::login()
if ( err != MAILIMAP_NO_ERROR ) {
- qDebug("error logging in imap: %s",m_imap->response);
+ qDebug("error logging in imap: %s",m_imap->imap_response);
err = mailimap_close( m_imap );
@@ -91,3 +91,3 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target )
if ( err != MAILIMAP_NO_ERROR ) {
- qDebug("error selecting mailbox: %s",m_imap->response);
+ qDebug("error selecting mailbox: %s",m_imap->imap_response);
logout();
@@ -96,3 +96,3 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target )
- int last = m_imap->selection_info->exists;
+ int last = m_imap->imap_selection_info->sel_exists;
@@ -140,3 +140,3 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target )
} else {
- qDebug("Error fetching headers: %s",m_imap->response);
+ qDebug("Error fetching headers: %s",m_imap->imap_response);
}
@@ -176,3 +176,3 @@ QList<IMAPFolder>* IMAPwrapper::listFolders()
// instead of using strdup!
- temp = list->mb;
+ temp = list->mb_name;
folders->append( new IMAPFolder(temp));
@@ -181,3 +181,3 @@ QList<IMAPFolder>* IMAPwrapper::listFolders()
} else {
- qDebug("error fetching folders: %s",m_imap->response);
+ qDebug("error fetching folders: %s",m_imap->imap_response);
}
@@ -190,2 +190,3 @@ QList<IMAPFolder>* IMAPwrapper::listFolders()
path = account->getPrefix().latin1();
+ if (!path) path = "";
result = clist_new();
@@ -199,3 +200,3 @@ QList<IMAPFolder>* IMAPwrapper::listFolders()
// instead of using strdup!
- temp = list->mb;
+ temp = list->mb_name;
current = current->next;
@@ -207,3 +208,3 @@ QList<IMAPFolder>* IMAPwrapper::listFolders()
} else {
- qDebug("error fetching folders %s",m_imap->response);
+ qDebug("error fetching folders %s",m_imap->imap_response);
}
@@ -227,3 +228,3 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
- c = clist_begin(m_att->list);
+ c = clist_begin(m_att->att_list);
while ( c ) {
@@ -232,12 +233,12 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
item = (mailimap_msg_att_item*)current->data;
- if (item->type!=MAILIMAP_MSG_ATT_ITEM_STATIC) {
- flist = (mailimap_msg_att_dynamic*)item->msg_att_dyn;
- if (!flist->list) {
+ if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) {
+ flist = (mailimap_msg_att_dynamic*)item->att_data.att_dyn;
+ if (!flist->att_list) {
continue;
}
- cf = flist->list->first;
+ cf = flist->att_list->first;
while (cf) {
cflag = (mailimap_flag_fetch*)cf->data;
- if (cflag->type==MAILIMAP_FLAG_FETCH_OTHER && cflag->flag!=0) {
- switch (cflag->flag->type) {
+ if (cflag->fl_type==MAILIMAP_FLAG_FETCH_OTHER && cflag->fl_flag!=0) {
+ switch (cflag->fl_flag->fl_type) {
case MAILIMAP_FLAG_ANSWERED: /* \Answered flag */
@@ -264,3 +265,3 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
}
- } else if (cflag->type==MAILIMAP_FLAG_FETCH_RECENT) {
+ } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) {
mFlags.setBit(FLAG_RECENT);
@@ -271,11 +272,11 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
}
- if ( item->msg_att_static->type == MAILIMAP_MSG_ATT_RFC822_HEADER ) {
- qDebug( "header: \n%s", item->msg_att_static->rfc822_header );
- } else if (item->msg_att_static->type==MAILIMAP_MSG_ATT_ENVELOPE) {
- mailimap_envelope * head = item->msg_att_static->env;
+ if ( item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_RFC822_HEADER ) {
+ qDebug( "header: \n%s", item->att_data.att_static->att_data.att_rfc822_header );
+ } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) {
+ mailimap_envelope * head = item->att_data.att_static->att_data.att_env;
m = new RecMail();
- m->setDate(head->date);
- m->setSubject(head->subject);
- if (head->from!=NULL) {
- addresslist = address_list_to_stringlist(head->from->list);
+ m->setDate(head->env_date);
+ m->setSubject(head->env_subject);
+ if (head->env_from!=NULL) {
+ addresslist = address_list_to_stringlist(head->env_from->frm_list);
if (addresslist.count()) {
@@ -284,16 +285,16 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
}
- if (head->to!=NULL) {
- addresslist = address_list_to_stringlist(head->to->list);
+ if (head->env_to!=NULL) {
+ addresslist = address_list_to_stringlist(head->env_to->to_list);
m->setTo(addresslist);
}
- if (head->cc!=NULL) {
- addresslist = address_list_to_stringlist(head->cc->list);
+ if (head->env_cc!=NULL) {
+ addresslist = address_list_to_stringlist(head->env_cc->cc_list);
m->setCC(addresslist);
}
- if (head->bcc!=NULL) {
- addresslist = address_list_to_stringlist(head->bcc->list);
+ if (head->env_bcc!=NULL) {
+ addresslist = address_list_to_stringlist(head->env_bcc->bcc_list);
m->setBcc(addresslist);
}
- if (head->reply_to!=NULL) {
- addresslist = address_list_to_stringlist(head->bcc->list);
+ if (head->env_reply_to!=NULL) {
+ addresslist = address_list_to_stringlist(head->env_reply_to->rt_list);
if (addresslist.count()) {
@@ -302,10 +303,7 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
}
- m->setMsgid(QString(head->message_id));
- qDebug("header: \nFrom: %s\nSubject: %s\nDate: %s\nMsgid: %s",
- m->getFrom().latin1(),
- m->getSubject().latin1(),m->getDate().latin1(),m->Msgid().latin1());
- } else if (item->msg_att_static->type==MAILIMAP_MSG_ATT_INTERNALDATE) {
- mailimap_date_time*d = item->msg_att_static->internal_date;
- QDateTime da(QDate(d->year,d->month,d->day),QTime(d->hour,d->min,d->sec));
- qDebug("%i %i %i - %i %i %i",d->year,d->month,d->day,d->hour,d->min,d->sec);
+ m->setMsgid(QString(head->env_message_id));
+ } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) {
+ mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date;
+ QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec));
+ 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);
qDebug(da.toString());
@@ -347,3 +345,3 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail)
if ( err != MAILIMAP_NO_ERROR ) {
- qDebug("error selecting mailbox: %s",m_imap->response);
+ qDebug("error selecting mailbox: %s",m_imap->imap_response);
logout();
@@ -363,6 +361,6 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail)
msg_att = (mailimap_msg_att*)current->data;
- mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->list->first->data;
- body_desc = item->msg_att_static->body;
- if (body_desc->type==MAILIMAP_BODY_1PART) {
- searchBodyText(mail,body_desc->body_1part,body);
+ mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data;
+ body_desc = item->att_data.att_static->att_data.att_body;
+ if (body_desc->bd_type==MAILIMAP_BODY_1PART) {
+ searchBodyText(mail,body_desc->bd_data.bd_body_1part,body);
} else {
@@ -371,3 +369,3 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail)
} else {
- qDebug("error fetching body: %s",m_imap->response);
+ qDebug("error fetching body: %s",m_imap->imap_response);
}
@@ -384,5 +382,5 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mai
}
- switch (mailDescription->type) {
+ switch (mailDescription->bd_type) {
case MAILIMAP_BODY_TYPE_1PART_TEXT:
- fillPlainBody(mail,target_body,mailDescription->body_type_text);
+ fillPlainBody(mail,target_body,mailDescription->bd_data.bd_type_text);
break;
@@ -394,3 +392,3 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mai
-void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap_body_type_text * text_body)
+void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap_body_type_text * bd)
{
@@ -400,3 +398,3 @@ void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap
clist *result;
- clistcell *current;
+ clistcell *current,*cur;
mailimap_fetch_att *fetchAtt;
@@ -412,5 +410,5 @@ void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap
result = clist_new();
- /* the range has to start at 1!!! not with 0!!!! */
- set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() );
- fetchAtt = mailimap_fetch_att_new_rfc822_text();
+ set = set = mailimap_set_new_single(mail.getNumber());
+ mailimap_section * section = mailimap_section_new_text();
+ fetchAtt = mailimap_fetch_att_new_body_peek_section(section);
fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt);
@@ -420,2 +418,3 @@ void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap
+
if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) {
@@ -423,10 +422,21 @@ void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap
msg_att = (mailimap_msg_att*)current->data;
- mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->list->first->data;
- if (item->msg_att_static && item->msg_att_static->rfc822_text) {
- body = item->msg_att_static->rfc822_text;
+ mailimap_msg_att_item*msg_att_item;
+ for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) {
+ msg_att_item = (mailimap_msg_att_item*)clist_content(cur);
+ if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) {
+ if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) {
+ char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part;
+ int length = msg_att_item->att_data.att_static->att_data.att_body_section->sec_length;
+ msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L;
+ body = QString(text);
+ free(text);
+ }
+ }
}
+
} else {
- qDebug("error fetching text: %s",m_imap->response);
+ qDebug("error fetching text: %s",m_imap->imap_response);
}
- clist_free(result);
+ //clist_free(result);
+ mailimap_fetch_list_free(result);
target_body.setBodytext(body);
@@ -452,4 +462,4 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list)
current = current->next;
- if (current_address->personal_name){
- from+=QString(current_address->personal_name);
+ if (current_address->ad_personal_name){
+ from+=QString(current_address->ad_personal_name);
from+=" ";
@@ -457,13 +467,13 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list)
}
- if (named_from && (current_address->mailbox_name || current_address->host_name)) {
+ if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) {
from+="<";
}
- if (current_address->mailbox_name) {
- from+=QString(current_address->mailbox_name);
+ if (current_address->ad_mailbox_name) {
+ from+=QString(current_address->ad_mailbox_name);
from+="@";
}
- if (current_address->host_name) {
- from+=QString(current_address->host_name);
+ if (current_address->ad_host_name) {
+ from+=QString(current_address->ad_host_name);
}
- if (named_from && (current_address->mailbox_name || current_address->host_name)) {
+ if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) {
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;
struct mailimap_body_type_text;
+struct mailimap_msg_att;
class 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()
err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) {
- qDebug("error connecting server: %s",m_imap->response);
+ qDebug("error connecting server: %s",m_imap->imap_response);
mailimap_free( m_imap );
@@ -56,3 +56,3 @@ void IMAPwrapper::login()
if ( err != MAILIMAP_NO_ERROR ) {
- qDebug("error logging in imap: %s",m_imap->response);
+ qDebug("error logging in imap: %s",m_imap->imap_response);
err = mailimap_close( m_imap );
@@ -91,3 +91,3 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target )
if ( err != MAILIMAP_NO_ERROR ) {
- qDebug("error selecting mailbox: %s",m_imap->response);
+ qDebug("error selecting mailbox: %s",m_imap->imap_response);
logout();
@@ -96,3 +96,3 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target )
- int last = m_imap->selection_info->exists;
+ int last = m_imap->imap_selection_info->sel_exists;
@@ -140,3 +140,3 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target )
} else {
- qDebug("Error fetching headers: %s",m_imap->response);
+ qDebug("Error fetching headers: %s",m_imap->imap_response);
}
@@ -176,3 +176,3 @@ QList<IMAPFolder>* IMAPwrapper::listFolders()
// instead of using strdup!
- temp = list->mb;
+ temp = list->mb_name;
folders->append( new IMAPFolder(temp));
@@ -181,3 +181,3 @@ QList<IMAPFolder>* IMAPwrapper::listFolders()
} else {
- qDebug("error fetching folders: %s",m_imap->response);
+ qDebug("error fetching folders: %s",m_imap->imap_response);
}
@@ -190,2 +190,3 @@ QList<IMAPFolder>* IMAPwrapper::listFolders()
path = account->getPrefix().latin1();
+ if (!path) path = "";
result = clist_new();
@@ -199,3 +200,3 @@ QList<IMAPFolder>* IMAPwrapper::listFolders()
// instead of using strdup!
- temp = list->mb;
+ temp = list->mb_name;
current = current->next;
@@ -207,3 +208,3 @@ QList<IMAPFolder>* IMAPwrapper::listFolders()
} else {
- qDebug("error fetching folders %s",m_imap->response);
+ qDebug("error fetching folders %s",m_imap->imap_response);
}
@@ -227,3 +228,3 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
- c = clist_begin(m_att->list);
+ c = clist_begin(m_att->att_list);
while ( c ) {
@@ -232,12 +233,12 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
item = (mailimap_msg_att_item*)current->data;
- if (item->type!=MAILIMAP_MSG_ATT_ITEM_STATIC) {
- flist = (mailimap_msg_att_dynamic*)item->msg_att_dyn;
- if (!flist->list) {
+ if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) {
+ flist = (mailimap_msg_att_dynamic*)item->att_data.att_dyn;
+ if (!flist->att_list) {
continue;
}
- cf = flist->list->first;
+ cf = flist->att_list->first;
while (cf) {
cflag = (mailimap_flag_fetch*)cf->data;
- if (cflag->type==MAILIMAP_FLAG_FETCH_OTHER && cflag->flag!=0) {
- switch (cflag->flag->type) {
+ if (cflag->fl_type==MAILIMAP_FLAG_FETCH_OTHER && cflag->fl_flag!=0) {
+ switch (cflag->fl_flag->fl_type) {
case MAILIMAP_FLAG_ANSWERED: /* \Answered flag */
@@ -264,3 +265,3 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
}
- } else if (cflag->type==MAILIMAP_FLAG_FETCH_RECENT) {
+ } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) {
mFlags.setBit(FLAG_RECENT);
@@ -271,11 +272,11 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
}
- if ( item->msg_att_static->type == MAILIMAP_MSG_ATT_RFC822_HEADER ) {
- qDebug( "header: \n%s", item->msg_att_static->rfc822_header );
- } else if (item->msg_att_static->type==MAILIMAP_MSG_ATT_ENVELOPE) {
- mailimap_envelope * head = item->msg_att_static->env;
+ if ( item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_RFC822_HEADER ) {
+ qDebug( "header: \n%s", item->att_data.att_static->att_data.att_rfc822_header );
+ } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) {
+ mailimap_envelope * head = item->att_data.att_static->att_data.att_env;
m = new RecMail();
- m->setDate(head->date);
- m->setSubject(head->subject);
- if (head->from!=NULL) {
- addresslist = address_list_to_stringlist(head->from->list);
+ m->setDate(head->env_date);
+ m->setSubject(head->env_subject);
+ if (head->env_from!=NULL) {
+ addresslist = address_list_to_stringlist(head->env_from->frm_list);
if (addresslist.count()) {
@@ -284,16 +285,16 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
}
- if (head->to!=NULL) {
- addresslist = address_list_to_stringlist(head->to->list);
+ if (head->env_to!=NULL) {
+ addresslist = address_list_to_stringlist(head->env_to->to_list);
m->setTo(addresslist);
}
- if (head->cc!=NULL) {
- addresslist = address_list_to_stringlist(head->cc->list);
+ if (head->env_cc!=NULL) {
+ addresslist = address_list_to_stringlist(head->env_cc->cc_list);
m->setCC(addresslist);
}
- if (head->bcc!=NULL) {
- addresslist = address_list_to_stringlist(head->bcc->list);
+ if (head->env_bcc!=NULL) {
+ addresslist = address_list_to_stringlist(head->env_bcc->bcc_list);
m->setBcc(addresslist);
}
- if (head->reply_to!=NULL) {
- addresslist = address_list_to_stringlist(head->bcc->list);
+ if (head->env_reply_to!=NULL) {
+ addresslist = address_list_to_stringlist(head->env_reply_to->rt_list);
if (addresslist.count()) {
@@ -302,10 +303,7 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
}
- m->setMsgid(QString(head->message_id));
- qDebug("header: \nFrom: %s\nSubject: %s\nDate: %s\nMsgid: %s",
- m->getFrom().latin1(),
- m->getSubject().latin1(),m->getDate().latin1(),m->Msgid().latin1());
- } else if (item->msg_att_static->type==MAILIMAP_MSG_ATT_INTERNALDATE) {
- mailimap_date_time*d = item->msg_att_static->internal_date;
- QDateTime da(QDate(d->year,d->month,d->day),QTime(d->hour,d->min,d->sec));
- qDebug("%i %i %i - %i %i %i",d->year,d->month,d->day,d->hour,d->min,d->sec);
+ m->setMsgid(QString(head->env_message_id));
+ } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) {
+ mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date;
+ QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec));
+ 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);
qDebug(da.toString());
@@ -347,3 +345,3 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail)
if ( err != MAILIMAP_NO_ERROR ) {
- qDebug("error selecting mailbox: %s",m_imap->response);
+ qDebug("error selecting mailbox: %s",m_imap->imap_response);
logout();
@@ -363,6 +361,6 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail)
msg_att = (mailimap_msg_att*)current->data;
- mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->list->first->data;
- body_desc = item->msg_att_static->body;
- if (body_desc->type==MAILIMAP_BODY_1PART) {
- searchBodyText(mail,body_desc->body_1part,body);
+ mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data;
+ body_desc = item->att_data.att_static->att_data.att_body;
+ if (body_desc->bd_type==MAILIMAP_BODY_1PART) {
+ searchBodyText(mail,body_desc->bd_data.bd_body_1part,body);
} else {
@@ -371,3 +369,3 @@ RecBody IMAPwrapper::fetchBody(const RecMail&mail)
} else {
- qDebug("error fetching body: %s",m_imap->response);
+ qDebug("error fetching body: %s",m_imap->imap_response);
}
@@ -384,5 +382,5 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mai
}
- switch (mailDescription->type) {
+ switch (mailDescription->bd_type) {
case MAILIMAP_BODY_TYPE_1PART_TEXT:
- fillPlainBody(mail,target_body,mailDescription->body_type_text);
+ fillPlainBody(mail,target_body,mailDescription->bd_data.bd_type_text);
break;
@@ -394,3 +392,3 @@ void IMAPwrapper::searchBodyText(const RecMail&mail,mailimap_body_type_1part*mai
-void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap_body_type_text * text_body)
+void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap_body_type_text * bd)
{
@@ -400,3 +398,3 @@ void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap
clist *result;
- clistcell *current;
+ clistcell *current,*cur;
mailimap_fetch_att *fetchAtt;
@@ -412,5 +410,5 @@ void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap
result = clist_new();
- /* the range has to start at 1!!! not with 0!!!! */
- set = mailimap_set_new_interval( mail.getNumber(),mail.getNumber() );
- fetchAtt = mailimap_fetch_att_new_rfc822_text();
+ set = set = mailimap_set_new_single(mail.getNumber());
+ mailimap_section * section = mailimap_section_new_text();
+ fetchAtt = mailimap_fetch_att_new_body_peek_section(section);
fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt);
@@ -420,2 +418,3 @@ void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap
+
if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) {
@@ -423,10 +422,21 @@ void IMAPwrapper::fillPlainBody(const RecMail&mail,RecBody&target_body, mailimap
msg_att = (mailimap_msg_att*)current->data;
- mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->list->first->data;
- if (item->msg_att_static && item->msg_att_static->rfc822_text) {
- body = item->msg_att_static->rfc822_text;
+ mailimap_msg_att_item*msg_att_item;
+ for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) {
+ msg_att_item = (mailimap_msg_att_item*)clist_content(cur);
+ if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) {
+ if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) {
+ char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part;
+ int length = msg_att_item->att_data.att_static->att_data.att_body_section->sec_length;
+ msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L;
+ body = QString(text);
+ free(text);
+ }
+ }
}
+
} else {
- qDebug("error fetching text: %s",m_imap->response);
+ qDebug("error fetching text: %s",m_imap->imap_response);
}
- clist_free(result);
+ //clist_free(result);
+ mailimap_fetch_list_free(result);
target_body.setBodytext(body);
@@ -452,4 +462,4 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list)
current = current->next;
- if (current_address->personal_name){
- from+=QString(current_address->personal_name);
+ if (current_address->ad_personal_name){
+ from+=QString(current_address->ad_personal_name);
from+=" ";
@@ -457,13 +467,13 @@ QStringList IMAPwrapper::address_list_to_stringlist(clist*list)
}
- if (named_from && (current_address->mailbox_name || current_address->host_name)) {
+ if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) {
from+="<";
}
- if (current_address->mailbox_name) {
- from+=QString(current_address->mailbox_name);
+ if (current_address->ad_mailbox_name) {
+ from+=QString(current_address->ad_mailbox_name);
from+="@";
}
- if (current_address->host_name) {
- from+=QString(current_address->host_name);
+ if (current_address->ad_host_name) {
+ from+=QString(current_address->ad_host_name);
}
- if (named_from && (current_address->mailbox_name || current_address->host_name)) {
+ if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) {
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;
struct mailimap_body_type_text;
+struct mailimap_msg_att;
class RecMail;