-rw-r--r-- | kmicromail/composemail.cpp | 14 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/smtpwrapper.cpp | 23 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/smtpwrapper.h | 4 |
3 files changed, 25 insertions, 16 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 2c2e279..ca4f247 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp @@ -123,3 +123,3 @@ void ComposeMail::saveAsDraft() /* attachments we will ignore! */ - if ( it != NULL ) { + if ( it != 0 ) { if ( warnAttach ) @@ -138,3 +138,3 @@ void ComposeMail::setStatus( QString status ) topLevelWidget()->setCaption( status ); - QTimer::singleShot ( 5000, this, SLOT( clearStatus() ) ) ; + QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; } @@ -302,3 +302,3 @@ void ComposeMail::accept() AttachViewItem *it = (AttachViewItem *) attList->firstChild(); - while ( it != NULL ) { + while ( it != 0 ) { mail->addAttachment( it->getAttachment() ); @@ -308,3 +308,9 @@ void ComposeMail::accept() SMTPwrapper wrapper( smtp ); - wrapper.sendMail( mail,checkBoxLater->isChecked() ); + if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) + setStatus( tr ("Mail sent")); + else { + setStatus( tr ("Error: Something went wrong. Nothing sent")); + return; + } + diff --git a/kmicromail/libmailwrapper/smtpwrapper.cpp b/kmicromail/libmailwrapper/smtpwrapper.cpp index 04a21ea..6a1b505 100644 --- a/kmicromail/libmailwrapper/smtpwrapper.cpp +++ b/kmicromail/libmailwrapper/smtpwrapper.cpp @@ -104,3 +104,3 @@ void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) { -void SMTPwrapper::smtpSend( mailmime *mail,bool later) { +bool SMTPwrapper::smtpSend( mailmime *mail,bool later) { clist *rcpts = 0; @@ -120,4 +120,4 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later) { free(data); - ; // odebug << "Error fetching mime..." << oendl; - return; + qDebug("Error fetching mime... "); + return false; } @@ -132,3 +132,3 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later) { emit queuedMails( m_queuedMail ); - return; + return true; } @@ -136,3 +136,3 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later) { rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); - smtpSend(from,rcpts,data,size); + bool result = smtpSend(from,rcpts,data,size); if (data) { @@ -145,2 +145,3 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later) { smtp_address_list_free( rcpts ); + return result; } @@ -318,9 +319,10 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size ) -void SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later ) +bool SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later ) { mailmime * mimeMail; - + bool result = true; mimeMail = createMimeMail(mail ); - if ( mimeMail == NULL ) { - ; // odebug << "sendMail: error creating mime mail" << oendl; + if ( mimeMail == 0 ) { + qDebug("SMTP wrapper:Error creating mail! "); + return false; } else { @@ -329,3 +331,3 @@ void SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later sendProgress->setMaxMails(1); - smtpSend( mimeMail,later); + result = smtpSend( mimeMail,later); ; // odebug << "Clean up done" << oendl; @@ -336,2 +338,3 @@ void SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later } + return result; } diff --git a/kmicromail/libmailwrapper/smtpwrapper.h b/kmicromail/libmailwrapper/smtpwrapper.h index 6c5bbe8..105cbf5 100644 --- a/kmicromail/libmailwrapper/smtpwrapper.h +++ b/kmicromail/libmailwrapper/smtpwrapper.h @@ -25,3 +25,3 @@ public: virtual ~SMTPwrapper(); - void sendMail(const Opie::Core::OSmartPointer<Mail>& mail,bool later=false ); + bool sendMail(const Opie::Core::OSmartPointer<Mail>& mail,bool later=false ); bool flushOutbox(); @@ -42,3 +42,3 @@ protected: - void smtpSend( mailmime *mail,bool later); + bool smtpSend( mailmime *mail,bool later); |