summaryrefslogtreecommitdiff
path: root/noncore/net/mail/libmailwrapper/generatemail.cpp
Unidiff
Diffstat (limited to 'noncore/net/mail/libmailwrapper/generatemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/generatemail.cpp30
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
8const char* Generatemail::USER_AGENT="OpieMail v0.5"; 8const char* Generatemail::USER_AGENT="OpieMail v0.6";
9 9
10Generatemail::Generatemail() 10Generatemail::Generatemail()
11{ 11{
12} 12}
13 13
14Generatemail::~Generatemail() 14Generatemail::~Generatemail()
@@ -276,31 +276,31 @@ err_free:
276 276
277mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail ) { 277mailimf_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
282mailimf_fields *Generatemail::createImfFields(const Mail&mail ) 282mailimf_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
402mailmime *Generatemail::createMimeMail(const Mail &mail ) { 402mailmime *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
430err_free_txtPart: 430err_free_txtPart:
431 mailmime_free( txtPart ); 431 mailmime_free( txtPart );
432err_free_message: 432err_free_message: