summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper/smtpwrapper.cpp
authorzautrix <zautrix>2005-02-28 15:30:47 (UTC)
committer zautrix <zautrix>2005-02-28 15:30:47 (UTC)
commit16575cca67c9047de72530080dfeb5793a66c935 (patch) (side-by-side diff)
treefec5ada5eee13fad9c73ec04cd066ccaf2619d4a /kmicromail/libmailwrapper/smtpwrapper.cpp
parentb1f912cbb6a9daf050e94d337de0e0e73417284a (diff)
downloadkdepimpi-16575cca67c9047de72530080dfeb5793a66c935.zip
kdepimpi-16575cca67c9047de72530080dfeb5793a66c935.tar.gz
kdepimpi-16575cca67c9047de72530080dfeb5793a66c935.tar.bz2
mail fix
Diffstat (limited to 'kmicromail/libmailwrapper/smtpwrapper.cpp') (more/less context) (ignore 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
@@ -13,66 +13,67 @@
#ifndef DESKTOP_VERSION
//#include <qpe/config.h>
#include <qpe/qcopenvelope_qws.h>
#endif
#include <libetpan/libetpan.h>
#include <klocale.h>
#include <kglobal.h>
#include <kconfig.h>
using namespace Opie::Core;
progressMailSend*SMTPwrapper::sendProgress = 0;
SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp )
: Generatemail()
{
m_SmtpAccount = aSmtp;
KConfig cfg( locateLocal("config", "kopiemailrc" ) );
cfg.setGroup( "Status" );
m_queuedMail = cfg.readNumEntry( "outgoing", 0 );
emit queuedMails( m_queuedMail );
connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) );
m_smtp = 0;
}
SMTPwrapper::~SMTPwrapper()
{
disc_server();
}
void SMTPwrapper::emitQCop( int queued ) {
#ifndef DESKTOP_VERSION
- QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" );
- env << queued;
+ // LR : not used in kde-pim
+ //QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" );
+ //env << queued;
#endif
}
QString SMTPwrapper::mailsmtpError( int errnum ) {
switch ( errnum ) {
case MAILSMTP_NO_ERROR:
return i18n( "No error" );
case MAILSMTP_ERROR_UNEXPECTED_CODE:
return i18n( "Unexpected error code" );
case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE:
return i18n( "Service not available" );
case MAILSMTP_ERROR_STREAM:
return i18n( "Stream error" );
case MAILSMTP_ERROR_HOSTNAME:
return i18n( "gethostname() failed" );
case MAILSMTP_ERROR_NOT_IMPLEMENTED:
return i18n( "Not implemented" );
case MAILSMTP_ERROR_ACTION_NOT_TAKEN:
return i18n( "Error, action not taken" );
case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION:
return i18n( "Data exceeds storage allocation" );
case MAILSMTP_ERROR_IN_PROCESSING:
return i18n( "Error in processing" );
case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED:
return i18n( "Starttls not supported" );
// case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE:
// return i18n( "Insufficient system storage" );
case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE:
return i18n( "Mailbox unavailable" );
case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED:
return i18n( "Mailbox name not allowed" );
case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND:
@@ -412,59 +413,58 @@ bool SMTPwrapper::flushOutbox() {
QString mbox("Outgoing");
wrap->listMessages(mbox,mailsToSend);
if (mailsToSend.count()==0) {
delete wrap;
; // odebug << "No mails to send" << oendl;
return false;
}
oldPw = m_SmtpAccount->getPassword();
oldUser = m_SmtpAccount->getUser();
if (m_SmtpAccount->getLogin() && (m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty()) ) {
// get'em
QString user,pass;
LoginDialog login( m_SmtpAccount->getUser(), m_SmtpAccount->getPassword(), NULL, 0, true );
login.show();
if ( QDialog::Accepted == login.exec() ) {
// ok
user = login.getUser().latin1();
pass = login.getPassword().latin1();
reset_user_value = true;
m_SmtpAccount->setUser(user);
m_SmtpAccount->setPassword(pass);
} else {
return true;
}
}
sendProgress = new progressMailSend();
sendProgress->show();
sendProgress->setMaxMails(mailsToSend.count());
- while (mailsToSend.count()>0) {
+ while (returnValue && mailsToSend.count()>0) {
if (sendQueuedMail(wrap, (*mailsToSend.begin()))==0) {
QMessageBox::critical(0,i18n("Error sending mail"),
- i18n("Error sending queued mail - breaking"));
+ i18n("Error sending queued mail.\nBreaking."));
returnValue = false;
- break;
}
mailsToRemove.append((*mailsToSend.begin()));
mailsToSend.remove(mailsToSend.begin());
sendProgress->setCurrentMails(mailsToRemove.count());
}
if (reset_user_value) {
m_SmtpAccount->setUser(oldUser);
m_SmtpAccount->setPassword(oldPw);
}
KConfig cfg( locateLocal("config", "kopiemailrc" ) );
cfg.setGroup( "Status" );
- m_queuedMail = 0;
+ m_queuedMail = mailsToSend.count();
cfg.writeEntry( "outgoing", m_queuedMail );
emit queuedMails( m_queuedMail );
sendProgress->hide();
delete sendProgress;
sendProgress = 0;
wrap->deleteMails(mbox,mailsToRemove);
delete wrap;
return returnValue;
}