-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 18 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/nntpwrapper.cpp | 25 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/pop3wrapper.cpp | 18 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/smtpwrapper.cpp | 19 |
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 @@ -95,9 +95,9 @@ 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; if (account->getOffline()) return; @@ -111,24 +111,24 @@ void IMAPwrapper::login() 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 ); @@ -145,11 +145,11 @@ 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 && err != MAILIMAP_NO_ERROR_AUTHENTICATED && @@ -179,9 +179,9 @@ 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 @@ -116,42 +116,33 @@ void NNTPwrapper::login() /* 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); @@ -166,10 +157,10 @@ void NNTPwrapper::login() } 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) { 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 @@ -117,9 +117,9 @@ void POP3wrapper::login() /* 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(); @@ -129,24 +129,23 @@ void POP3wrapper::login() 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; @@ -159,11 +158,10 @@ 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) { ; // odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl; 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 @@ -181,21 +181,20 @@ 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; } else if (m_SmtpAccount->ConnectionType() == 1) { @@ -214,12 +213,12 @@ 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)); @@ -257,21 +256,21 @@ void SMTPwrapper::connect_server() 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"); |