Diffstat (limited to 'kmicromail/libmailwrapper/generatemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kmicromail/libmailwrapper/generatemail.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
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 @@ -10,12 +10,13 @@ using namespace Opie::Core; const char* Generatemail::USER_AGENT="KOpieMail 33 1/3"; Generatemail::Generatemail() { + mCharset = "iso-8859-1"; } Generatemail::~Generatemail() { } @@ -142,13 +143,13 @@ mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimet int disptype = MAILMIME_DISPOSITION_TYPE_ATTACHMENT; int mechanism = MAILMIME_MECHANISM_BASE64; if ( mimetype.startsWith( "text/" ) ) { param = mailmime_parameter_new( strdup( "charset" ), - strdup( "iso-8859-1" ) ); + strdup( mCharset.latin1() ) ); mechanism = MAILMIME_MECHANISM_QUOTED_PRINTABLE; } fields = mailmime_fields_new_filename( disptype, name, mechanism ); @@ -167,13 +168,14 @@ mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimet filePart = mailmime_new_empty( content, fields ); } if (filePart) { 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 "); mailmime_free( filePart ); filePart = 0; } @@ -224,14 +226,15 @@ mailmime *Generatemail::buildTxtPart(const QString&str ) { mailmime *txtPart; mailmime_fields *fields; mailmime_content *content; 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; content = mailmime_content_new_with_str( "text/plain" ); if ( content == NULL ) goto err_free_param; @@ -245,14 +248,15 @@ mailmime *Generatemail::buildTxtPart(const QString&str ) { goto err_free_content; txtPart = mailmime_new_empty( content, fields ); 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; return txtPart; // Success :) @@ -395,12 +399,14 @@ mailimf_fields *Generatemail::createImfFields(const Opie::Core::OSmartPointer<Ma mailmime *Generatemail::createMimeMail(const Opie::Core::OSmartPointer<Mail> &mail ) { mailmime *message, *txtPart; mailimf_fields *fields; int err; + //LR disabled for now + //mCharset = mail->getCharset().lower(); fields = createImfFields( mail ); if ( fields == NULL ) goto err_free; message = mailmime_new_message_data( NULL ); if ( message == NULL ) |