Diffstat (limited to 'noncore/net/mail/libmailwrapper') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/settings.cpp | 25 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/settings.h | 20 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.cpp | 54 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.h | 3 |
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 ) | |||
273 | accountName = "New SMTP Account"; | 273 | accountName = "New SMTP Account"; |
274 | ssl = false; | 274 | ssl = false; |
275 | login = false; | 275 | login = false; |
276 | useCC = false; | ||
277 | useBCC = false; | ||
278 | useReply = false; | ||
279 | type = "SMTP"; | 276 | type = "SMTP"; |
280 | port = SMTP_PORT; | 277 | port = SMTP_PORT; |
281 | } | 278 | } |
@@ -306,17 +303,6 @@ void SMTPaccount::read() | |||
306 | login = conf->readBoolEntry( "Login" ); | 303 | login = conf->readBoolEntry( "Login" ); |
307 | user = conf->readEntry( "User" ); | 304 | user = conf->readEntry( "User" ); |
308 | password = conf->readEntryCrypt( "Password" ); | 305 | password = conf->readEntryCrypt( "Password" ); |
309 | useCC = conf->readBoolEntry( "useCC" ); | ||
310 | useBCC = conf->readBoolEntry( "useBCC" ); | ||
311 | useReply = conf->readBoolEntry( "useReply" ); | ||
312 | name = conf->readEntry( "Name" ); | ||
313 | mail = conf->readEntry( "Mail" ); | ||
314 | org = conf->readEntry( "Org" ); | ||
315 | cc = conf->readEntry( "CC" ); | ||
316 | bcc = conf->readEntry( "BCC" ); | ||
317 | reply = conf->readEntry( "Reply" ); | ||
318 | signature = conf->readEntry( "Signature" ); | ||
319 | signature = signature.replace( QRegExp( "<br>" ), "\n" ); | ||
320 | } | 306 | } |
321 | 307 | ||
322 | void SMTPaccount::save() | 308 | void SMTPaccount::save() |
@@ -333,17 +319,6 @@ void SMTPaccount::save() | |||
333 | conf->writeEntry( "Login", login ); | 319 | conf->writeEntry( "Login", login ); |
334 | conf->writeEntry( "User", user ); | 320 | conf->writeEntry( "User", user ); |
335 | conf->writeEntryCrypt( "Password", password ); | 321 | conf->writeEntryCrypt( "Password", password ); |
336 | conf->writeEntry( "useCC", useCC ); | ||
337 | conf->writeEntry( "useBCC", useBCC ); | ||
338 | conf->writeEntry( "useReply", useReply ); | ||
339 | conf->writeEntry( "Name", name ); | ||
340 | conf->writeEntry( "Mail", mail ); | ||
341 | conf->writeEntry( "Org", org ); | ||
342 | conf->writeEntry( "CC", cc ); | ||
343 | conf->writeEntry( "BCC", bcc ); | ||
344 | conf->writeEntry( "Reply", reply ); | ||
345 | conf->writeEntry( "Signature", | ||
346 | signature.replace( QRegExp( "\\n" ), "<br>" ) ); | ||
347 | conf->write(); | 322 | conf->write(); |
348 | } | 323 | } |
349 | 324 | ||
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: | |||
93 | virtual void save(); | 93 | virtual void save(); |
94 | virtual QString getFileName(); | 94 | virtual QString getFileName(); |
95 | 95 | ||
96 | void setName( QString str ) { name = str; } | ||
97 | QString getName() { return name; } | ||
98 | void setMail( QString str ) { mail = str; } | ||
99 | QString getMail() { return mail; } | ||
100 | void setOrg( QString str ) { org = str; } | ||
101 | QString getOrg() { return org; } | ||
102 | void setUseCC( bool b ) { useCC = b; } | ||
103 | bool getUseCC() { return useCC; } | ||
104 | void setCC( QString str ) { cc = str; } | ||
105 | QString getCC() { return cc; } | ||
106 | void setUseBCC( bool b ) { useBCC = b; } | ||
107 | bool getUseBCC() { return useBCC; } | ||
108 | void setBCC( QString str ) { bcc = str; } | ||
109 | QString getBCC() { return bcc; } | ||
110 | void setUseReply( bool b ) { useReply = b; } | ||
111 | bool getUseReply() { return useReply; } | ||
112 | void setReply( QString str ) { reply = str; } | ||
113 | QString getReply() { return reply; } | ||
114 | void setSignature( QString str ) { signature = str; } | ||
115 | QString getSignature() { return signature; } | ||
116 | void setLogin( bool b ) { login = b; } | 96 | void setLogin( bool b ) { login = b; } |
117 | bool getLogin() { return login; } | 97 | bool getLogin() { return login; } |
118 | 98 | ||
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 ) | |||
128 | { | 128 | { |
129 | mailimf_fields *fields; | 129 | mailimf_fields *fields; |
130 | mailimf_field *xmailer; | 130 | mailimf_field *xmailer; |
131 | mailimf_mailbox *sender, *fromBox; | 131 | mailimf_mailbox *sender=0,*fromBox=0; |
132 | mailimf_mailbox_list *from; | 132 | mailimf_mailbox_list *from=0; |
133 | mailimf_address_list *to, *cc, *bcc, *reply; | 133 | mailimf_address_list *to=0, *cc=0, *bcc=0, *reply=0; |
134 | char *subject = strdup( mail.getSubject().latin1() ); | 134 | char *subject = strdup( mail.getSubject().latin1() ); |
135 | int err; | 135 | int err; |
136 | 136 | ||
@@ -167,22 +167,22 @@ mailimf_fields *SMTPwrapper::createImfFields(const Mail&mail ) | |||
167 | return fields; // Success :) | 167 | return fields; // Success :) |
168 | 168 | ||
169 | err_free_xmailer: | 169 | err_free_xmailer: |
170 | mailimf_field_free( xmailer ); | 170 | if (xmailer) mailimf_field_free( xmailer ); |
171 | err_free_fields: | 171 | err_free_fields: |
172 | mailimf_fields_free( fields ); | 172 | if (fields) mailimf_fields_free( fields ); |
173 | err_free_reply: | 173 | err_free_reply: |
174 | mailimf_address_list_free( reply ); | 174 | if (reply) mailimf_address_list_free( reply ); |
175 | mailimf_address_list_free( bcc ); | 175 | if (bcc) mailimf_address_list_free( bcc ); |
176 | mailimf_address_list_free( cc ); | 176 | if (cc) mailimf_address_list_free( cc ); |
177 | mailimf_address_list_free( to ); | 177 | if (to) mailimf_address_list_free( to ); |
178 | err_free_from: | 178 | err_free_from: |
179 | mailimf_mailbox_list_free( from ); | 179 | if (from) mailimf_mailbox_list_free( from ); |
180 | err_free_fromBox: | 180 | err_free_fromBox: |
181 | mailimf_mailbox_free( fromBox ); | 181 | mailimf_mailbox_free( fromBox ); |
182 | err_free_sender: | 182 | err_free_sender: |
183 | mailimf_mailbox_free( sender ); | 183 | if (sender) mailimf_mailbox_free( sender ); |
184 | err_free: | 184 | err_free: |
185 | free( subject ); | 185 | if (subject) free( subject ); |
186 | qDebug( "createImfFields - error" ); | 186 | qDebug( "createImfFields - error" ); |
187 | 187 | ||
188 | return NULL; // Error :( | 188 | return NULL; // Error :( |
@@ -206,7 +206,7 @@ mailmime *SMTPwrapper::buildTxtPart(const QString&str ) | |||
206 | err = clist_append( content->ct_parameters, param ); | 206 | err = clist_append( content->ct_parameters, param ); |
207 | if ( err != MAILIMF_NO_ERROR ) goto err_free_content; | 207 | if ( err != MAILIMF_NO_ERROR ) goto err_free_content; |
208 | 208 | ||
209 | fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_QUOTED_PRINTABLE); | 209 | fields = mailmime_fields_new_encoding(MAILMIME_MECHANISM_8BIT); |
210 | if ( fields == NULL ) goto err_free_content; | 210 | if ( fields == NULL ) goto err_free_content; |
211 | 211 | ||
212 | txtPart = mailmime_new_empty( content, fields ); | 212 | txtPart = mailmime_new_empty( content, fields ); |
@@ -462,26 +462,6 @@ char *SMTPwrapper::getFrom( mailmime *mail ) | |||
462 | return getFrom(ffrom); | 462 | return getFrom(ffrom); |
463 | } | 463 | } |
464 | 464 | ||
465 | SMTPaccount *SMTPwrapper::getAccount(const QString&name ) | ||
466 | { | ||
467 | SMTPaccount *smtp; | ||
468 | |||
469 | QList<Account> list = settings->getAccounts(); | ||
470 | Account *it; | ||
471 | for ( it = list.first(); it; it = list.next() ) { | ||
472 | if ( it->getType().compare( "SMTP" ) == 0 ) { | ||
473 | smtp = static_cast<SMTPaccount *>(it); | ||
474 | if ( smtp->getName()== name ) { | ||
475 | qDebug( "SMTPaccount found for" ); | ||
476 | qDebug( name ); | ||
477 | return smtp; | ||
478 | } | ||
479 | } | ||
480 | } | ||
481 | |||
482 | return NULL; | ||
483 | } | ||
484 | |||
485 | void SMTPwrapper::progress( size_t current, size_t maximum ) | 465 | void SMTPwrapper::progress( size_t current, size_t maximum ) |
486 | { | 466 | { |
487 | if (SMTPwrapper::sendProgress) { | 467 | if (SMTPwrapper::sendProgress) { |
@@ -613,12 +593,16 @@ free_mem: | |||
613 | return result; | 593 | return result; |
614 | } | 594 | } |
615 | 595 | ||
616 | void SMTPwrapper::sendMail(const Mail&mail,bool later ) | 596 | void SMTPwrapper::sendMail(const Mail&mail,SMTPaccount*aSmtp,bool later ) |
617 | { | 597 | { |
618 | mailmime * mimeMail; | 598 | mailmime * mimeMail; |
619 | 599 | ||
620 | SMTPaccount *smtp = getAccount(mail.getName()); | 600 | SMTPaccount *smtp = aSmtp; |
621 | 601 | ||
602 | if (!later && !smtp) { | ||
603 | qDebug("Didn't get any send method - giving up"); | ||
604 | return; | ||
605 | } | ||
622 | mimeMail = createMimeMail(mail ); | 606 | mimeMail = createMimeMail(mail ); |
623 | if ( mimeMail == NULL ) { | 607 | if ( mimeMail == NULL ) { |
624 | qDebug( "sendMail: error creating mime mail" ); | 608 | 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 | |||
27 | public: | 27 | public: |
28 | SMTPwrapper( Settings *s ); | 28 | SMTPwrapper( Settings *s ); |
29 | virtual ~SMTPwrapper(){} | 29 | virtual ~SMTPwrapper(){} |
30 | void sendMail(const Mail& mail,bool later=false ); | 30 | void sendMail(const Mail& mail,SMTPaccount*smtp,bool later=false ); |
31 | bool flushOutbox(SMTPaccount*smtp); | 31 | bool flushOutbox(SMTPaccount*smtp); |
32 | 32 | ||
33 | static progressMailSend*sendProgress; | 33 | static progressMailSend*sendProgress; |
@@ -42,7 +42,6 @@ protected: | |||
42 | mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content); | 42 | mailmime *buildFilePart(const QString&filename,const QString&mimetype,const QString&content); |
43 | void smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ); | 43 | void smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ); |
44 | clist *createRcptList( mailimf_fields *fields ); | 44 | clist *createRcptList( mailimf_fields *fields ); |
45 | SMTPaccount *getAccount(const QString&from ); | ||
46 | 45 | ||
47 | static void storeMail(char*mail, size_t length, const QString&box); | 46 | static void storeMail(char*mail, size_t length, const QString&box); |
48 | static QString mailsmtpError( int err ); | 47 | static QString mailsmtpError( int err ); |