-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.cpp | 47 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/smtpwrapper.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.cpp | 5 | ||||
-rw-r--r-- | noncore/net/mail/smtpwrapper.cpp | 47 | ||||
-rw-r--r-- | noncore/net/mail/smtpwrapper.h | 2 |
5 files changed, 59 insertions, 44 deletions
diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp index 770e2b8..a7e4837 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.cpp @@ -220,3 +220,3 @@ mailmime *SMTPwrapper::buildFilePart(const QString&filename,const QString&mimety int pos = filename.findRev( '/' ); - + if (filename.length()>0) { @@ -230,6 +230,6 @@ mailmime *SMTPwrapper::buildFilePart(const QString&filename,const QString&mimety int mechanism = MAILMIME_MECHANISM_BASE64; - + if ( mimetype.startsWith( "text/" ) ) { param = mailmime_parameter_new( strdup( "charset" ), - strdup( "iso-8859-1" ) ); + strdup( "iso-8859-1" ) ); disptype = MAILMIME_DISPOSITION_TYPE_INLINE; @@ -252,3 +252,3 @@ mailmime *SMTPwrapper::buildFilePart(const QString&filename,const QString&mimety param = 0; - } + } filePart = mailmime_new_empty( content, fields ); @@ -550,3 +550,3 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) from = data = 0; - + QString file = getTmpFile(); @@ -556,3 +556,3 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) f.remove(); - + if (later) { @@ -574,3 +574,3 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,char*data,size_t size, SMTPaccou int err,result; - + result = 1; @@ -580,3 +580,3 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,char*data,size_t size, SMTPaccou port = smtp->getPort().toUInt(); - + session = mailsmtp_new( 20, &progress ); @@ -646,5 +646,5 @@ void SMTPwrapper::sendMail(const Mail&mail,bool later ) mailmime * mimeMail; - + SMTPaccount *smtp = getAccount(mail.getName()); - + mimeMail = createMimeMail(mail ); @@ -654,3 +654,3 @@ void SMTPwrapper::sendMail(const Mail&mail,bool later ) sendProgress = new progressMailSend(); -// sendProgress->showMaximized(); +// sendProgress->showMaximized(); sendProgress->show(); @@ -678,3 +678,3 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) if (!data) return 0; - int err = mailimf_fields_parse( data, length, &curTok, &fields ); + int err = mailimf_fields_parse( data, length, &curTok, &fields ); if (err != MAILIMF_NO_ERROR) { @@ -684,3 +684,3 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) } - + rcpts = createRcptList( fields ); @@ -688,3 +688,3 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) from = getFrom(ffrom); - + qDebug("Size: %i vs. %i",length,strlen(data)); @@ -697,6 +697,9 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) /* this is a special fun */ -void SMTPwrapper::flushOutbox(SMTPaccount*smtp) +bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) { - if (!smtp) return; - QString localfolders = (QString) getenv( "HOME" ) + QString("/Applications/opiemail/localmail/"); + bool returnValue = true; + + if (!smtp) return false; + + QString localfolders = (QString) getenv( "HOME" ) + QString("/Applications/opiemail/localmail/"); MBOXwrapper*wrap = new MBOXwrapper(localfolders); @@ -704,3 +707,3 @@ void SMTPwrapper::flushOutbox(SMTPaccount*smtp) qDebug("memory error"); - return; + return false; } @@ -712,3 +715,3 @@ void SMTPwrapper::flushOutbox(SMTPaccount*smtp) delete wrap; - return; + return false; } @@ -716,3 +719,3 @@ void SMTPwrapper::flushOutbox(SMTPaccount*smtp) sendProgress = new progressMailSend(); -// sendProgress->showMaximized(); +// sendProgress->showMaximized(); sendProgress->show(); @@ -724,2 +727,4 @@ void SMTPwrapper::flushOutbox(SMTPaccount*smtp) tr("Error sending queued mail - breaking")); + + returnValue = false; break; @@ -736,2 +741,4 @@ void SMTPwrapper::flushOutbox(SMTPaccount*smtp) delete wrap; + return returnValue; + } diff --git a/noncore/net/mail/libmailwrapper/smtpwrapper.h b/noncore/net/mail/libmailwrapper/smtpwrapper.h index baa353b..66180b7 100644 --- a/noncore/net/mail/libmailwrapper/smtpwrapper.h +++ b/noncore/net/mail/libmailwrapper/smtpwrapper.h @@ -30,3 +30,3 @@ public: void sendMail(const Mail& mail,bool later=false ); - void flushOutbox(SMTPaccount*smtp); + bool flushOutbox(SMTPaccount*smtp); diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index 833cac2..0dede90 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp @@ -70,4 +70,5 @@ void OpieMail::slotSendQueued() SMTPwrapper * wrap = new SMTPwrapper(settings); - wrap->flushOutbox(smtp); - QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); + if ( wrap->flushOutbox(smtp) ) { + QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); + } } diff --git a/noncore/net/mail/smtpwrapper.cpp b/noncore/net/mail/smtpwrapper.cpp index 770e2b8..a7e4837 100644 --- a/noncore/net/mail/smtpwrapper.cpp +++ b/noncore/net/mail/smtpwrapper.cpp @@ -220,3 +220,3 @@ mailmime *SMTPwrapper::buildFilePart(const QString&filename,const QString&mimety int pos = filename.findRev( '/' ); - + if (filename.length()>0) { @@ -230,6 +230,6 @@ mailmime *SMTPwrapper::buildFilePart(const QString&filename,const QString&mimety int mechanism = MAILMIME_MECHANISM_BASE64; - + if ( mimetype.startsWith( "text/" ) ) { param = mailmime_parameter_new( strdup( "charset" ), - strdup( "iso-8859-1" ) ); + strdup( "iso-8859-1" ) ); disptype = MAILMIME_DISPOSITION_TYPE_INLINE; @@ -252,3 +252,3 @@ mailmime *SMTPwrapper::buildFilePart(const QString&filename,const QString&mimety param = 0; - } + } filePart = mailmime_new_empty( content, fields ); @@ -550,3 +550,3 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) from = data = 0; - + QString file = getTmpFile(); @@ -556,3 +556,3 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later, SMTPaccount *smtp ) f.remove(); - + if (later) { @@ -574,3 +574,3 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,char*data,size_t size, SMTPaccou int err,result; - + result = 1; @@ -580,3 +580,3 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,char*data,size_t size, SMTPaccou port = smtp->getPort().toUInt(); - + session = mailsmtp_new( 20, &progress ); @@ -646,5 +646,5 @@ void SMTPwrapper::sendMail(const Mail&mail,bool later ) mailmime * mimeMail; - + SMTPaccount *smtp = getAccount(mail.getName()); - + mimeMail = createMimeMail(mail ); @@ -654,3 +654,3 @@ void SMTPwrapper::sendMail(const Mail&mail,bool later ) sendProgress = new progressMailSend(); -// sendProgress->showMaximized(); +// sendProgress->showMaximized(); sendProgress->show(); @@ -678,3 +678,3 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) if (!data) return 0; - int err = mailimf_fields_parse( data, length, &curTok, &fields ); + int err = mailimf_fields_parse( data, length, &curTok, &fields ); if (err != MAILIMF_NO_ERROR) { @@ -684,3 +684,3 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) } - + rcpts = createRcptList( fields ); @@ -688,3 +688,3 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) from = getFrom(ffrom); - + qDebug("Size: %i vs. %i",length,strlen(data)); @@ -697,6 +697,9 @@ int SMTPwrapper::sendQueuedMail(MBOXwrapper*wrap,SMTPaccount*smtp,RecMail*which) /* this is a special fun */ -void SMTPwrapper::flushOutbox(SMTPaccount*smtp) +bool SMTPwrapper::flushOutbox(SMTPaccount*smtp) { - if (!smtp) return; - QString localfolders = (QString) getenv( "HOME" ) + QString("/Applications/opiemail/localmail/"); + bool returnValue = true; + + if (!smtp) return false; + + QString localfolders = (QString) getenv( "HOME" ) + QString("/Applications/opiemail/localmail/"); MBOXwrapper*wrap = new MBOXwrapper(localfolders); @@ -704,3 +707,3 @@ void SMTPwrapper::flushOutbox(SMTPaccount*smtp) qDebug("memory error"); - return; + return false; } @@ -712,3 +715,3 @@ void SMTPwrapper::flushOutbox(SMTPaccount*smtp) delete wrap; - return; + return false; } @@ -716,3 +719,3 @@ void SMTPwrapper::flushOutbox(SMTPaccount*smtp) sendProgress = new progressMailSend(); -// sendProgress->showMaximized(); +// sendProgress->showMaximized(); sendProgress->show(); @@ -724,2 +727,4 @@ void SMTPwrapper::flushOutbox(SMTPaccount*smtp) tr("Error sending queued mail - breaking")); + + returnValue = false; break; @@ -736,2 +741,4 @@ void SMTPwrapper::flushOutbox(SMTPaccount*smtp) delete wrap; + return returnValue; + } diff --git a/noncore/net/mail/smtpwrapper.h b/noncore/net/mail/smtpwrapper.h index baa353b..66180b7 100644 --- a/noncore/net/mail/smtpwrapper.h +++ b/noncore/net/mail/smtpwrapper.h @@ -30,3 +30,3 @@ public: void sendMail(const Mail& mail,bool later=false ); - void flushOutbox(SMTPaccount*smtp); + bool flushOutbox(SMTPaccount*smtp); |