summaryrefslogtreecommitdiff
path: root/noncore/net/mail/libmailwrapper
Side-by-side diff
Diffstat (limited to 'noncore/net/mail/libmailwrapper') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/settings.cpp25
-rw-r--r--noncore/net/mail/libmailwrapper/settings.h20
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.cpp54
-rw-r--r--noncore/net/mail/libmailwrapper/smtpwrapper.h3
4 files changed, 20 insertions, 82 deletions
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp
index b580954..17aa1b0 100644
--- a/noncore/net/mail/libmailwrapper/settings.cpp
+++ b/noncore/net/mail/libmailwrapper/settings.cpp
@@ -273,9 +273,6 @@ SMTPaccount::SMTPaccount( QString filename )
accountName = "New SMTP Account";
ssl = false;
login = false;
- useCC = false;
- useBCC = false;
- useReply = false;
type = "SMTP";
port = SMTP_PORT;
}
@@ -306,17 +303,6 @@ void SMTPaccount::read()
login = conf->readBoolEntry( "Login" );
user = conf->readEntry( "User" );
password = conf->readEntryCrypt( "Password" );
- useCC = conf->readBoolEntry( "useCC" );
- useBCC = conf->readBoolEntry( "useBCC" );
- useReply = conf->readBoolEntry( "useReply" );
- name = conf->readEntry( "Name" );
- mail = conf->readEntry( "Mail" );
- org = conf->readEntry( "Org" );
- cc = conf->readEntry( "CC" );
- bcc = conf->readEntry( "BCC" );
- reply = conf->readEntry( "Reply" );
- signature = conf->readEntry( "Signature" );
- signature = signature.replace( QRegExp( "<br>" ), "\n" );
}
void SMTPaccount::save()
@@ -333,17 +319,6 @@ void SMTPaccount::save()
conf->writeEntry( "Login", login );
conf->writeEntry( "User", user );
conf->writeEntryCrypt( "Password", password );
- conf->writeEntry( "useCC", useCC );
- conf->writeEntry( "useBCC", useBCC );
- conf->writeEntry( "useReply", useReply );
- conf->writeEntry( "Name", name );
- conf->writeEntry( "Mail", mail );
- conf->writeEntry( "Org", org );
- conf->writeEntry( "CC", cc );
- conf->writeEntry( "BCC", bcc );
- conf->writeEntry( "Reply", reply );
- conf->writeEntry( "Signature",
- signature.replace( QRegExp( "\\n" ), "<br>" ) );
conf->write();
}
diff --git a/noncore/net/mail/libmailwrapper/settings.h b/noncore/net/mail/libmailwrapper/settings.h
index 22184a5..caa5dfc 100644
--- a/noncore/net/mail/libmailwrapper/settings.h
+++ b/noncore/net/mail/libmailwrapper/settings.h
@@ -93,26 +93,6 @@ public:
virtual void save();
virtual QString getFileName();
- void setName( QString str ) { name = str; }
- QString getName() { return name; }
- void setMail( QString str ) { mail = str; }
- QString getMail() { return mail; }
- void setOrg( QString str ) { org = str; }
- QString getOrg() { return org; }
- void setUseCC( bool b ) { useCC = b; }
- bool getUseCC() { return useCC; }
- void setCC( QString str ) { cc = str; }
- QString getCC() { return cc; }
- void setUseBCC( bool b ) { useBCC = b; }
- bool getUseBCC() { return useBCC; }
- void setBCC( QString str ) { bcc = str; }
- QString getBCC() { return bcc; }
- void setUseReply( bool b ) { useReply = b; }
- bool getUseReply() { return useReply; }
- void setReply( QString str ) { reply = str; }
- QString getReply() { return reply; }
- void setSignature( QString str ) { signature = str; }
- QString getSignature() { return signature; }
void setLogin( bool b ) { login = b; }
bool getLogin() { return login; }
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
index 521cd0a..30c0707 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp
@@ -128,9 +128,9 @@ mailimf_fields *SMTPwrapper::createImfFields(const Mail&mail )
{
mailimf_fields *fields;
mailimf_field *xmailer;
- mailimf_mailbox *sender, *fromBox;
- mailimf_mailbox_list *from;
- mailimf_address_list *to, *cc, *bcc, *reply;
+ mailimf_mailbox *sender=0,*fromBox=0;
+ mailimf_mailbox_list *from=0;
+ mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0;
char *subject = strdup( mail.getSubject().latin1() );
int err;
@@ -167,22 +167,22 @@ mailimf_fields *SMTPwrapper::createImfFields(const Mail&mail )
return fields; // Success :)
err_free_xmailer:
- mailimf_field_free( xmailer );
+ if (xmailer) mailimf_field_free( xmailer );
err_free_fields:
- mailimf_fields_free( fields );
+ if (fields) mailimf_fields_free( fields );
err_free_reply:
- mailimf_address_list_free( reply );
- mailimf_address_list_free( bcc );
- mailimf_address_list_free( cc );
- mailimf_address_list_free( to );
+ 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 );
err_free_from:
- mailimf_mailbox_list_free( from );
+ if (from) mailimf_mailbox_list_free( from );
err_free_fromBox:
mailimf_mailbox_free( fromBox );
err_free_sender:
- mailimf_mailbox_free( sender );
+ if (sender) mailimf_mailbox_free( sender );
err_free:
- free( subject );
+ if (subject) free( subject );
qDebug( "createImfFields - error" );
return NULL; // Error :(
@@ -206,7 +206,7 @@ mailmime *SMTPwrapper::buildTxtPart(const QString&str )
err = clist_append( content->ct_parameters, param );
if ( err != MAILIMF_NO_ERROR ) goto err_free_content;
- fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_QUOTED_PRINTABLE);
+ fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT);
if ( fields == NULL ) goto err_free_content;
txtPart = mailmime_new_empty( content, fields );
@@ -462,26 +462,6 @@ char *SMTPwrapper::getFrom( mailmime *mail )
return getFrom(ffrom);
}
-SMTPaccount *SMTPwrapper::getAccount(const QString&name )
-{
- SMTPaccount *smtp;
-
- QList<Account> list = settings->getAccounts();
- Account *it;
- for ( it = list.first(); it; it = list.next() ) {
- if ( it->getType().compare( "SMTP" ) == 0 ) {
- smtp = static_cast<SMTPaccount *>(it);
- if ( smtp->getName()== name ) {
- qDebug( "SMTPaccount found for" );
- qDebug( name );
- return smtp;
- }
- }
- }
-
- return NULL;
-}
-
void SMTPwrapper::progress( size_t current, size_t maximum )
{
if (SMTPwrapper::sendProgress) {
@@ -613,12 +593,16 @@ free_mem:
return result;
}
-void SMTPwrapper::sendMail(const Mail&mail,bool later )
+void SMTPwrapper::sendMail(const Mail&mail,SMTPaccount*aSmtp,bool later )
{
mailmime * mimeMail;
- SMTPaccount *smtp = getAccount(mail.getName());
+ SMTPaccount *smtp = aSmtp;
+ if (!later && !smtp) {
+ qDebug("Didn't get any send method - giving up");
+ return;
+ }
mimeMail = createMimeMail(mail );
if ( mimeMail == NULL ) {
qDebug( "sendMail: error creating mime mail" );
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.h b/noncore/net/mail/libmailwrapper/smtpwrapper.h
index f734fa4..0535983 100644
--- a/noncore/net/mail/libmailwrapper/smtpwrapper.h
+++ b/noncore/net/mail/libmailwrapper/smtpwrapper.h
@@ -27,7 +27,7 @@ class SMTPwrapper : public QObject
public:
SMTPwrapper( Settings *s );
virtual ~SMTPwrapper(){}
- void sendMail(const Mail& mail,bool later=false );
+ void sendMail(const Mail& mail,SMTPaccount*smtp,bool later=false );
bool flushOutbox(SMTPaccount*smtp);
static progressMailSend*sendProgress;
@@ -42,7 +42,6 @@ protected:
mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content);
void smtpSend( mailmime *mail,bool later, SMTPaccount *smtp );
clist *createRcptList( mailimf_fields *fields );
- SMTPaccount *getAccount(const QString&from );
static void storeMail(char*mail, size_t length, const QString&box);
static QString mailsmtpError( int err );