author | alwin <alwin> | 2004-03-02 12:21:11 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-02 12:21:11 (UTC) |
commit | b6b1c97559c0ed9f2e33632272426bf98f289232 (patch) (unidiff) | |
tree | d3a9987704770cdf5eb14e1136f6e3ecb2f36a04 /noncore/unsupported/mail2/libmail | |
parent | 0d59c780513da78033f4d9040475dee9db0256d4 (diff) | |
download | opie-b6b1c97559c0ed9f2e33632272426bf98f289232.zip opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.gz opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.bz2 |
applied the patch generated by the optimize_connect script from
TT.
Diffstat (limited to 'noncore/unsupported/mail2/libmail') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/mail2/libmail/imaphandler.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/unsupported/mail2/libmail/imaphandler.cpp b/noncore/unsupported/mail2/libmail/imaphandler.cpp index dc97b28..8da0acd 100644 --- a/noncore/unsupported/mail2/libmail/imaphandler.cpp +++ b/noncore/unsupported/mail2/libmail/imaphandler.cpp | |||
@@ -1,38 +1,38 @@ | |||
1 | #include "imapresponse.h" | 1 | #include "imapresponse.h" |
2 | #include "imaphandler.h" | 2 | #include "imaphandler.h" |
3 | #include "imapbase.h" | 3 | #include "imapbase.h" |
4 | 4 | ||
5 | IMAPHandler::IMAPHandler(const Account &account) | 5 | IMAPHandler::IMAPHandler(const Account &account) |
6 | : QObject(), _account(account) | 6 | : QObject(), _account(account) |
7 | { | 7 | { |
8 | _ready = false; | 8 | _ready = false; |
9 | _loggingin = false; | 9 | _loggingin = false; |
10 | _loggedin = false; | 10 | _loggedin = false; |
11 | _tag = 0; | 11 | _tag = 0; |
12 | _ibase = new IMAPBase(account); | 12 | _ibase = new IMAPBase(account); |
13 | 13 | ||
14 | connect(_ibase, SIGNAL(dataReceived(const QString &)), SLOT(slotDataReceived(const QString &))); | 14 | connect(_ibase, SIGNAL(dataReceived(const QString&)), SLOT(slotDataReceived(const QString&))); |
15 | connect(_ibase, SIGNAL(lookingUpHost()), SLOT(slotLookingUpHost())); | 15 | connect(_ibase, SIGNAL(lookingUpHost()), SLOT(slotLookingUpHost())); |
16 | connect(_ibase, SIGNAL(hostFound()), SLOT(slotHostFound())); | 16 | connect(_ibase, SIGNAL(hostFound()), SLOT(slotHostFound())); |
17 | connect(_ibase, SIGNAL(connected()), SLOT(slotConnected())); | 17 | connect(_ibase, SIGNAL(connected()), SLOT(slotConnected())); |
18 | connect(_ibase, SIGNAL(disconnected()), SLOT(slotDisconnected())); | 18 | connect(_ibase, SIGNAL(disconnected()), SLOT(slotDisconnected())); |
19 | connect(_ibase, SIGNAL(error(int)), SLOT(slotError(int))); | 19 | connect(_ibase, SIGNAL(error(int)), SLOT(slotError(int))); |
20 | } | 20 | } |
21 | 21 | ||
22 | void IMAPHandler::doLogin() | 22 | void IMAPHandler::doLogin() |
23 | { | 23 | { |
24 | if (_loggedin) return; | 24 | if (_loggedin) return; |
25 | if (_loggingin) return; | 25 | if (_loggingin) return; |
26 | 26 | ||
27 | _loggingin = true; | 27 | _loggingin = true; |
28 | iLogin(_account.user(), _account.pass()); | 28 | iLogin(_account.user(), _account.pass()); |
29 | } | 29 | } |
30 | 30 | ||
31 | QString IMAPHandler::iCapability() | 31 | QString IMAPHandler::iCapability() |
32 | { | 32 | { |
33 | _ibase->sendCommand(QString("%1 CAPABILITY\r\n") | 33 | _ibase->sendCommand(QString("%1 CAPABILITY\r\n") |
34 | .arg(tag())); | 34 | .arg(tag())); |
35 | return tag(false); | 35 | return tag(false); |
36 | } | 36 | } |
37 | 37 | ||
38 | QString IMAPHandler::iNoop() | 38 | QString IMAPHandler::iNoop() |
@@ -278,52 +278,52 @@ QString IMAPHandler::iX(const QString &commandAtom, const QString &arguments) | |||
278 | } | 278 | } |
279 | 279 | ||
280 | QString IMAPHandler::escape(const QString &in) | 280 | QString IMAPHandler::escape(const QString &in) |
281 | { | 281 | { |
282 | QString in_ = in; | 282 | QString in_ = in; |
283 | return in_.replace(QRegExp("\""), "\\\""); | 283 | return in_.replace(QRegExp("\""), "\\\""); |
284 | } | 284 | } |
285 | 285 | ||
286 | QString IMAPHandler::tag(bool count) | 286 | QString IMAPHandler::tag(bool count) |
287 | { | 287 | { |
288 | return QString("a%1").arg(count ? _tag++ : _tag); | 288 | return QString("a%1").arg(count ? _tag++ : _tag); |
289 | } | 289 | } |
290 | 290 | ||
291 | void IMAPHandler::slotDataReceived(const QString &data) | 291 | void IMAPHandler::slotDataReceived(const QString &data) |
292 | { | 292 | { |
293 | if (!_ready) { | 293 | if (!_ready) { |
294 | // The first data is always the greeting string. | 294 | // The first data is always the greeting string. |
295 | // We can ignore it. | 295 | // We can ignore it. |
296 | _ready = true; | 296 | _ready = true; |
297 | return; | 297 | return; |
298 | } | 298 | } |
299 | 299 | ||
300 | 300 | ||
301 | IMAPResponseParser parser; | 301 | IMAPResponseParser parser; |
302 | //connect ( &parser, SIGNAL( needMoreData ( QString & )), _ibase, SLOT( tryRead ( QString & ))); | 302 | //connect ( &parser, SIGNAL( needMoreData(QString&)), _ibase, SLOT( tryRead(QString&))); |
303 | parser. parse ( data ); | 303 | parser. parse ( data ); |
304 | IMAPResponse response = parser.response(); | 304 | IMAPResponse response = parser.response(); |
305 | //disconnect ( &parser, SIGNAL( needMoreData ( QString & )), _ibase, SLOT( tryRead ( QString & ))); | 305 | //disconnect ( &parser, SIGNAL( needMoreData(QString&)), _ibase, SLOT( tryRead(QString&))); |
306 | response.setImapHandler(this); | 306 | response.setImapHandler(this); |
307 | 307 | ||
308 | if (!_loggingin) { qDebug("Emitting gotResponse!\n" ); emit gotResponse(response); } | 308 | if (!_loggingin) { qDebug("Emitting gotResponse!\n" ); emit gotResponse(response); } |
309 | else { | 309 | else { |
310 | if (response.statusResponse().status() == IMAPResponseEnums::OK) { | 310 | if (response.statusResponse().status() == IMAPResponseEnums::OK) { |
311 | _loggingin = false; | 311 | _loggingin = false; |
312 | _loggedin = true; | 312 | _loggedin = true; |
313 | qWarning("OK. Logged in. Leaving loggingin state."); | 313 | qWarning("OK. Logged in. Leaving loggingin state."); |
314 | } else { | 314 | } else { |
315 | _loggingin = false; | 315 | _loggingin = false; |
316 | emit IMAPError(IMAPBase::IMAPErrLoginFailed); | 316 | emit IMAPError(IMAPBase::IMAPErrLoginFailed); |
317 | } | 317 | } |
318 | } | 318 | } |
319 | } | 319 | } |
320 | 320 | ||
321 | void IMAPHandler::slotLookingUpHost() | 321 | void IMAPHandler::slotLookingUpHost() |
322 | { | 322 | { |
323 | emit IMAPLookingUpHost(); | 323 | emit IMAPLookingUpHost(); |
324 | } | 324 | } |
325 | 325 | ||
326 | void IMAPHandler::slotHostFound() | 326 | void IMAPHandler::slotHostFound() |
327 | { | 327 | { |
328 | emit IMAPHostFound(); | 328 | emit IMAPHostFound(); |
329 | } | 329 | } |