summaryrefslogtreecommitdiffabout
path: root/kmicromail
Side-by-side diff
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp18
-rw-r--r--kmicromail/libmailwrapper/nntpwrapper.cpp25
-rw-r--r--kmicromail/libmailwrapper/pop3wrapper.cpp18
-rw-r--r--kmicromail/libmailwrapper/smtpwrapper.cpp19
4 files changed, 34 insertions, 46 deletions
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp
index 11d3343..021633b 100644
--- a/kmicromail/libmailwrapper/imapwrapper.cpp
+++ b/kmicromail/libmailwrapper/imapwrapper.cpp
@@ -93,13 +93,13 @@ bool IMAPwrapper::start_tls(bool force_tls)
}
return try_tls;
}
void IMAPwrapper::login()
{
- const char *server, *user, *pass;
+ QString server, user, pass;
uint16_t port;
int err = MAILIMAP_NO_ERROR;
if (account->getOffline()) return;
/* we are connected this moment */
/* TODO: setup a timer holding the line or if connection closed - delete the value */
@@ -109,28 +109,28 @@ void IMAPwrapper::login()
logout();
} else {
mailstream_flush(m_imap->imap_stream);
return;
}
}
- server = account->getServer().latin1();
+ server = account->getServer();
port = account->getPort().toUInt();
if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
login.show();
if ( QDialog::Accepted == login.exec() ) {
// ok
- user = login.getUser().latin1();
- pass = login.getPassword().latin1();
+ user = login.getUser();
+ pass = login.getPassword();
} else {
// cancel
return;
}
} else {
- user = account->getUser().latin1();
- pass = account->getPassword().latin1();
+ user = account->getUser();
+ pass = account->getPassword();
}
m_imap = mailimap_new( 20, &imap_progress );
/* connect */
bool ssl = false;
@@ -143,15 +143,15 @@ void IMAPwrapper::login()
if (account->ConnectionType()==1) {
force_tls = true;
}
if ( ssl ) {
qDebug("using ssl ");
- err = mailimap_ssl_connect( m_imap, (char*)server, port );
+ err = mailimap_ssl_connect( m_imap, (char*)server.latin1(), port );
} else {
- err = mailimap_socket_connect( m_imap, (char*)server, port );
+ err = mailimap_socket_connect( m_imap, (char*)server.latin1(), port );
}
if ( err != MAILIMAP_NO_ERROR &&
err != MAILIMAP_NO_ERROR_AUTHENTICATED &&
err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) {
QString failure = "";
@@ -177,13 +177,13 @@ void IMAPwrapper::login()
}
/* login */
if (ok) {
- err = mailimap_login_simple( m_imap, (char*)user, (char*)pass );
+ err = mailimap_login_simple( m_imap, (char*)user.latin1(), (char*)pass.latin1() );
if ( err != MAILIMAP_NO_ERROR ) {
Global::statusMessage(tr("error logging in imap server: %1").arg(m_imap->imap_response));
ok = false;
}
}
if (!ok) {
diff --git a/kmicromail/libmailwrapper/nntpwrapper.cpp b/kmicromail/libmailwrapper/nntpwrapper.cpp
index f5d7f16..93cd2b5 100644
--- a/kmicromail/libmailwrapper/nntpwrapper.cpp
+++ b/kmicromail/libmailwrapper/nntpwrapper.cpp
@@ -114,46 +114,37 @@ void NNTPwrapper::login()
if (account->getOffline())
return;
/* we'll hold the line */
if ( m_nntp != NULL )
return;
- const char *server, *user, *pass;
+ QString server;
QString User,Pass;
uint16_t port;
int err = NEWSNNTP_NO_ERROR;
- server = account->getServer().latin1();
+ server = account->getServer();
port = account->getPort().toUInt();
- user = pass = 0;
-
if ( ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) && account->getLogin() ) {
LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
login.show();
if ( QDialog::Accepted == login.exec() ) {
// ok
- User = login.getUser().latin1();
- Pass = login.getPassword().latin1();
+ User = login.getUser();
+ Pass = login.getPassword();
} else {
// cancel
; // << "NNTP: Login canceled" << oendl;
return;
}
} else {
- User = account->getUser().latin1();
- Pass = account->getPassword().latin1();
+ User = account->getUser();
+ Pass = account->getPassword();
}
- if (User.isEmpty()) {
- user=0;
- pass = 0;
- } else {
- user=User.latin1();
- pass=Pass.latin1();
- }
// bool ssl = account->getSSL();
m_nntp=mailstorage_new(NULL);
int conntypeset = account->ConnectionType();
int conntype = 0;
@@ -164,14 +155,14 @@ void NNTPwrapper::login()
} else if ( conntypeset == 1 ) {
conntype = CONNECTION_TYPE_STARTTLS;
} else if ( conntypeset == 0 ) {
conntype = CONNECTION_TYPE_TRY_STARTTLS;
}
- nntp_mailstorage_init(m_nntp,(char*)server, port, NULL, CONNECTION_TYPE_PLAIN, NNTP_AUTH_TYPE_PLAIN,
- (char*)user,(char*)pass,0,0,0);
+ nntp_mailstorage_init(m_nntp,(char*)server.latin1(), port, NULL, CONNECTION_TYPE_PLAIN, NNTP_AUTH_TYPE_PLAIN,
+ (char*)User.latin1(),(char*)Pass.latin1(),0,0,0);
err = mailstorage_connect( m_nntp );
if (err != NEWSNNTP_NO_ERROR) {
; // << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl;
// Global::statusMessage(tr("Error initializing folder"));
diff --git a/kmicromail/libmailwrapper/pop3wrapper.cpp b/kmicromail/libmailwrapper/pop3wrapper.cpp
index 0e6612c..f430121 100644
--- a/kmicromail/libmailwrapper/pop3wrapper.cpp
+++ b/kmicromail/libmailwrapper/pop3wrapper.cpp
@@ -115,40 +115,39 @@ void POP3wrapper::login()
if (account->getOffline())
return;
/* we'll hold the line */
if ( m_pop3 != NULL )
return;
- const char *server, *user, *pass;
+ QString server,user, pass;
uint16_t port;
int err = MAILPOP3_NO_ERROR;
server = account->getServer().latin1();
port = account->getPort().toUInt();
if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) {
LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true );
login.show();
if ( QDialog::Accepted == login.exec() ) {
// ok
- user = login.getUser().latin1();
- pass = login.getPassword().latin1();
+ qDebug("ok ");
+ user = login.getUser();
+ pass = login.getPassword();
} else {
// cancel
; // odebug << "POP3: Login canceled" << oendl;
return;
}
} else {
- user = account->getUser().latin1();
- pass = account->getPassword().latin1();
+ user = account->getUser();
+ pass = account->getPassword();
}
-
// bool ssl = account->getSSL();
m_pop3=mailstorage_new(NULL);
-
int conntypeset = account->ConnectionType();
int conntype = 0;
if ( conntypeset == 3 ) {
conntype = CONNECTION_TYPE_COMMAND;
} else if ( conntypeset == 2 ) {
conntype = CONNECTION_TYPE_TLS;
@@ -157,15 +156,14 @@ void POP3wrapper::login()
} else if ( conntypeset == 0 ) {
conntype = CONNECTION_TYPE_TRY_STARTTLS;
}
//(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN);
- pop3_mailstorage_init(m_pop3,(char*)server, port, NULL, conntype, POP3_AUTH_TYPE_PLAIN,
- (char*)user,(char*)pass,0,0,0);
-
+ pop3_mailstorage_init(m_pop3,(char*)server.latin1(), port, NULL, conntype, POP3_AUTH_TYPE_PLAIN,
+ (char*)user.latin1(),(char*)pass.latin1(),0,0,0);
err = mailstorage_connect(m_pop3);
if (err != MAIL_NO_ERROR) {
; // odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl;
Global::statusMessage(tr("Error initializing folder"));
mailstorage_free(m_pop3);
diff --git a/kmicromail/libmailwrapper/smtpwrapper.cpp b/kmicromail/libmailwrapper/smtpwrapper.cpp
index 6a1b505..d5a528c 100644
--- a/kmicromail/libmailwrapper/smtpwrapper.cpp
+++ b/kmicromail/libmailwrapper/smtpwrapper.cpp
@@ -179,25 +179,24 @@ int SMTPwrapper::start_smtp_tls()
}
return err;
}
void SMTPwrapper::connect_server()
{
- const char *server, *user, *pass;
+ QString server, user, pass;
bool ssl;
uint16_t port;
ssl = false;
bool try_tls = true;
bool force_tls=false;
- server = user = pass = 0;
QString failuretext = "";
if (m_smtp || !m_SmtpAccount) {
return;
}
- server = m_SmtpAccount->getServer().latin1();
+ server = m_SmtpAccount->getServer();
if ( m_SmtpAccount->ConnectionType() == 2 ) {
ssl = true;
try_tls = false;
} else if (m_SmtpAccount->ConnectionType() == 1) {
force_tls = true;
}
@@ -212,16 +211,16 @@ 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, port );
+ err = mailsmtp_ssl_connect( m_smtp, server.latin1(), port );
} else {
; // odebug << "No SSL session" << oendl;
- err = mailsmtp_socket_connect( m_smtp, server, port );
+ 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));
result = 0;
}
@@ -255,25 +254,25 @@ void SMTPwrapper::connect_server()
// get'em
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();
+ user = login.getUser();
+ pass = login.getPassword();
} else {
result = 0;
failuretext=tr("Login aborted - storing mail to localfolder");
}
} else {
- user = m_SmtpAccount->getUser().latin1();
- pass = m_SmtpAccount->getPassword().latin1();
+ user = m_SmtpAccount->getUser();
+ pass = m_SmtpAccount->getPassword();
}
; // odebug << "session->auth: " << m_smtp->auth << "" << oendl;
if (result) {
- err = mailsmtp_auth( m_smtp, (char*)user, (char*)pass );
+ 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");
result = 0;
}