summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper/smtpwrapper.cpp
Unidiff
Diffstat (limited to 'kmicromail/libmailwrapper/smtpwrapper.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/smtpwrapper.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/kmicromail/libmailwrapper/smtpwrapper.cpp b/kmicromail/libmailwrapper/smtpwrapper.cpp
index 24f4786..5096f67 100644
--- a/kmicromail/libmailwrapper/smtpwrapper.cpp
+++ b/kmicromail/libmailwrapper/smtpwrapper.cpp
@@ -21,50 +21,51 @@
21 21
22 22
23using namespace Opie::Core; 23using namespace Opie::Core;
24progressMailSend*SMTPwrapper::sendProgress = 0; 24progressMailSend*SMTPwrapper::sendProgress = 0;
25 25
26SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp ) 26SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp )
27 : Generatemail() 27 : Generatemail()
28{ 28{
29 m_SmtpAccount = aSmtp; 29 m_SmtpAccount = aSmtp;
30 KConfig cfg( locateLocal("config", "kopiemailrc" ) ); 30 KConfig cfg( locateLocal("config", "kopiemailrc" ) );
31 cfg.setGroup( "Status" ); 31 cfg.setGroup( "Status" );
32 m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); 32 m_queuedMail = cfg.readNumEntry( "outgoing", 0 );
33 emit queuedMails( m_queuedMail ); 33 emit queuedMails( m_queuedMail );
34 connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) ); 34 connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) );
35 m_smtp = 0; 35 m_smtp = 0;
36} 36}
37 37
38SMTPwrapper::~SMTPwrapper() 38SMTPwrapper::~SMTPwrapper()
39{ 39{
40 disc_server(); 40 disc_server();
41} 41}
42 42
43void SMTPwrapper::emitQCop( int queued ) { 43void SMTPwrapper::emitQCop( int queued ) {
44#ifndef DESKTOP_VERSION 44#ifndef DESKTOP_VERSION
45 QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); 45 // LR : not used in kde-pim
46 env << queued; 46 //QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" );
47 //env << queued;
47#endif 48#endif
48} 49}
49 50
50QString SMTPwrapper::mailsmtpError( int errnum ) { 51QString SMTPwrapper::mailsmtpError( int errnum ) {
51 switch ( errnum ) { 52 switch ( errnum ) {
52 case MAILSMTP_NO_ERROR: 53 case MAILSMTP_NO_ERROR:
53 return i18n( "No error" ); 54 return i18n( "No error" );
54 case MAILSMTP_ERROR_UNEXPECTED_CODE: 55 case MAILSMTP_ERROR_UNEXPECTED_CODE:
55 return i18n( "Unexpected error code" ); 56 return i18n( "Unexpected error code" );
56 case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: 57 case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE:
57 return i18n( "Service not available" ); 58 return i18n( "Service not available" );
58 case MAILSMTP_ERROR_STREAM: 59 case MAILSMTP_ERROR_STREAM:
59 return i18n( "Stream error" ); 60 return i18n( "Stream error" );
60 case MAILSMTP_ERROR_HOSTNAME: 61 case MAILSMTP_ERROR_HOSTNAME:
61 return i18n( "gethostname() failed" ); 62 return i18n( "gethostname() failed" );
62 case MAILSMTP_ERROR_NOT_IMPLEMENTED: 63 case MAILSMTP_ERROR_NOT_IMPLEMENTED:
63 return i18n( "Not implemented" ); 64 return i18n( "Not implemented" );
64 case MAILSMTP_ERROR_ACTION_NOT_TAKEN: 65 case MAILSMTP_ERROR_ACTION_NOT_TAKEN:
65 return i18n( "Error, action not taken" ); 66 return i18n( "Error, action not taken" );
66 case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION: 67 case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION:
67 return i18n( "Data exceeds storage allocation" ); 68 return i18n( "Data exceeds storage allocation" );
68 case MAILSMTP_ERROR_IN_PROCESSING: 69 case MAILSMTP_ERROR_IN_PROCESSING:
69 return i18n( "Error in processing" ); 70 return i18n( "Error in processing" );
70 case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED: 71 case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED:
@@ -420,51 +421,50 @@ bool SMTPwrapper::flushOutbox() {
420 oldPw = m_SmtpAccount->getPassword(); 421 oldPw = m_SmtpAccount->getPassword();
421 oldUser = m_SmtpAccount->getUser(); 422 oldUser = m_SmtpAccount->getUser();
422 if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) { 423 if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) {
423 // get'em 424 // get'em
424 QString user,pass; 425 QString user,pass;
425 LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true ); 426 LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true );
426 login.show(); 427 login.show();
427 if ( QDialog::Accepted == login.exec() ) { 428 if ( QDialog::Accepted == login.exec() ) {
428 // ok 429 // ok
429 user = login.getUser().latin1(); 430 user = login.getUser().latin1();
430 pass = login.getPassword().latin1(); 431 pass = login.getPassword().latin1();
431 reset_user_value = true; 432 reset_user_value = true;
432 m_SmtpAccount->setUser(user); 433 m_SmtpAccount->setUser(user);
433 m_SmtpAccount->setPassword(pass); 434 m_SmtpAccount->setPassword(pass);
434 } else { 435 } else {
435 return true; 436 return true;
436 } 437 }
437 } 438 }
438 439
439 440
440 sendProgress = new progressMailSend(); 441 sendProgress = new progressMailSend();
441 sendProgress->show(); 442 sendProgress->show();
442 sendProgress->setMaxMails(mailsToSend.count()); 443 sendProgress->setMaxMails(mailsToSend.count());
443 444
444 while (mailsToSend.count()>0) { 445 while (returnValue && mailsToSend.count()>0) {
445 if (sendQueuedMail(wrap, (*mailsToSend.begin()))==0) { 446 if (sendQueuedMail(wrap, (*mailsToSend.begin()))==0) {
446 QMessageBox::critical(0,i18n("Error sending mail"), 447 QMessageBox::critical(0,i18n("Error sending mail"),
447 i18n("Error sending queued mail - breaking")); 448 i18n("Error sending queued mail.\nBreaking."));
448 returnValue = false; 449 returnValue = false;
449 break;
450 } 450 }
451 mailsToRemove.append((*mailsToSend.begin())); 451 mailsToRemove.append((*mailsToSend.begin()));
452 mailsToSend.remove(mailsToSend.begin()); 452 mailsToSend.remove(mailsToSend.begin());
453 sendProgress->setCurrentMails(mailsToRemove.count()); 453 sendProgress->setCurrentMails(mailsToRemove.count());
454 } 454 }
455 if (reset_user_value) { 455 if (reset_user_value) {
456 m_SmtpAccount->setUser(oldUser); 456 m_SmtpAccount->setUser(oldUser);
457 m_SmtpAccount->setPassword(oldPw); 457 m_SmtpAccount->setPassword(oldPw);
458 } 458 }
459 KConfig cfg( locateLocal("config", "kopiemailrc" ) ); 459 KConfig cfg( locateLocal("config", "kopiemailrc" ) );
460 cfg.setGroup( "Status" ); 460 cfg.setGroup( "Status" );
461 m_queuedMail = 0; 461 m_queuedMail = mailsToSend.count();
462 cfg.writeEntry( "outgoing", m_queuedMail ); 462 cfg.writeEntry( "outgoing", m_queuedMail );
463 emit queuedMails( m_queuedMail ); 463 emit queuedMails( m_queuedMail );
464 sendProgress->hide(); 464 sendProgress->hide();
465 delete sendProgress; 465 delete sendProgress;
466 sendProgress = 0; 466 sendProgress = 0;
467 wrap->deleteMails(mbox,mailsToRemove); 467 wrap->deleteMails(mbox,mailsToRemove);
468 delete wrap; 468 delete wrap;
469 return returnValue; 469 return returnValue;
470} 470}