summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper/smtpwrapper.cpp
authorzautrix <zautrix>2004-10-23 19:32:41 (UTC)
committer zautrix <zautrix>2004-10-23 19:32:41 (UTC)
commit94df6192e59b7d4c69e2fb43ef2c39db08bb1c39 (patch) (side-by-side diff)
tree28956adbf73a61010d98deb27d83b324cb285471 /kmicromail/libmailwrapper/smtpwrapper.cpp
parent52b6fc17c0dcd1f13f701f698e0305440f26fc3e (diff)
downloadkdepimpi-94df6192e59b7d4c69e2fb43ef2c39db08bb1c39.zip
kdepimpi-94df6192e59b7d4c69e2fb43ef2c39db08bb1c39.tar.gz
kdepimpi-94df6192e59b7d4c69e2fb43ef2c39db08bb1c39.tar.bz2
compile fixes
Diffstat (limited to 'kmicromail/libmailwrapper/smtpwrapper.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/smtpwrapper.cpp59
1 files changed, 30 insertions, 29 deletions
diff --git a/kmicromail/libmailwrapper/smtpwrapper.cpp b/kmicromail/libmailwrapper/smtpwrapper.cpp
index d5a528c..dee1477 100644
--- a/kmicromail/libmailwrapper/smtpwrapper.cpp
+++ b/kmicromail/libmailwrapper/smtpwrapper.cpp
@@ -5,24 +5,25 @@
#include "mailtypes.h"
#include "sendmailprogress.h"
//#include <opie2/odebug.h>
//#include <qt.h>
#include <qapplication.h>
#include <qmessagebox.h>
#include <stdlib.h>
#include <qpe/config.h>
#include <qpe/qcopenvelope_qws.h>
#include <libetpan/libetpan.h>
+#include <klocale.h>
using namespace Opie::Core;
progressMailSend*SMTPwrapper::sendProgress = 0;
SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp )
: Generatemail()
{
m_SmtpAccount = aSmtp;
Config cfg( "mail" );
cfg.setGroup( "Status" );
m_queuedMail = cfg.readNumEntry( "outgoing", 0 );
@@ -35,61 +36,61 @@ SMTPwrapper::~SMTPwrapper()
{
disc_server();
}
void SMTPwrapper::emitQCop( int queued ) {
QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" );
env << queued;
}
QString SMTPwrapper::mailsmtpError( int errnum ) {
switch ( errnum ) {
case MAILSMTP_NO_ERROR:
- return tr( "No error" );
+ return i18n( "No error" );
case MAILSMTP_ERROR_UNEXPECTED_CODE:
- return tr( "Unexpected error code" );
+ return i18n( "Unexpected error code" );
case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE:
- return tr( "Service not available" );
+ return i18n( "Service not available" );
case MAILSMTP_ERROR_STREAM:
- return tr( "Stream error" );
+ return i18n( "Stream error" );
case MAILSMTP_ERROR_HOSTNAME:
- return tr( "gethostname() failed" );
+ return i18n( "gethostname() failed" );
case MAILSMTP_ERROR_NOT_IMPLEMENTED:
- return tr( "Not implemented" );
+ return i18n( "Not implemented" );
case MAILSMTP_ERROR_ACTION_NOT_TAKEN:
- return tr( "Error, action not taken" );
+ return i18n( "Error, action not taken" );
case MAILSMTP_ERROR_EXCEED_STORAGE_ALLOCATION:
- return tr( "Data exceeds storage allocation" );
+ return i18n( "Data exceeds storage allocation" );
case MAILSMTP_ERROR_IN_PROCESSING:
- return tr( "Error in processing" );
+ return i18n( "Error in processing" );
case MAILSMTP_ERROR_STARTTLS_NOT_SUPPORTED:
- return tr( "Starttls not supported" );
+ return i18n( "Starttls not supported" );
// case MAILSMTP_ERROR_INSUFFISANT_SYSTEM_STORAGE:
- // return tr( "Insufficient system storage" );
+ // return i18n( "Insufficient system storage" );
case MAILSMTP_ERROR_MAILBOX_UNAVAILABLE:
- return tr( "Mailbox unavailable" );
+ return i18n( "Mailbox unavailable" );
case MAILSMTP_ERROR_MAILBOX_NAME_NOT_ALLOWED:
- return tr( "Mailbox name not allowed" );
+ return i18n( "Mailbox name not allowed" );
case MAILSMTP_ERROR_BAD_SEQUENCE_OF_COMMAND:
- return tr( "Bad command sequence" );
+ return i18n( "Bad command sequence" );
case MAILSMTP_ERROR_USER_NOT_LOCAL:
- return tr( "User not local" );
+ return i18n( "User not local" );
case MAILSMTP_ERROR_TRANSACTION_FAILED:
- return tr( "Transaction failed" );
+ return i18n( "Transaction failed" );
case MAILSMTP_ERROR_MEMORY:
- return tr( "Memory error" );
+ return i18n( "Memory error" );
case MAILSMTP_ERROR_CONNECTION_REFUSED:
- return tr( "Connection refused" );
+ return i18n( "Connection refused" );
default:
- return tr( "Unknown error code" );
+ return i18n( "Unknown error code" );
}
}
void SMTPwrapper::progress( size_t current, size_t maximum ) {
if (SMTPwrapper::sendProgress) {
SMTPwrapper::sendProgress->setSingleMail(current, maximum );
qApp->processEvents();
}
}
void SMTPwrapper::storeMail(const char*mail, size_t length, const QString&box) {
@@ -143,26 +144,26 @@ bool SMTPwrapper::smtpSend( mailmime *mail,bool later) {
}
if (rcpts)
smtp_address_list_free( rcpts );
return result;
}
void SMTPwrapper::storeFailedMail(const char*data,unsigned int size, const char*failuremessage)
{
if (data) {
storeMail(data,size,"Sendfailed");
}
if (failuremessage) {
- QMessageBox::critical(0,tr("Error sending mail"),
- tr("<center>%1</center>").arg(failuremessage));
+ QMessageBox::critical(0,i18n("Error sending mail"),
+ i18n("<center>%1</center>").arg(failuremessage));
}
}
int SMTPwrapper::start_smtp_tls()
{
if (!m_smtp) {
return MAILSMTP_ERROR_IN_PROCESSING;
}
int err = mailesmtp_starttls(m_smtp);
if (err != MAILSMTP_NO_ERROR) return err;
mailstream_low * low;
mailstream_low * new_low;
@@ -212,77 +213,77 @@ void SMTPwrapper::connect_server()
int err = MAILSMTP_NO_ERROR;
; // odebug << "Servername " << server << " at port " << port << "" << oendl;
if ( ssl ) {
; // odebug << "SSL session" << oendl;
err = mailsmtp_ssl_connect( m_smtp, server.latin1(), port );
} else {
; // odebug << "No SSL session" << oendl;
err = mailsmtp_socket_connect( m_smtp, server.latin1(), port );
}
if ( err != MAILSMTP_NO_ERROR ) {
; // odebug << "Error init connection" << oendl;
- failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err));
+ failuretext = i18n("Error init SMTP connection: %1").arg(mailsmtpError(err));
result = 0;
}
/* switch to tls after init 'cause there it will send the ehlo */
if (result) {
err = mailsmtp_init( m_smtp );
if (err != MAILSMTP_NO_ERROR) {
result = 0;
- failuretext = tr("Error init SMTP connection: %1").arg(mailsmtpError(err));
+ failuretext = i18n("Error init SMTP connection: %1").arg(mailsmtpError(err));
}
}
if (try_tls) {
err = start_smtp_tls();
if (err != MAILSMTP_NO_ERROR) {
try_tls = false;
} else {
err = mailesmtp_ehlo(m_smtp);
}
}
if (!try_tls && force_tls) {
result = 0;
- failuretext = tr("Error init SMTP tls: %1").arg(mailsmtpError(err));
+ failuretext = i18n("Error init SMTP tls: %1").arg(mailsmtpError(err));
}
if (result==1 && m_SmtpAccount->getLogin() ) {
; // odebug << "smtp with auth" << oendl;
if ( m_SmtpAccount->getUser().isEmpty() || m_SmtpAccount->getPassword().isEmpty() ) {
// get'em
LoginDialog login( m_SmtpAccount->getUser(),
m_SmtpAccount->getPassword(), NULL, 0, true );
login.show();
if ( QDialog::Accepted == login.exec() ) {
// ok
user = login.getUser();
pass = login.getPassword();
} else {
result = 0;
- failuretext=tr("Login aborted - storing mail to localfolder");
+ failuretext=i18n("Login aborted - storing mail to localfolder");
}
} else {
user = m_SmtpAccount->getUser();
pass = m_SmtpAccount->getPassword();
}
; // odebug << "session->auth: " << m_smtp->auth << "" << oendl;
if (result) {
err = mailsmtp_auth( m_smtp, (char*)user.latin1(), (char*)pass.latin1() );
if ( err == MAILSMTP_NO_ERROR ) {
; // odebug << "auth ok" << oendl;
} else {
- failuretext = tr("Authentification failed");
+ failuretext = i18n("Authentification failed");
result = 0;
}
}
}
}
void SMTPwrapper::disc_server()
{
if (m_smtp) {
mailsmtp_quit( m_smtp );
mailsmtp_free( m_smtp );
m_smtp = 0;
@@ -291,25 +292,25 @@ void SMTPwrapper::disc_server()
int SMTPwrapper::smtpSend(char*from,clist*rcpts,const char*data,size_t size )
{
int err,result;
QString failuretext = "";
connect_server();
result = 1;
if (m_smtp) {
err = mailsmtp_send( m_smtp, from, rcpts, data, size );
if ( err != MAILSMTP_NO_ERROR ) {
- failuretext=tr("Error sending mail: %1").arg(mailsmtpError(err));
+ failuretext=i18n("Error sending mail: %1").arg(mailsmtpError(err));
result = 0;
}
} else {
result = 0;
}
if (!result) {
storeFailedMail(data,size,failuretext);
} else {
; // odebug << "Mail sent." << oendl;
storeMail(data,size,"Sent");
}
@@ -424,26 +425,26 @@ bool SMTPwrapper::flushOutbox() {
} else {
return true;
}
}
sendProgress = new progressMailSend();
sendProgress->show();
sendProgress->setMaxMails(mailsToSend.count());
while (mailsToSend.count()>0) {
if (sendQueuedMail(wrap, (*mailsToSend.begin()))==0) {
- QMessageBox::critical(0,tr("Error sending mail"),
- tr("Error sending queued mail - breaking"));
+ QMessageBox::critical(0,i18n("Error sending mail"),
+ i18n("Error sending queued mail - breaking"));
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);
}
Config cfg( "mail" );