-rw-r--r-- | noncore/net/mail/libmailwrapper/nntpwrapper.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp index c68964d..54e0ed4 100644 --- a/noncore/net/mail/libmailwrapper/nntpwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/nntpwrapper.cpp | |||
@@ -116,31 +116,41 @@ void NNTPwrapper::login() | |||
116 | if ( m_nntp != NULL ) | 116 | if ( m_nntp != NULL ) |
117 | return; | 117 | return; |
118 | 118 | ||
119 | const char *server, *user, *pass; | 119 | const char *server, *user, *pass; |
120 | QString User,Pass; | ||
120 | uint16_t port; | 121 | uint16_t port; |
121 | int err = NEWSNNTP_NO_ERROR; | 122 | int err = NEWSNNTP_NO_ERROR; |
122 | 123 | ||
123 | server = account->getServer().latin1(); | 124 | server = account->getServer().latin1(); |
124 | port = account->getPort().toUInt(); | 125 | port = account->getPort().toUInt(); |
125 | 126 | ||
127 | user = pass = 0; | ||
128 | |||
126 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { | 129 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { |
127 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); | 130 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); |
128 | login.show(); | 131 | login.show(); |
129 | if ( QDialog::Accepted == login.exec() ) { | 132 | if ( QDialog::Accepted == login.exec() ) { |
130 | // ok | 133 | // ok |
131 | user = login.getUser().latin1(); | 134 | User = login.getUser().latin1(); |
132 | pass = login.getPassword().latin1(); | 135 | Pass = login.getPassword().latin1(); |
133 | } else { | 136 | } else { |
134 | // cancel | 137 | // cancel |
135 | qDebug( "NNTP: Login canceled" ); | 138 | qDebug( "NNTP: Login canceled" ); |
136 | return; | 139 | return; |
137 | } | 140 | } |
138 | } else { | 141 | } else { |
139 | user = account->getUser().latin1(); | 142 | User = account->getUser().latin1(); |
140 | pass = account->getPassword().latin1(); | 143 | Pass = account->getPassword().latin1(); |
141 | } | 144 | } |
142 | 145 | ||
146 | if (User.isEmpty()) { | ||
147 | user=0; | ||
148 | pass = 0; | ||
149 | } else { | ||
150 | user=User.latin1(); | ||
151 | pass=Pass.latin1(); | ||
152 | } | ||
143 | // bool ssl = account->getSSL(); | 153 | // bool ssl = account->getSSL(); |
144 | 154 | ||
145 | m_nntp=mailstorage_new(NULL); | 155 | m_nntp=mailstorage_new(NULL); |
146 | 156 | ||
@@ -155,9 +165,9 @@ void NNTPwrapper::login() | |||
155 | } else if ( conntypeset == 0 ) { | 165 | } else if ( conntypeset == 0 ) { |
156 | conntype = CONNECTION_TYPE_TRY_STARTTLS; | 166 | conntype = CONNECTION_TYPE_TRY_STARTTLS; |
157 | } | 167 | } |
158 | 168 | ||
159 | nntp_mailstorage_init(m_nntp,(char*)server, port, NULL, conntype, NNTP_AUTH_TYPE_PLAIN, | 169 | nntp_mailstorage_init(m_nntp,(char*)server, port, NULL, CONNECTION_TYPE_PLAIN, NNTP_AUTH_TYPE_PLAIN, |
160 | (char*)user,(char*)pass,0,0,0); | 170 | (char*)user,(char*)pass,0,0,0); |
161 | 171 | ||
162 | err = mailstorage_connect( m_nntp ); | 172 | err = mailstorage_connect( m_nntp ); |
163 | 173 | ||