Diffstat (limited to 'kmicromail/libmailwrapper/generatemail.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | kmicromail/libmailwrapper/generatemail.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/kmicromail/libmailwrapper/generatemail.cpp b/kmicromail/libmailwrapper/generatemail.cpp index 2d213fe..ddad21b 100644 --- a/kmicromail/libmailwrapper/generatemail.cpp +++ b/kmicromail/libmailwrapper/generatemail.cpp | |||
@@ -1,25 +1,27 @@ | |||
1 | #include "generatemail.h" | 1 | #include "generatemail.h" |
2 | #include "mailwrapper.h" | 2 | #include "mailwrapper.h" |
3 | 3 | ||
4 | #include <libetpan/libetpan.h> | 4 | #include <libetpan/libetpan.h> |
5 | 5 | ||
6 | //#include <qt.h> | 6 | //#include <qt.h> |
7 | 7 | ||
8 | #include <stdlib.h> | 8 | #include <stdlib.h> |
9 | #include <qfileinfo.h> | 9 | #include <qfileinfo.h> |
10 | //Added by qt3to4: | ||
11 | #include <Q3CString> | ||
10 | 12 | ||
11 | using namespace Opie::Core; | 13 | using namespace Opie::Core; |
12 | const char* Generatemail::USER_AGENT="KOpieMail 33 1/3"; | 14 | const char* Generatemail::USER_AGENT="KOpieMail 33 1/3"; |
13 | 15 | ||
14 | Generatemail::Generatemail() | 16 | Generatemail::Generatemail() |
15 | { | 17 | { |
16 | mCharset = "iso-8859-1"; | 18 | mCharset = "iso-8859-1"; |
17 | } | 19 | } |
18 | 20 | ||
19 | Generatemail::~Generatemail() | 21 | Generatemail::~Generatemail() |
20 | { | 22 | { |
21 | } | 23 | } |
22 | 24 | ||
23 | void Generatemail::addRcpts( clist *list, mailimf_address_list *addr_list ) { | 25 | void Generatemail::addRcpts( clist *list, mailimf_address_list *addr_list ) { |
24 | clistiter *it, *it2; | 26 | clistiter *it, *it2; |
25 | 27 | ||
@@ -215,57 +217,57 @@ void Generatemail::addFileParts( mailmime *message,const QList<Attachment>&files | |||
215 | if ( filePart == NULL ) { | 217 | if ( filePart == NULL ) { |
216 | continue; | 218 | continue; |
217 | } | 219 | } |
218 | err = mailmime_smart_add_part( message, filePart ); | 220 | err = mailmime_smart_add_part( message, filePart ); |
219 | if ( err != MAILIMF_NO_ERROR ) { | 221 | if ( err != MAILIMF_NO_ERROR ) { |
220 | mailmime_free( filePart ); | 222 | mailmime_free( filePart ); |
221 | } | 223 | } |
222 | } | 224 | } |
223 | } | 225 | } |
224 | 226 | ||
225 | mailmime *Generatemail::buildTxtPart(const QString&str ) { | 227 | mailmime *Generatemail::buildTxtPart(const QString&str ) { |
226 | mailmime *txtPart; | 228 | mailmime *txtPart; |
227 | mailmime_fields *fields; | 229 | mailmime_fields *fields; |
228 | mailmime_content *content; | 230 | mailmime_content *content; |
229 | mailmime_parameter *param; | 231 | mailmime_parameter *param; |
230 | int err; | 232 | int err; |
231 | QCString __str; | 233 | Q3CString __str; |
232 | //qDebug(" Generatemail::buildTxtPart %s", str.latin1()); | 234 | //qDebug(" Generatemail::buildTxtPart %s", str.latin1()); |
233 | param = mailmime_parameter_new( strdup( "charset" ), | 235 | param = mailmime_parameter_new( strdup( "charset" ), |
234 | strdup( mCharset.latin1() ) ); | 236 | strdup( mCharset.latin1() ) ); |
235 | if ( param == NULL ) | 237 | if ( param == NULL ) |
236 | goto err_free; | 238 | goto err_free; |
237 | 239 | ||
238 | content = mailmime_content_new_with_str( "text/plain" ); | 240 | content = mailmime_content_new_with_str( "text/plain" ); |
239 | if ( content == NULL ) | 241 | if ( content == NULL ) |
240 | goto err_free_param; | 242 | goto err_free_param; |
241 | 243 | ||
242 | err = clist_append( content->ct_parameters, param ); | 244 | err = clist_append( content->ct_parameters, param ); |
243 | if ( err != MAILIMF_NO_ERROR ) | 245 | if ( err != MAILIMF_NO_ERROR ) |
244 | goto err_free_content; | 246 | goto err_free_content; |
245 | 247 | ||
246 | fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT); | 248 | fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT); |
247 | if ( fields == NULL ) | 249 | if ( fields == NULL ) |
248 | goto err_free_content; | 250 | goto err_free_content; |
249 | 251 | ||
250 | txtPart = mailmime_new_empty( content, fields ); | 252 | txtPart = mailmime_new_empty( content, fields ); |
251 | if ( txtPart == NULL ) | 253 | if ( txtPart == NULL ) |
252 | goto err_free_fields; | 254 | goto err_free_fields; |
253 | { | 255 | { |
254 | //__str = str.utf8(); | 256 | //__str = str.utf8(); |
255 | __str = QCString (str.latin1()); | 257 | __str = Q3CString (str.latin1()); |
256 | err = mailmime_set_body_text( txtPart, strdup(__str.data()), __str.length() ); | 258 | err = mailmime_set_body_text( txtPart, strdup(__str.data()), __str.length() ); |
257 | } | 259 | } |
258 | if ( err != MAILIMF_NO_ERROR ) | 260 | if ( err != MAILIMF_NO_ERROR ) |
259 | goto err_free_txtPart; | 261 | goto err_free_txtPart; |
260 | 262 | ||
261 | return txtPart; // Success :) | 263 | return txtPart; // Success :) |
262 | 264 | ||
263 | err_free_txtPart: | 265 | err_free_txtPart: |
264 | mailmime_free( txtPart ); | 266 | mailmime_free( txtPart ); |
265 | err_free_fields: | 267 | err_free_fields: |
266 | mailmime_fields_free( fields ); | 268 | mailmime_fields_free( fields ); |
267 | err_free_content: | 269 | err_free_content: |
268 | mailmime_content_free( content ); | 270 | mailmime_content_free( content ); |
269 | err_free_param: | 271 | err_free_param: |
270 | mailmime_parameter_free( param ); | 272 | mailmime_parameter_free( param ); |
271 | err_free: | 273 | err_free: |