author | alwin <alwin> | 2004-01-06 10:50:04 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-01-06 10:50:04 (UTC) |
commit | 37ac44d5582a5c4793482ed544a38a014c5fe8a2 (patch) (unidiff) | |
tree | 9dea89a03d7d3ebf68190ff55848b6756a4b47d6 | |
parent | d462abe3a8f908111eeb9bdf1b2675a0bc322edc (diff) | |
download | opie-37ac44d5582a5c4793482ed544a38a014c5fe8a2.zip opie-37ac44d5582a5c4793482ed544a38a014c5fe8a2.tar.gz opie-37ac44d5582a5c4793482ed544a38a014c5fe8a2.tar.bz2 |
hopefully fixed problems when logging into pop3 servers
it seems, that APOP login isn't working
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index 72c145b..ec4dcd2 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp | |||
@@ -117,68 +117,69 @@ void POP3wrapper::login() | |||
117 | 117 | ||
118 | server = account->getServer().latin1(); | 118 | server = account->getServer().latin1(); |
119 | port = account->getPort().toUInt(); | 119 | port = account->getPort().toUInt(); |
120 | 120 | ||
121 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { | 121 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { |
122 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); | 122 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); |
123 | login.show(); | 123 | login.show(); |
124 | if ( QDialog::Accepted == login.exec() ) { | 124 | if ( QDialog::Accepted == login.exec() ) { |
125 | // ok | 125 | // ok |
126 | user = login.getUser().latin1(); | 126 | user = login.getUser().latin1(); |
127 | pass = login.getPassword().latin1(); | 127 | pass = login.getPassword().latin1(); |
128 | } else { | 128 | } else { |
129 | // cancel | 129 | // cancel |
130 | qDebug( "POP3: Login canceled" ); | 130 | qDebug( "POP3: Login canceled" ); |
131 | return; | 131 | return; |
132 | } | 132 | } |
133 | } else { | 133 | } else { |
134 | user = account->getUser().latin1(); | 134 | user = account->getUser().latin1(); |
135 | pass = account->getPassword().latin1(); | 135 | pass = account->getPassword().latin1(); |
136 | } | 136 | } |
137 | 137 | ||
138 | bool ssl = account->getSSL(); | 138 | bool ssl = account->getSSL(); |
139 | 139 | ||
140 | m_pop3=mailstorage_new(NULL); | 140 | m_pop3=mailstorage_new(NULL); |
141 | pop3_mailstorage_init(m_pop3,(char*)server,port,NULL,CONNECTION_TYPE_TRY_STARTTLS,POP3_AUTH_TYPE_TRY_APOP, | 141 | int conntype = (ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN); |
142 | |||
143 | pop3_mailstorage_init(m_pop3,(char*)server,port,NULL,conntype,POP3_AUTH_TYPE_PLAIN, | ||
142 | (char*)user,(char*)pass,0,0,0); | 144 | (char*)user,(char*)pass,0,0,0); |
143 | 145 | ||
144 | m_folder = mailfolder_new(m_pop3, NULL, NULL); | 146 | m_folder = mailfolder_new(m_pop3, NULL, NULL); |
145 | 147 | ||
146 | if (m_folder==0) { | 148 | if (m_folder==0) { |
147 | Global::statusMessage(tr("Error initializing folder")); | 149 | Global::statusMessage(tr("Error initializing folder")); |
148 | mailstorage_free(m_pop3); | 150 | mailstorage_free(m_pop3); |
149 | m_pop3 = NULL; | 151 | m_pop3 = NULL; |
150 | return; | 152 | return; |
151 | } | 153 | } |
152 | err = mailfolder_connect(m_folder); | 154 | err = mailfolder_connect(m_folder); |
153 | if (err != MAIL_NO_ERROR) { | 155 | if (err != MAIL_NO_ERROR) { |
154 | Global::statusMessage(tr("Error initializing folder")); | 156 | Global::statusMessage(tr("Error initializing folder")); |
155 | mailfolder_free(m_folder); | 157 | mailfolder_free(m_folder); |
156 | m_folder = 0; | 158 | m_folder = 0; |
157 | mailstorage_free(m_pop3); | 159 | mailstorage_free(m_pop3); |
158 | m_pop3 = 0; | 160 | m_pop3 = 0; |
159 | } | 161 | } |
160 | qDebug( "POP3: logged in!" ); | ||
161 | } | 162 | } |
162 | 163 | ||
163 | void POP3wrapper::logout() | 164 | void POP3wrapper::logout() |
164 | { | 165 | { |
165 | int err = MAILPOP3_NO_ERROR; | 166 | int err = MAILPOP3_NO_ERROR; |
166 | if ( m_pop3 == NULL ) return; | 167 | if ( m_pop3 == NULL ) return; |
167 | mailfolder_free(m_folder); | 168 | mailfolder_free(m_folder); |
168 | m_folder = 0; | 169 | m_folder = 0; |
169 | mailstorage_free(m_pop3); | 170 | mailstorage_free(m_pop3); |
170 | m_pop3 = 0; | 171 | m_pop3 = 0; |
171 | } | 172 | } |
172 | 173 | ||
173 | 174 | ||
174 | QList<Folder>* POP3wrapper::listFolders() | 175 | QList<Folder>* POP3wrapper::listFolders() |
175 | { | 176 | { |
176 | QList<Folder> * folders = new QList<Folder>(); | 177 | QList<Folder> * folders = new QList<Folder>(); |
177 | folders->setAutoDelete( false ); | 178 | folders->setAutoDelete( false ); |
178 | Folder*inb=new Folder("INBOX","/"); | 179 | Folder*inb=new Folder("INBOX","/"); |
179 | folders->append(inb); | 180 | folders->append(inb); |
180 | return folders; | 181 | return folders; |
181 | } | 182 | } |
182 | 183 | ||
183 | void POP3wrapper::deleteMail(const RecMail&mail) | 184 | void POP3wrapper::deleteMail(const RecMail&mail) |
184 | { | 185 | { |