author | harlekin <harlekin> | 2004-01-10 00:32:04 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2004-01-10 00:32:04 (UTC) |
commit | 76cf4990cb4171a747ac31e9832f4ee694ced2cc (patch) (unidiff) | |
tree | ce97c1b6b6e9f832cc09a71fe3e8e87551bb01bd /noncore/net/mail/libmailwrapper | |
parent | 241fb3509f6b62efda3c89f5bf9cec0dfba86b43 (diff) | |
download | opie-76cf4990cb4171a747ac31e9832f4ee694ced2cc.zip opie-76cf4990cb4171a747ac31e9832f4ee694ced2cc.tar.gz opie-76cf4990cb4171a747ac31e9832f4ee694ced2cc.tar.bz2 |
new connection setting stuff for imap too
Diffstat (limited to 'noncore/net/mail/libmailwrapper') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 12 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/settings.cpp | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 4b633ea..1c22c26 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -71,26 +71,36 @@ void IMAPwrapper::login() | |||
71 | } else { | 71 | } else { |
72 | // cancel | 72 | // cancel |
73 | qDebug( "IMAP: Login canceled" ); | 73 | qDebug( "IMAP: Login canceled" ); |
74 | return; | 74 | return; |
75 | } | 75 | } |
76 | } else { | 76 | } else { |
77 | user = account->getUser().latin1(); | 77 | user = account->getUser().latin1(); |
78 | pass = account->getPassword().latin1(); | 78 | pass = account->getPassword().latin1(); |
79 | } | 79 | } |
80 | 80 | ||
81 | m_imap = mailimap_new( 20, &imap_progress ); | 81 | m_imap = mailimap_new( 20, &imap_progress ); |
82 | 82 | ||
83 | |||
84 | |||
83 | /* connect */ | 85 | /* connect */ |
84 | if (account->getSSL()) { | 86 | |
87 | bool ssl = false; | ||
88 | |||
89 | if ( account->ConnectionType() == 2 ) { | ||
90 | ssl = true; | ||
91 | } | ||
92 | |||
93 | if ( ssl ) { | ||
94 | qDebug( "using ssl" ); | ||
85 | err = mailimap_ssl_connect( m_imap, (char*)server, port ); | 95 | err = mailimap_ssl_connect( m_imap, (char*)server, port ); |
86 | } else { | 96 | } else { |
87 | err = mailimap_socket_connect( m_imap, (char*)server, port ); | 97 | err = mailimap_socket_connect( m_imap, (char*)server, port ); |
88 | } | 98 | } |
89 | 99 | ||
90 | if ( err != MAILIMAP_NO_ERROR && | 100 | if ( err != MAILIMAP_NO_ERROR && |
91 | err != MAILIMAP_NO_ERROR_AUTHENTICATED && | 101 | err != MAILIMAP_NO_ERROR_AUTHENTICATED && |
92 | err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) { | 102 | err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) { |
93 | QString failure = ""; | 103 | QString failure = ""; |
94 | if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) { | 104 | if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) { |
95 | failure="Connection refused"; | 105 | failure="Connection refused"; |
96 | } else { | 106 | } else { |
diff --git a/noncore/net/mail/libmailwrapper/settings.cpp b/noncore/net/mail/libmailwrapper/settings.cpp index 7b6a58d..3279f39 100644 --- a/noncore/net/mail/libmailwrapper/settings.cpp +++ b/noncore/net/mail/libmailwrapper/settings.cpp | |||
@@ -155,46 +155,48 @@ QString IMAPaccount::getUniqueFileName() | |||
155 | } | 155 | } |
156 | 156 | ||
157 | void IMAPaccount::read() | 157 | void IMAPaccount::read() |
158 | { | 158 | { |
159 | Config *conf = new Config( getFileName(), Config::File ); | 159 | Config *conf = new Config( getFileName(), Config::File ); |
160 | conf->setGroup( "IMAP Account" ); | 160 | conf->setGroup( "IMAP Account" ); |
161 | accountName = conf->readEntry( "Account","" ); | 161 | accountName = conf->readEntry( "Account","" ); |
162 | if (accountName.isNull()) accountName = ""; | 162 | if (accountName.isNull()) accountName = ""; |
163 | server = conf->readEntry( "Server","" ); | 163 | server = conf->readEntry( "Server","" ); |
164 | if (server.isNull()) server=""; | 164 | if (server.isNull()) server=""; |
165 | port = conf->readEntry( "Port","" ); | 165 | port = conf->readEntry( "Port","" ); |
166 | if (port.isNull()) port="143"; | 166 | if (port.isNull()) port="143"; |
167 | connectionType = conf->readNumEntry( "ConnectionType" ); | ||
167 | ssl = conf->readBoolEntry( "SSL",false ); | 168 | ssl = conf->readBoolEntry( "SSL",false ); |
168 | user = conf->readEntry( "User","" ); | 169 | user = conf->readEntry( "User","" ); |
169 | if (user.isNull()) user = ""; | 170 | if (user.isNull()) user = ""; |
170 | password = conf->readEntryCrypt( "Password","" ); | 171 | password = conf->readEntryCrypt( "Password","" ); |
171 | if (password.isNull()) password = ""; | 172 | if (password.isNull()) password = ""; |
172 | prefix = conf->readEntry("MailPrefix",""); | 173 | prefix = conf->readEntry("MailPrefix",""); |
173 | if (prefix.isNull()) prefix = ""; | 174 | if (prefix.isNull()) prefix = ""; |
174 | offline = conf->readBoolEntry("Offline",false); | 175 | offline = conf->readBoolEntry("Offline",false); |
175 | delete conf; | 176 | delete conf; |
176 | } | 177 | } |
177 | 178 | ||
178 | void IMAPaccount::save() | 179 | void IMAPaccount::save() |
179 | { | 180 | { |
180 | qDebug( "saving " + getFileName() ); | 181 | qDebug( "saving " + getFileName() ); |
181 | Settings::checkDirectory(); | 182 | Settings::checkDirectory(); |
182 | 183 | ||
183 | Config *conf = new Config( getFileName(), Config::File ); | 184 | Config *conf = new Config( getFileName(), Config::File ); |
184 | conf->setGroup( "IMAP Account" ); | 185 | conf->setGroup( "IMAP Account" ); |
185 | conf->writeEntry( "Account", accountName ); | 186 | conf->writeEntry( "Account", accountName ); |
186 | conf->writeEntry( "Server", server ); | 187 | conf->writeEntry( "Server", server ); |
187 | conf->writeEntry( "Port", port ); | 188 | conf->writeEntry( "Port", port ); |
188 | conf->writeEntry( "SSL", ssl ); | 189 | conf->writeEntry( "SSL", ssl ); |
190 | conf->writeEntry( "ConnectionType", connectionType ); | ||
189 | conf->writeEntry( "User", user ); | 191 | conf->writeEntry( "User", user ); |
190 | conf->writeEntryCrypt( "Password", password ); | 192 | conf->writeEntryCrypt( "Password", password ); |
191 | conf->writeEntry( "MailPrefix",prefix); | 193 | conf->writeEntry( "MailPrefix",prefix); |
192 | conf->writeEntry( "Offline",offline); | 194 | conf->writeEntry( "Offline",offline); |
193 | conf->write(); | 195 | conf->write(); |
194 | delete conf; | 196 | delete conf; |
195 | } | 197 | } |
196 | 198 | ||
197 | 199 | ||
198 | QString IMAPaccount::getFileName() | 200 | QString IMAPaccount::getFileName() |
199 | { | 201 | { |
200 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/imap-" + file; | 202 | return (QString) getenv( "HOME" ) + "/Applications/opiemail/imap-" + file; |