author | alwin <alwin> | 2004-03-12 11:22:24 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-12 11:22:24 (UTC) |
commit | a1ddbd219fcee196172f3fd684afac467e5f2469 (patch) (unidiff) | |
tree | 7f9206c519ceeff108a24e526bcad978977fa7a4 /noncore/net/mail/libmailwrapper/generatemail.cpp | |
parent | c71234bda29bd83de34ce04c766f2be641ed86be (diff) | |
download | opie-a1ddbd219fcee196172f3fd684afac467e5f2469.zip opie-a1ddbd219fcee196172f3fd684afac467e5f2469.tar.gz opie-a1ddbd219fcee196172f3fd684afac467e5f2469.tar.bz2 |
start usage of smart-pointers
Diffstat (limited to 'noncore/net/mail/libmailwrapper/generatemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/generatemail.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/noncore/net/mail/libmailwrapper/generatemail.cpp b/noncore/net/mail/libmailwrapper/generatemail.cpp index 48fa02e..4f7ec0c 100644 --- a/noncore/net/mail/libmailwrapper/generatemail.cpp +++ b/noncore/net/mail/libmailwrapper/generatemail.cpp | |||
@@ -2,13 +2,13 @@ | |||
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 | const char* Generatemail::USER_AGENT="OpieMail v0.5"; | 8 | const char* Generatemail::USER_AGENT="OpieMail v0.6"; |
9 | 9 | ||
10 | Generatemail::Generatemail() | 10 | Generatemail::Generatemail() |
11 | { | 11 | { |
12 | } | 12 | } |
13 | 13 | ||
14 | Generatemail::~Generatemail() | 14 | Generatemail::~Generatemail() |
@@ -276,31 +276,31 @@ err_free: | |||
276 | 276 | ||
277 | mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail ) { | 277 | mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail ) { |
278 | return mailimf_mailbox_new( strdup( name.latin1() ), | 278 | return mailimf_mailbox_new( strdup( name.latin1() ), |
279 | strdup( mail.latin1() ) ); | 279 | strdup( mail.latin1() ) ); |
280 | } | 280 | } |
281 | 281 | ||
282 | mailimf_fields *Generatemail::createImfFields(const Mail&mail ) | 282 | mailimf_fields *Generatemail::createImfFields(const Opie::osmart_pointer<Mail>&mail ) |
283 | { | 283 | { |
284 | mailimf_fields *fields = NULL; | 284 | mailimf_fields *fields = NULL; |
285 | mailimf_field *xmailer = NULL; | 285 | mailimf_field *xmailer = NULL; |
286 | mailimf_mailbox *sender=0,*fromBox=0; | 286 | mailimf_mailbox *sender=0,*fromBox=0; |
287 | mailimf_mailbox_list *from=0; | 287 | mailimf_mailbox_list *from=0; |
288 | mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0; | 288 | mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0; |
289 | clist*in_reply_to = 0; | 289 | clist*in_reply_to = 0; |
290 | char *subject = strdup( mail.getSubject().latin1() ); | 290 | char *subject = strdup( mail->getSubject().latin1() ); |
291 | int err; | 291 | int err; |
292 | int res = 1; | 292 | int res = 1; |
293 | 293 | ||
294 | sender = newMailbox( mail.getName(), mail.getMail() ); | 294 | sender = newMailbox( mail->getName(), mail->getMail() ); |
295 | if ( sender == NULL ) { | 295 | if ( sender == NULL ) { |
296 | res = 0; | 296 | res = 0; |
297 | } | 297 | } |
298 | 298 | ||
299 | if (res) { | 299 | if (res) { |
300 | fromBox = newMailbox( mail.getName(), mail.getMail() ); | 300 | fromBox = newMailbox( mail->getName(), mail->getMail() ); |
301 | } | 301 | } |
302 | if ( fromBox == NULL ) { | 302 | if ( fromBox == NULL ) { |
303 | res = 0; | 303 | res = 0; |
304 | } | 304 | } |
305 | 305 | ||
306 | if (res) { | 306 | if (res) { |
@@ -314,23 +314,23 @@ mailimf_fields *Generatemail::createImfFields(const Mail&mail ) | |||
314 | err = mailimf_mailbox_list_add( from, fromBox ); | 314 | err = mailimf_mailbox_list_add( from, fromBox ); |
315 | if ( err != MAILIMF_NO_ERROR ) { | 315 | if ( err != MAILIMF_NO_ERROR ) { |
316 | res = 0; | 316 | res = 0; |
317 | } | 317 | } |
318 | } | 318 | } |
319 | 319 | ||
320 | if (res) to = parseAddresses( mail.getTo() ); | 320 | if (res) to = parseAddresses( mail->getTo() ); |
321 | if (res) cc = parseAddresses( mail.getCC() ); | 321 | if (res) cc = parseAddresses( mail->getCC() ); |
322 | if (res) bcc = parseAddresses( mail.getBCC() ); | 322 | if (res) bcc = parseAddresses( mail->getBCC() ); |
323 | if (res) reply = parseAddresses( mail.getReply() ); | 323 | if (res) reply = parseAddresses( mail->getReply() ); |
324 | 324 | ||
325 | if (res && mail.Inreply().count()>0) { | 325 | if (res && mail->Inreply().count()>0) { |
326 | in_reply_to = clist_new(); | 326 | in_reply_to = clist_new(); |
327 | char*c_reply; | 327 | char*c_reply; |
328 | unsigned int nsize = 0; | 328 | unsigned int nsize = 0; |
329 | for (QStringList::ConstIterator it=mail.Inreply().begin(); | 329 | for (QStringList::ConstIterator it=mail->Inreply().begin(); |
330 | it != mail.Inreply().end();++it) { | 330 | it != mail->Inreply().end();++it) { |
331 | if ((*it).isEmpty()) | 331 | if ((*it).isEmpty()) |
332 | continue; | 332 | continue; |
333 | QString h((*it)); | 333 | QString h((*it)); |
334 | while (h.length()>0 && h[0]=='<') { | 334 | while (h.length()>0 && h[0]=='<') { |
335 | h.remove(0,1); | 335 | h.remove(0,1); |
336 | } | 336 | } |
@@ -396,13 +396,13 @@ mailimf_fields *Generatemail::createImfFields(const Mail&mail ) | |||
396 | } | 396 | } |
397 | } | 397 | } |
398 | } | 398 | } |
399 | return fields; | 399 | return fields; |
400 | } | 400 | } |
401 | 401 | ||
402 | mailmime *Generatemail::createMimeMail(const Mail &mail ) { | 402 | mailmime *Generatemail::createMimeMail(const Opie::osmart_pointer<Mail> &mail ) { |
403 | mailmime *message, *txtPart; | 403 | mailmime *message, *txtPart; |
404 | mailimf_fields *fields; | 404 | mailimf_fields *fields; |
405 | int err; | 405 | int err; |
406 | 406 | ||
407 | fields = createImfFields( mail ); | 407 | fields = createImfFields( mail ); |
408 | if ( fields == NULL ) | 408 | if ( fields == NULL ) |
@@ -411,22 +411,22 @@ mailmime *Generatemail::createMimeMail(const Mail &mail ) { | |||
411 | message = mailmime_new_message_data( NULL ); | 411 | message = mailmime_new_message_data( NULL ); |
412 | if ( message == NULL ) | 412 | if ( message == NULL ) |
413 | goto err_free_fields; | 413 | goto err_free_fields; |
414 | 414 | ||
415 | mailmime_set_imf_fields( message, fields ); | 415 | mailmime_set_imf_fields( message, fields ); |
416 | 416 | ||
417 | txtPart = buildTxtPart( mail.getMessage() ); | 417 | txtPart = buildTxtPart( mail->getMessage() ); |
418 | 418 | ||
419 | if ( txtPart == NULL ) | 419 | if ( txtPart == NULL ) |
420 | goto err_free_message; | 420 | goto err_free_message; |
421 | 421 | ||
422 | err = mailmime_smart_add_part( message, txtPart ); | 422 | err = mailmime_smart_add_part( message, txtPart ); |
423 | if ( err != MAILIMF_NO_ERROR ) | 423 | if ( err != MAILIMF_NO_ERROR ) |
424 | goto err_free_txtPart; | 424 | goto err_free_txtPart; |
425 | 425 | ||
426 | addFileParts( message, mail.getAttachments() ); | 426 | addFileParts( message, mail->getAttachments() ); |
427 | 427 | ||
428 | return message; // Success :) | 428 | return message; // Success :) |
429 | 429 | ||
430 | err_free_txtPart: | 430 | err_free_txtPart: |
431 | mailmime_free( txtPart ); | 431 | mailmime_free( txtPart ); |
432 | err_free_message: | 432 | err_free_message: |