From d90d17044d7daf6677074b0964d59f94407157d5 Mon Sep 17 00:00:00 2001 From: zautrix Date: Sun, 07 Nov 2004 17:35:51 +0000 Subject: some mail fixes and warnings removed --- (limited to 'kmicromail/libmailwrapper') diff --git a/kmicromail/libmailwrapper/generatemail.cpp b/kmicromail/libmailwrapper/generatemail.cpp index 32311d7..2d213fe 100644 --- a/kmicromail/libmailwrapper/generatemail.cpp +++ b/kmicromail/libmailwrapper/generatemail.cpp @@ -13,6 +13,7 @@ const char* Generatemail::USER_AGENT="KOpieMail 33 1/3"; Generatemail::Generatemail() { + mCharset = "iso-8859-1"; } Generatemail::~Generatemail() @@ -145,7 +146,7 @@ mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimet if ( mimetype.startsWith( "text/" ) ) { param = mailmime_parameter_new( strdup( "charset" ), - strdup( "iso-8859-1" ) ); + strdup( mCharset.latin1() ) ); mechanism = MAILMIME_MECHANISM_QUOTED_PRINTABLE; } @@ -170,7 +171,8 @@ mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimet if (filename.length()>0) { err = mailmime_set_body_file( filePart, file ); } else { - err = mailmime_set_body_text(filePart,strdup( TextContent.utf8()),TextContent.utf8().length()); + err = mailmime_set_body_text(filePart,strdup( TextContent.utf8().data()),TextContent.utf8().length()); + //err = mailmime_set_body_text(filePart,strdup( TextContent.latin1()),TextContent.length()); } if (err != MAILIMF_NO_ERROR) { qDebug("Error setting body with file "); @@ -227,8 +229,9 @@ mailmime *Generatemail::buildTxtPart(const QString&str ) { mailmime_parameter *param; int err; QCString __str; + //qDebug(" Generatemail::buildTxtPart %s", str.latin1()); param = mailmime_parameter_new( strdup( "charset" ), - strdup( "iso-8859-1" ) ); + strdup( mCharset.latin1() ) ); if ( param == NULL ) goto err_free; @@ -248,8 +251,9 @@ mailmime *Generatemail::buildTxtPart(const QString&str ) { if ( txtPart == NULL ) goto err_free_fields; { - __str = str.utf8(); - err = mailmime_set_body_text( txtPart, __str.data(), __str.length() ); + //__str = str.utf8(); + __str = QCString (str.latin1()); + err = mailmime_set_body_text( txtPart, strdup(__str.data()), __str.length() ); } if ( err != MAILIMF_NO_ERROR ) goto err_free_txtPart; @@ -398,6 +402,8 @@ mailmime *Generatemail::createMimeMail(const Opie::Core::OSmartPointer &ma mailimf_fields *fields; int err; + //LR disabled for now + //mCharset = mail->getCharset().lower(); fields = createImfFields( mail ); if ( fields == NULL ) goto err_free; diff --git a/kmicromail/libmailwrapper/generatemail.h b/kmicromail/libmailwrapper/generatemail.h index b9f8285..a9fb648 100644 --- a/kmicromail/libmailwrapper/generatemail.h +++ b/kmicromail/libmailwrapper/generatemail.h @@ -42,6 +42,7 @@ protected: clist *createRcptList( mailimf_fields *fields ); static const char* USER_AGENT; + QString mCharset; }; #endif diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp index 28d45ce..eac05e5 100644 --- a/kmicromail/libmailwrapper/genericwrapper.cpp +++ b/kmicromail/libmailwrapper/genericwrapper.cpp @@ -225,7 +225,8 @@ void Genericwrapper::traverseBody(RecBodyP&target,mailmessage*message,mailmime*m int err = MAILIMF_NO_ERROR; QString charset = part->searchParamter( "charset"); qDebug("CHARSET %s ",charset.latin1() ); - if ( !charset.isEmpty() ) { + if (false ) { + //if ( !charset.isEmpty() ) { target->setCharset( charset ); err = mailmime_encoded_phrase_parse(charset.latin1(), b.latin1(), b.length(),&index, "utf-8",&resu); diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index 2a54381..da7065f 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp @@ -759,8 +759,8 @@ void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&t QString charset = currentPart->searchParamter( "charset"); qDebug("CHARSET %s ",charset.latin1() ); - //if ( false ) { - if ( !charset.isEmpty() ) { + if ( false ) { + //if ( !charset.isEmpty() ) { target_body->setCharset( charset ); //err = mailmime_encoded_phrase_parse("iso-8859-1", // text, strlen(text),&index, "iso-8859-1",&res); diff --git a/kmicromail/libmailwrapper/mailwrapper.h b/kmicromail/libmailwrapper/mailwrapper.h index ea6bf36..3e8b51f 100644 --- a/kmicromail/libmailwrapper/mailwrapper.h +++ b/kmicromail/libmailwrapper/mailwrapper.h @@ -83,7 +83,7 @@ public: const QStringList&Inreply()const{return m_in_reply_to;} void setCharset( const QString&a ) { charset= a; } - const QString& getCharset() { return charset; } + const QString& getCharset() const { return charset; } private: QList attList; -- cgit v0.9.0.2