summaryrefslogtreecommitdiff
path: root/noncore/net/mail/libmailwrapper/generatemail.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/mail/libmailwrapper/generatemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/generatemail.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/net/mail/libmailwrapper/generatemail.cpp b/noncore/net/mail/libmailwrapper/generatemail.cpp
index 4f7ec0c..cb7ccc0 100644
--- a/noncore/net/mail/libmailwrapper/generatemail.cpp
+++ b/noncore/net/mail/libmailwrapper/generatemail.cpp
@@ -234,97 +234,97 @@ mailmime *Generatemail::buildTxtPart(const QString&str ) {
int err;
param = mailmime_parameter_new( strdup( "charset" ),
strdup( "iso-8859-1" ) );
if ( param == NULL )
goto err_free;
content = mailmime_content_new_with_str( "text/plain" );
if ( content == NULL )
goto err_free_param;
err = clist_append( content->ct_parameters, param );
if ( err != MAILIMF_NO_ERROR )
goto err_free_content;
fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT);
if ( fields == NULL )
goto err_free_content;
txtPart = mailmime_new_empty( content, fields );
if ( txtPart == NULL )
goto err_free_fields;
err = mailmime_set_body_text( txtPart, (char*)str.data(), str.length() );
if ( err != MAILIMF_NO_ERROR )
goto err_free_txtPart;
return txtPart; // Success :)
err_free_txtPart:
mailmime_free( txtPart );
err_free_fields:
mailmime_fields_free( fields );
err_free_content:
mailmime_content_free( content );
err_free_param:
mailmime_parameter_free( param );
err_free:
qDebug( "buildTxtPart - error" );
return NULL; // Error :(
}
mailimf_mailbox *Generatemail::newMailbox(const QString&name, const QString&mail ) {
return mailimf_mailbox_new( strdup( name.latin1() ),
strdup( mail.latin1() ) );
}
-mailimf_fields *Generatemail::createImfFields(const Opie::osmart_pointer<Mail>&mail )
+mailimf_fields *Generatemail::createImfFields(const Opie::OSmartPointer<Mail>&mail )
{
mailimf_fields *fields = NULL;
mailimf_field *xmailer = NULL;
mailimf_mailbox *sender=0,*fromBox=0;
mailimf_mailbox_list *from=0;
mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0;
clist*in_reply_to = 0;
char *subject = strdup( mail->getSubject().latin1() );
int err;
int res = 1;
sender = newMailbox( mail->getName(), mail->getMail() );
if ( sender == NULL ) {
res = 0;
}
if (res) {
fromBox = newMailbox( mail->getName(), mail->getMail() );
}
if ( fromBox == NULL ) {
res = 0;
}
if (res) {
from = mailimf_mailbox_list_new_empty();
}
if ( from == NULL ) {
res = 0;
}
if (res && from) {
err = mailimf_mailbox_list_add( from, fromBox );
if ( err != MAILIMF_NO_ERROR ) {
res = 0;
}
}
if (res) to = parseAddresses( mail->getTo() );
if (res) cc = parseAddresses( mail->getCC() );
if (res) bcc = parseAddresses( mail->getBCC() );
if (res) reply = parseAddresses( mail->getReply() );
if (res && mail->Inreply().count()>0) {
in_reply_to = clist_new();
char*c_reply;
unsigned int nsize = 0;
for (QStringList::ConstIterator it=mail->Inreply().begin();
it != mail->Inreply().end();++it) {
@@ -354,97 +354,97 @@ mailimf_fields *Generatemail::createImfFields(const Opie::osmart_pointer<Mail>&m
if ( fields == NULL ) {
qDebug("Error creating mailimf fields");
res = 0;
}
}
if (res) xmailer = mailimf_field_new_custom( strdup( "User-Agent" ),
strdup( USER_AGENT ) );
if ( xmailer == NULL ) {
res = 0;
} else {
err = mailimf_fields_add( fields, xmailer );
if ( err != MAILIMF_NO_ERROR ) {
res = 0;
}
}
if (!res ) {
if (xmailer) {
mailimf_field_free( xmailer );
xmailer = NULL;
}
if (fields) {
mailimf_fields_free( fields );
fields = NULL;
} else {
if (reply)
mailimf_address_list_free( reply );
if (bcc)
mailimf_address_list_free( bcc );
if (cc)
mailimf_address_list_free( cc );
if (to)
mailimf_address_list_free( to );
if (fromBox) {
mailimf_mailbox_free( fromBox );
} else if (from) {
mailimf_mailbox_list_free( from );
}
if (sender) {
mailimf_mailbox_free( sender );
}
if (subject) {
free( subject );
}
}
}
return fields;
}
-mailmime *Generatemail::createMimeMail(const Opie::osmart_pointer<Mail> &mail ) {
+mailmime *Generatemail::createMimeMail(const Opie::OSmartPointer<Mail> &mail ) {
mailmime *message, *txtPart;
mailimf_fields *fields;
int err;
fields = createImfFields( mail );
if ( fields == NULL )
goto err_free;
message = mailmime_new_message_data( NULL );
if ( message == NULL )
goto err_free_fields;
mailmime_set_imf_fields( message, fields );
txtPart = buildTxtPart( mail->getMessage() );
if ( txtPart == NULL )
goto err_free_message;
err = mailmime_smart_add_part( message, txtPart );
if ( err != MAILIMF_NO_ERROR )
goto err_free_txtPart;
addFileParts( message, mail->getAttachments() );
return message; // Success :)
err_free_txtPart:
mailmime_free( txtPart );
err_free_message:
mailmime_free( message );
err_free_fields:
mailimf_fields_free( fields );
err_free:
qDebug( "createMimeMail: error" );
return NULL; // Error :(
}
clist *Generatemail::createRcptList( mailimf_fields *fields ) {
clist *rcptList;
mailimf_field *field;
rcptList = esmtp_address_list_new();
field = getField( fields, MAILIMF_FIELD_TO );
if ( field && (field->fld_type == MAILIMF_FIELD_TO)
&& field->fld_data.fld_to->to_addr_list ) {