summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper
Side-by-side diff
Diffstat (limited to 'kmicromail/libmailwrapper') (more/less context) (show 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
@@ -96,7 +96,7 @@ bool IMAPwrapper::start_tls(bool force_tls)
void IMAPwrapper::login()
{
- const char *server, *user, *pass;
+ QString server, user, pass;
uint16_t port;
int err = MAILIMAP_NO_ERROR;
@@ -112,22 +112,22 @@ void IMAPwrapper::login()
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 );
@@ -146,9 +146,9 @@ void IMAPwrapper::login()
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 &&
@@ -180,7 +180,7 @@ 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;
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
@@ -117,40 +117,31 @@ void NNTPwrapper::login()
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);
@@ -167,8 +158,8 @@ void NNTPwrapper::login()
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 );
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
@@ -118,7 +118,7 @@ void POP3wrapper::login()
if ( m_pop3 != NULL )
return;
- const char *server, *user, *pass;
+ QString server,user, pass;
uint16_t port;
int err = MAILPOP3_NO_ERROR;
@@ -130,22 +130,21 @@ void POP3wrapper::login()
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 ) {
@@ -160,9 +159,8 @@ void POP3wrapper::login()
//(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) {
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
@@ -182,19 +182,18 @@ int SMTPwrapper::start_smtp_tls()
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;
@@ -215,10 +214,10 @@ void SMTPwrapper::connect_server()
; // 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;
@@ -258,19 +257,19 @@ void SMTPwrapper::connect_server()
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 {