Diffstat (limited to 'kmicromail/libmailwrapper/nntpwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kmicromail/libmailwrapper/nntpwrapper.cpp | 25 |
1 files changed, 8 insertions, 17 deletions
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 @@ -96,100 +96,91 @@ RecBodyP NNTPwrapper::fetchBody( const RecMailP &mail ) { free(message); return body; } void NNTPwrapper::listMessages(const QString & which, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb) { login(); if (!m_nntp) return; uint32_t res_messages,res_recent,res_unseen; mailsession_status_folder(m_nntp->sto_session,(char*)which.latin1(),&res_messages,&res_recent,&res_unseen); parseList(target,m_nntp->sto_session,which,true, maxSizeInKb); } 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; if ( conntypeset == 3 ) { conntype = CONNECTION_TYPE_COMMAND; } else if ( conntypeset == 2 ) { conntype = CONNECTION_TYPE_TLS; } 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")); mailstorage_free(m_nntp); m_nntp = 0; } else { mailsession * session = m_nntp->sto_session; newsnntp * news = ( ( nntp_session_state_data * )session->sess_data )->nntp_session; news->nntp_progr_fun = &nntp_progress; } } void NNTPwrapper::logout() { int err = NEWSNNTP_NO_ERROR; if ( m_nntp == NULL ) return; mailstorage_free(m_nntp); m_nntp = 0; |