summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper/generatemail.cpp
Unidiff
Diffstat (limited to 'kmicromail/libmailwrapper/generatemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/generatemail.cpp16
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
@@ -12,8 +12,9 @@ using namespace Opie::Core;
12const char* Generatemail::USER_AGENT="KOpieMail 33 1/3"; 12const char* Generatemail::USER_AGENT="KOpieMail 33 1/3";
13 13
14Generatemail::Generatemail() 14Generatemail::Generatemail()
15{ 15{
16 mCharset = "iso-8859-1";
16} 17}
17 18
18Generatemail::~Generatemail() 19Generatemail::~Generatemail()
19{ 20{
@@ -144,9 +145,9 @@ mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimet
144 int mechanism = MAILMIME_MECHANISM_BASE64; 145 int mechanism = MAILMIME_MECHANISM_BASE64;
145 146
146 if ( mimetype.startsWith( "text/" ) ) { 147 if ( mimetype.startsWith( "text/" ) ) {
147 param = mailmime_parameter_new( strdup( "charset" ), 148 param = mailmime_parameter_new( strdup( "charset" ),
148 strdup( "iso-8859-1" ) ); 149 strdup( mCharset.latin1() ) );
149 mechanism = MAILMIME_MECHANISM_QUOTED_PRINTABLE; 150 mechanism = MAILMIME_MECHANISM_QUOTED_PRINTABLE;
150 } 151 }
151 152
152 fields = mailmime_fields_new_filename( 153 fields = mailmime_fields_new_filename(
@@ -169,9 +170,10 @@ mailmime *Generatemail::buildFilePart(const QString&filename,const QString&mimet
169 if (filePart) { 170 if (filePart) {
170 if (filename.length()>0) { 171 if (filename.length()>0) {
171 err = mailmime_set_body_file( filePart, file ); 172 err = mailmime_set_body_file( filePart, file );
172 } else { 173 } else {
173 err = mailmime_set_body_text(filePart,strdup( TextContent.utf8()),TextContent.utf8().length()); 174 err = mailmime_set_body_text(filePart,strdup( TextContent.utf8().data()),TextContent.utf8().length());
175 //err = mailmime_set_body_text(filePart,strdup( TextContent.latin1()),TextContent.length());
174 } 176 }
175 if (err != MAILIMF_NO_ERROR) { 177 if (err != MAILIMF_NO_ERROR) {
176 qDebug("Error setting body with file "); 178 qDebug("Error setting body with file ");
177 mailmime_free( filePart ); 179 mailmime_free( filePart );
@@ -226,10 +228,11 @@ mailmime *Generatemail::buildTxtPart(const QString&str ) {
226 mailmime_content *content; 228 mailmime_content *content;
227 mailmime_parameter *param; 229 mailmime_parameter *param;
228 int err; 230 int err;
229 QCString __str; 231 QCString __str;
232 //qDebug(" Generatemail::buildTxtPart %s", str.latin1());
230 param = mailmime_parameter_new( strdup( "charset" ), 233 param = mailmime_parameter_new( strdup( "charset" ),
231 strdup( "iso-8859-1" ) ); 234 strdup( mCharset.latin1() ) );
232 if ( param == NULL ) 235 if ( param == NULL )
233 goto err_free; 236 goto err_free;
234 237
235 content = mailmime_content_new_with_str( "text/plain" ); 238 content = mailmime_content_new_with_str( "text/plain" );
@@ -247,10 +250,11 @@ mailmime *Generatemail::buildTxtPart(const QString&str ) {
247 txtPart = mailmime_new_empty( content, fields ); 250 txtPart = mailmime_new_empty( content, fields );
248 if ( txtPart == NULL ) 251 if ( txtPart == NULL )
249 goto err_free_fields; 252 goto err_free_fields;
250 { 253 {
251 __str = str.utf8(); 254 //__str = str.utf8();
252 err = mailmime_set_body_text( txtPart, __str.data(), __str.length() ); 255 __str = QCString (str.latin1());
256 err = mailmime_set_body_text( txtPart, strdup(__str.data()), __str.length() );
253 } 257 }
254 if ( err != MAILIMF_NO_ERROR ) 258 if ( err != MAILIMF_NO_ERROR )
255 goto err_free_txtPart; 259 goto err_free_txtPart;
256 260
@@ -397,8 +401,10 @@ mailmime *Generatemail::createMimeMail(const Opie::Core::OSmartPointer<Mail> &ma
397 mailmime *message, *txtPart; 401 mailmime *message, *txtPart;
398 mailimf_fields *fields; 402 mailimf_fields *fields;
399 int err; 403 int err;
400 404
405 //LR disabled for now
406 //mCharset = mail->getCharset().lower();
401 fields = createImfFields( mail ); 407 fields = createImfFields( mail );
402 if ( fields == NULL ) 408 if ( fields == NULL )
403 goto err_free; 409 goto err_free;
404 410