summaryrefslogtreecommitdiff
authorconber <conber>2002-06-15 18:26:36 (UTC)
committer conber <conber>2002-06-15 18:26:36 (UTC)
commitf797160d879c74652b27bca3df8a74243465d65c (patch) (unidiff)
treeeb6a376174ba1e532127d099df6a02d201e2e34f
parentff47b17768607d8819ef5cd3316a1cab0abdcf3a (diff)
downloadopie-f797160d879c74652b27bca3df8a74243465d65c.zip
opie-f797160d879c74652b27bca3df8a74243465d65c.tar.gz
opie-f797160d879c74652b27bca3df8a74243465d65c.tar.bz2
fixed bug. you should be able to browse and search in an imap account now.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/mail2/libmail/imaphandler.cpp9
-rw-r--r--noncore/unsupported/mail2/libmail/imaphandler.h2
2 files changed, 10 insertions, 1 deletions
diff --git a/noncore/unsupported/mail2/libmail/imaphandler.cpp b/noncore/unsupported/mail2/libmail/imaphandler.cpp
index 66c92c5..730a004 100644
--- a/noncore/unsupported/mail2/libmail/imaphandler.cpp
+++ b/noncore/unsupported/mail2/libmail/imaphandler.cpp
@@ -1,19 +1,20 @@
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
5IMAPHandler::IMAPHandler(const Account &account) 5IMAPHandler::IMAPHandler(const Account &account)
6 : QObject(), _account(account) 6 : QObject(), _account(account)
7{ 7{
8 _ready = false;
8 _loggingin = false; 9 _loggingin = false;
9 _loggedin = false; 10 _loggedin = false;
10 _tag = 0; 11 _tag = 0;
11 _ibase = new IMAPBase(account); 12 _ibase = new IMAPBase(account);
12 13
13 connect(_ibase, SIGNAL(dataReceived(const QString &)), SLOT(slotDataReceived(const QString &))); 14 connect(_ibase, SIGNAL(dataReceived(const QString &)), SLOT(slotDataReceived(const QString &)));
14 connect(_ibase, SIGNAL(lookingUpHost()), SLOT(slotLookingUpHost())); 15 connect(_ibase, SIGNAL(lookingUpHost()), SLOT(slotLookingUpHost()));
15 connect(_ibase, SIGNAL(hostFound()), SLOT(slotHostFound())); 16 connect(_ibase, SIGNAL(hostFound()), SLOT(slotHostFound()));
16 connect(_ibase, SIGNAL(connected()), SLOT(slotConnected())); 17 connect(_ibase, SIGNAL(connected()), SLOT(slotConnected()));
17 connect(_ibase, SIGNAL(disconnected()), SLOT(slotDisconnected())); 18 connect(_ibase, SIGNAL(disconnected()), SLOT(slotDisconnected()));
18 connect(_ibase, SIGNAL(error(int)), SLOT(slotError(int))); 19 connect(_ibase, SIGNAL(error(int)), SLOT(slotError(int)));
19} 20}
@@ -280,24 +281,32 @@ QString IMAPHandler::escape(const QString &in)
280{ 281{
281 QString in_ = in; 282 QString in_ = in;
282 return in_.replace(QRegExp("\""), "\\\""); 283 return in_.replace(QRegExp("\""), "\\\"");
283} 284}
284 285
285QString IMAPHandler::tag(bool count) 286QString IMAPHandler::tag(bool count)
286{ 287{
287 return QString("a%1").arg(count ? _tag++ : _tag); 288 return QString("a%1").arg(count ? _tag++ : _tag);
288} 289}
289 290
290void IMAPHandler::slotDataReceived(const QString &data) 291void IMAPHandler::slotDataReceived(const QString &data)
291{ 292{
293 if (!_ready) {
294 // The first data is always the greeting string.
295 // We can ignore it.
296 _ready = true;
297 return;
298 }
299
300
292 IMAPResponseParser parser(data); 301 IMAPResponseParser parser(data);
293 IMAPResponse response = parser.response(); 302 IMAPResponse response = parser.response();
294 response.setImapHandler(this); 303 response.setImapHandler(this);
295 304
296 if (!_loggingin) emit gotResponse(response); 305 if (!_loggingin) emit gotResponse(response);
297 else { 306 else {
298 if (response.statusResponse().status() == IMAPResponseEnums::OK) { 307 if (response.statusResponse().status() == IMAPResponseEnums::OK) {
299 _loggingin = false; 308 _loggingin = false;
300 _loggedin = true; 309 _loggedin = true;
301 qWarning("OK. Logged in. Leaving loggingin state."); 310 qWarning("OK. Logged in. Leaving loggingin state.");
302 } else { 311 } else {
303 _loggingin = false; 312 _loggingin = false;
diff --git a/noncore/unsupported/mail2/libmail/imaphandler.h b/noncore/unsupported/mail2/libmail/imaphandler.h
index 8cb42db..cc47a85 100644
--- a/noncore/unsupported/mail2/libmail/imaphandler.h
+++ b/noncore/unsupported/mail2/libmail/imaphandler.h
@@ -70,17 +70,17 @@ protected:
70protected slots: 70protected slots:
71 void slotDataReceived(const QString &data); 71 void slotDataReceived(const QString &data);
72 void slotLookingUpHost(); 72 void slotLookingUpHost();
73 void slotHostFound(); 73 void slotHostFound();
74 void slotConnected(); 74 void slotConnected();
75 void slotDisconnected(); 75 void slotDisconnected();
76 void slotError(int err); 76 void slotError(int err);
77 77
78private: 78private:
79 Account _account; 79 Account _account;
80 IMAPBase *_ibase; 80 IMAPBase *_ibase;
81 unsigned int _tag; 81 unsigned int _tag;
82 bool _loggingin, _loggedin; 82 bool _ready, _loggingin, _loggedin;
83 83
84}; 84};
85 85
86#endif 86#endif