author | zautrix <zautrix> | 2004-11-06 23:30:02 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-11-06 23:30:02 (UTC) |
commit | 023e0e82dd8bf6421d12492a2dd25534fc43ad31 (patch) (side-by-side diff) | |
tree | cf0533e3ccc642cb57a41953f184f457fa5365ba /kmicromail/libmailwrapper | |
parent | f8841c92d5251f713eb7a025af8fdee52de45b3d (diff) | |
download | kdepimpi-023e0e82dd8bf6421d12492a2dd25534fc43ad31.zip kdepimpi-023e0e82dd8bf6421d12492a2dd25534fc43ad31.tar.gz kdepimpi-023e0e82dd8bf6421d12492a2dd25534fc43ad31.tar.bz2 |
many ompi fixes
-rw-r--r-- | kmicromail/libmailwrapper/abstractmail.cpp | 9 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/genericwrapper.cpp | 16 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 19 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mboxwrapper.cpp | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mhwrapper.cpp | 1 |
5 files changed, 41 insertions, 5 deletions
diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp index 8ee112c..ed5c898 100644 --- a/kmicromail/libmailwrapper/abstractmail.cpp +++ b/kmicromail/libmailwrapper/abstractmail.cpp @@ -71,17 +71,16 @@ encodedString* AbstractMail::decode_String(const encodedString*text,const QStrin mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE; } else if (enc.lower()=="base64") { mimetype = MAILMIME_MECHANISM_BASE64; } else if (enc.lower()=="8bit") { mimetype = MAILMIME_MECHANISM_8BIT; } else if (enc.lower()=="binary") { mimetype = MAILMIME_MECHANISM_BINARY; } - int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, &result_text,&target_length); encodedString* result = new encodedString(); if (err == MAILIMF_NO_ERROR) { result->setContent(result_text,target_length); } //odebug << "Decode string finished" << oendl; @@ -90,21 +89,23 @@ encodedString* AbstractMail::decode_String(const encodedString*text,const QStrin QString AbstractMail::convert_String(const char*text) { size_t index = 0; char*res = 0; int err = MAILIMF_NO_ERROR; QString result(text); - + //qDebug("convert_String %s ", text); + //err = mailmime_encoded_phrase_parse("iso-8859-1", + // text, strlen(text),&index, "iso-8859-1",&res); err = mailmime_encoded_phrase_parse("iso-8859-1", - text, strlen(text),&index, "iso-8859-1",&res); + text, strlen(text),&index, "utf-8",&res); if (err == MAILIMF_NO_ERROR && res && strlen(res)) { - result = QString(res); + result = QString::fromUtf8(res); } //qDebug("convert_String:%s ",result.latin1() ); if (res) free(res); return result; } /* cp & paste from launcher */ QString AbstractMail::gen_attachment_id() diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp index d89a5f9..49227dd 100644 --- a/kmicromail/libmailwrapper/genericwrapper.cpp +++ b/kmicromail/libmailwrapper/genericwrapper.cpp @@ -215,16 +215,30 @@ void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*m if (countlist.count()>2) { bodyCache[b]=rs; target->addPart(part); } else { delete rs; } b = QString(res->Content()); delete res; + size_t index = 0; + char*resu = 0; + int err = MAILIMF_NO_ERROR; + QString charset = part->searchParamter( "charset"); + qDebug("CHARSET %s ",charset.latin1() ); + if ( !charset.isEmpty() ) { + err = mailmime_encoded_phrase_parse(charset.latin1(), + b.latin1(), b.length(),&index, "utf-8",&resu); + if (err == MAILIMF_NO_ERROR && resu && strlen(resu)) { + //qDebug("res %d %s ", index, resu); + b = QString::fromUtf8(resu); + } + if (resu) free(resu); + } target->setBodytext(b); target->setDescription(part); } else { bodyCache[b]=new encodedString(data,len); target->addPart(part); } } break; @@ -339,17 +353,17 @@ QString Genericwrapper::parseGroup( mailimf_group *group ) QString Genericwrapper::parseMailbox( mailimf_mailbox *box ) { QString result( "" ); if ( box->mb_display_name == NULL ) { result.append( box->mb_addr_spec ); } else { - result.append( convert_String(box->mb_display_name).latin1() ); + result.append( convert_String(box->mb_display_name) ); result.append( " <" ); result.append( box->mb_addr_spec ); result.append( ">" ); } return result; } diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index d90a8d2..eb2b47d 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp @@ -747,16 +747,35 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t } //odebug << "ID = " << id.latin1() << "" << oendl; currentPart->setIdentifier(id); fillSinglePart(currentPart,part1); /* important: Check for is NULL 'cause a body can be empty! And we put it only into the mail if it is the FIRST part */ if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) { QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding()); + + size_t index = 0; + char*res = 0; + int err = MAILIMF_NO_ERROR; + + QString charset = currentPart->searchParamter( "charset"); + qDebug("CHARSET %s ",charset.latin1() ); + //if ( false ) { + if ( !charset.isEmpty() ) { + //err = mailmime_encoded_phrase_parse("iso-8859-1", + // text, strlen(text),&index, "iso-8859-1",&res); + err = mailmime_encoded_phrase_parse(charset.latin1(), + body_text.latin1(), body_text.length(),&index, "utf-8",&res); + if (err == MAILIMF_NO_ERROR && res && strlen(res)) { + //qDebug("res %d %s ", index, res); + body_text = QString::fromUtf8(res); + } + if (res) free(res); + } //qDebug("encoding %d text %s ",currentPart->Encoding().latin1(), body_text.latin1() ); target_body->setDescription(currentPart); target_body->setBodytext(body_text); if (countlist.count()>1) { target_body->addPart(currentPart); } } else { target_body->addPart(currentPart); diff --git a/kmicromail/libmailwrapper/mboxwrapper.cpp b/kmicromail/libmailwrapper/mboxwrapper.cpp index 0cdbae4..87f8c8a 100644 --- a/kmicromail/libmailwrapper/mboxwrapper.cpp +++ b/kmicromail/libmailwrapper/mboxwrapper.cpp @@ -120,16 +120,17 @@ RecBodyP MBOXwrapper::fetchBody( const RecMailP &mail ) r = mailmessage_fetch(msg,&data,&size); if (r != MAIL_NO_ERROR) { ; // << "Error fetching mail " << mail->getNumber() << "" << oendl; mailfolder_free(folder); mailstorage_free(storage); mailmessage_free(msg); return body; } + qDebug("MBOXwrapper::fetchBody "); body = parseMail(msg); mailmessage_fetch_result_free(msg,data); mailfolder_free(folder); mailstorage_free(storage); return body; } diff --git a/kmicromail/libmailwrapper/mhwrapper.cpp b/kmicromail/libmailwrapper/mhwrapper.cpp index 90b5d23..982d7a6 100644 --- a/kmicromail/libmailwrapper/mhwrapper.cpp +++ b/kmicromail/libmailwrapper/mhwrapper.cpp @@ -123,16 +123,17 @@ void MHwrapper::deleteMail(const RecMailP&mail) } void MHwrapper::answeredMail(const RecMailP&) { } RecBodyP MHwrapper::fetchBody( const RecMailP &mail ) { + qDebug("MHwrapper::fetchBody "); RecBodyP body = new RecBody(); init_storage(); if (!m_storage) { return body; } mailmessage * msg; char*data=0; |