summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/composemail.cpp14
-rw-r--r--kmicromail/libmailwrapper/smtpwrapper.cpp23
-rw-r--r--kmicromail/libmailwrapper/smtpwrapper.h4
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
@@ -120,9 +120,9 @@ void ComposeMail::saveAsDraft()
120 wrapper.storeMail(mail); 120 wrapper.storeMail(mail);
121 121
122 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 122 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
123 /* attachments we will ignore! */ 123 /* attachments we will ignore! */
124 if ( it != NULL ) { 124 if ( it != 0 ) {
125 if ( warnAttach ) 125 if ( warnAttach )
126 QMessageBox::warning(0,tr("Store message"), 126 QMessageBox::warning(0,tr("Store message"),
127 tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); 127 tr("<center>Attachments will not be stored in \"Draft\" folder</center>"));
128 warnAttach = false; 128 warnAttach = false;
@@ -135,9 +135,9 @@ void ComposeMail::clearStatus()
135} 135}
136void ComposeMail::setStatus( QString status ) 136void ComposeMail::setStatus( QString status )
137{ 137{
138 topLevelWidget()->setCaption( status ); 138 topLevelWidget()->setCaption( status );
139 QTimer::singleShot ( 5000, this, SLOT( clearStatus() ) ) ; 139 QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ;
140} 140}
141void ComposeMail::pickAddress( QLineEdit *line ) 141void ComposeMail::pickAddress( QLineEdit *line )
142{ 142{
143 //qDebug(" ComposeMail::pickAddress "); 143 //qDebug(" ComposeMail::pickAddress ");
@@ -299,15 +299,21 @@ void ComposeMail::accept()
299 txt.append( sigMultiLine->text() ); 299 txt.append( sigMultiLine->text() );
300 } 300 }
301 mail->setMessage( txt ); 301 mail->setMessage( txt );
302 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 302 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
303 while ( it != NULL ) { 303 while ( it != 0 ) {
304 mail->addAttachment( it->getAttachment() ); 304 mail->addAttachment( it->getAttachment() );
305 it = (AttachViewItem *) it->nextSibling(); 305 it = (AttachViewItem *) it->nextSibling();
306 } 306 }
307 307
308 SMTPwrapper wrapper( smtp ); 308 SMTPwrapper wrapper( smtp );
309 wrapper.sendMail( mail,checkBoxLater->isChecked() ); 309 if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) )
310 setStatus( tr ("Mail sent"));
311 else {
312 setStatus( tr ("Error: Something went wrong. Nothing sent"));
313 return;
314 }
315
310 316
311 QDialog::accept(); 317 QDialog::accept();
312} 318}
313 319
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
@@ -101,9 +101,9 @@ void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) {
101 wrap->storeMessage(mail,length,box); 101 wrap->storeMessage(mail,length,box);
102 delete wrap; 102 delete wrap;
103} 103}
104 104
105void SMTPwrapper::smtpSend( mailmime *mail,bool later) { 105bool SMTPwrapper::smtpSend( mailmime *mail,bool later) {
106 clist *rcpts = 0; 106 clist *rcpts = 0;
107 char *from, *data; 107 char *from, *data;
108 size_t size; 108 size_t size;
109 109
@@ -117,10 +117,10 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later) {
117 mailmessage_free(msg); 117 mailmessage_free(msg);
118 if (r != MAIL_NO_ERROR || !data) { 118 if (r != MAIL_NO_ERROR || !data) {
119 if (data) 119 if (data)
120 free(data); 120 free(data);
121 ; // odebug << "Error fetching mime..." << oendl; 121 qDebug("Error fetching mime... ");
122 return; 122 return false;
123 } 123 }
124 msg = 0; 124 msg = 0;
125 if (later) { 125 if (later) {
126 storeMail(data,size,"Outgoing"); 126 storeMail(data,size,"Outgoing");
@@ -129,21 +129,22 @@ void SMTPwrapper::smtpSend( mailmime *mail,bool later) {
129 Config cfg( "mail" ); 129 Config cfg( "mail" );
130 cfg.setGroup( "Status" ); 130 cfg.setGroup( "Status" );
131 cfg.writeEntry( "outgoing", ++m_queuedMail ); 131 cfg.writeEntry( "outgoing", ++m_queuedMail );
132 emit queuedMails( m_queuedMail ); 132 emit queuedMails( m_queuedMail );
133 return; 133 return true;
134 } 134 }
135 from = getFrom( mail ); 135 from = getFrom( mail );
136 rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); 136 rcpts = createRcptList( mail->mm_data.mm_message.mm_fields );
137 smtpSend(from,rcpts,data,size); 137 bool result = smtpSend(from,rcpts,data,size);
138 if (data) { 138 if (data) {
139 free(data); 139 free(data);
140 } 140 }
141 if (from) { 141 if (from) {
142 free(from); 142 free(from);
143 } 143 }
144 if (rcpts) 144 if (rcpts)
145 smtp_address_list_free( rcpts ); 145 smtp_address_list_free( rcpts );
146 return result;
146} 147}
147 148
148void SMTPwrapper::storeFailedMail(const char*data,unsigned int size, const char*failuremessage) 149void SMTPwrapper::storeFailedMail(const char*data,unsigned int size, const char*failuremessage)
149{ 150{
@@ -315,26 +316,28 @@ int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size )
315 } 316 }
316 return result; 317 return result;
317} 318}
318 319
319void SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later ) 320bool SMTPwrapper::sendMail(const Opie::Core::OSmartPointer<Mail>&mail,bool later )
320{ 321{
321 mailmime * mimeMail; 322 mailmime * mimeMail;
322 323 bool result = true;
323 mimeMail = createMimeMail(mail ); 324 mimeMail = createMimeMail(mail );
324 if ( mimeMail == NULL ) { 325 if ( mimeMail == 0 ) {
325 ; // odebug << "sendMail: error creating mime mail" << oendl; 326 qDebug("SMTP wrapper:Error creating mail! ");
327 return false;
326 } else { 328 } else {
327 sendProgress = new progressMailSend(); 329 sendProgress = new progressMailSend();
328 sendProgress->show(); 330 sendProgress->show();
329 sendProgress->setMaxMails(1); 331 sendProgress->setMaxMails(1);
330 smtpSend( mimeMail,later); 332 result = smtpSend( mimeMail,later);
331 ; // odebug << "Clean up done" << oendl; 333 ; // odebug << "Clean up done" << oendl;
332 sendProgress->hide(); 334 sendProgress->hide();
333 delete sendProgress; 335 delete sendProgress;
334 sendProgress = 0; 336 sendProgress = 0;
335 mailmime_free( mimeMail ); 337 mailmime_free( mimeMail );
336 } 338 }
339 return result;
337} 340}
338 341
339int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) { 342int SMTPwrapper::sendQueuedMail(AbstractMail*wrap,const RecMailP&which) {
340 size_t curTok = 0; 343 size_t curTok = 0;
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
@@ -22,9 +22,9 @@ class SMTPwrapper : public Generatemail
22 22
23public: 23public:
24 SMTPwrapper(SMTPaccount * aSmtp); 24 SMTPwrapper(SMTPaccount * aSmtp);
25 virtual ~SMTPwrapper(); 25 virtual ~SMTPwrapper();
26 void sendMail(const Opie::Core::OSmartPointer<Mail>& mail,bool later=false ); 26 bool sendMail(const Opie::Core::OSmartPointer<Mail>& mail,bool later=false );
27 bool flushOutbox(); 27 bool flushOutbox();
28 28
29 static progressMailSend*sendProgress; 29 static progressMailSend*sendProgress;
30 30
@@ -39,9 +39,9 @@ protected:
39 void disc_server(); 39 void disc_server();
40 int start_smtp_tls(); 40 int start_smtp_tls();
41 41
42 42
43 void smtpSend( mailmime *mail,bool later); 43 bool smtpSend( mailmime *mail,bool later);
44 44
45 static void storeMail(const char*mail, size_t length, const QString&box); 45 static void storeMail(const char*mail, size_t length, const QString&box);
46 static QString mailsmtpError( int err ); 46 static QString mailsmtpError( int err );
47 static void progress( size_t current, size_t maximum ); 47 static void progress( size_t current, size_t maximum );