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
@@ -275,5 +275,2 @@ SMTPaccount::SMTPaccount( QString filename )
login = false;
- useCC = false;
- useBCC = false;
- useReply = false;
type = "SMTP";
@@ -308,13 +305,2 @@ void SMTPaccount::read()
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" );
}
@@ -335,13 +321,2 @@ void SMTPaccount::save()
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
@@ -95,22 +95,2 @@ public:
- 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; }
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
@@ -130,5 +130,5 @@ mailimf_fields *SMTPwrapper::createImfFields(const Mail&mail )
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() );
@@ -169,12 +169,12 @@ mailimf_fields *SMTPwrapper::createImfFields(const Mail&mail )
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:
@@ -182,5 +182,5 @@ err_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" );
@@ -208,3 +208,3 @@ mailmime *SMTPwrapper::buildTxtPart(const QString&str )
- fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_QUOTED_PRINTABLE);
+ fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT);
if ( fields == NULL ) goto err_free_content;
@@ -464,22 +464,2 @@ char *SMTPwrapper::getFrom( mailmime *mail )
-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 )
@@ -615,3 +595,3 @@ free_mem:
-void SMTPwrapper::sendMail(const Mail&mail,bool later )
+void SMTPwrapper::sendMail(const Mail&mail,SMTPaccount*aSmtp,bool later )
{
@@ -619,4 +599,8 @@ void SMTPwrapper::sendMail(const Mail&mail,bool later )
- SMTPaccount *smtp = getAccount(mail.getName());
+ SMTPaccount *smtp = aSmtp;
+ if (!later && !smtp) {
+ qDebug("Didn't get any send method - giving up");
+ return;
+ }
mimeMail = createMimeMail(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
@@ -29,3 +29,3 @@ public:
virtual ~SMTPwrapper(){}
- void sendMail(const Mail& mail,bool later=false );
+ void sendMail(const Mail& mail,SMTPaccount*smtp,bool later=false );
bool flushOutbox(SMTPaccount*smtp);
@@ -44,3 +44,2 @@ protected:
clist *createRcptList( mailimf_fields *fields );
- SMTPaccount *getAccount(const QString&from );