author | conber <conber> | 2002-06-15 18:26:36 (UTC) |
---|---|---|
committer | conber <conber> | 2002-06-15 18:26:36 (UTC) |
commit | f797160d879c74652b27bca3df8a74243465d65c (patch) (unidiff) | |
tree | eb6a376174ba1e532127d099df6a02d201e2e34f | |
parent | ff47b17768607d8819ef5cd3316a1cab0abdcf3a (diff) | |
download | opie-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.
-rw-r--r-- | noncore/unsupported/mail2/libmail/imaphandler.cpp | 9 | ||||
-rw-r--r-- | noncore/unsupported/mail2/libmail/imaphandler.h | 2 |
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,135 +1,136 @@ | |||
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 | _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 | } |
20 | 21 | ||
21 | void IMAPHandler::doLogin() | 22 | void IMAPHandler::doLogin() |
22 | { | 23 | { |
23 | if (_loggedin) return; | 24 | if (_loggedin) return; |
24 | if (_loggingin) return; | 25 | if (_loggingin) return; |
25 | 26 | ||
26 | _loggingin = true; | 27 | _loggingin = true; |
27 | iLogin(_account.user(), _account.pass()); | 28 | iLogin(_account.user(), _account.pass()); |
28 | } | 29 | } |
29 | 30 | ||
30 | QString IMAPHandler::iCapability() | 31 | QString IMAPHandler::iCapability() |
31 | { | 32 | { |
32 | _ibase->sendCommand(QString("%1 CAPABILITY\r\n") | 33 | _ibase->sendCommand(QString("%1 CAPABILITY\r\n") |
33 | .arg(tag())); | 34 | .arg(tag())); |
34 | return tag(false); | 35 | return tag(false); |
35 | } | 36 | } |
36 | 37 | ||
37 | QString IMAPHandler::iNoop() | 38 | QString IMAPHandler::iNoop() |
38 | { | 39 | { |
39 | _ibase->sendCommand(QString("%1 NOOP\r\n") | 40 | _ibase->sendCommand(QString("%1 NOOP\r\n") |
40 | .arg(tag())); | 41 | .arg(tag())); |
41 | return tag(false); | 42 | return tag(false); |
42 | } | 43 | } |
43 | 44 | ||
44 | QString IMAPHandler::iLogout() | 45 | QString IMAPHandler::iLogout() |
45 | { | 46 | { |
46 | _ibase->sendCommand(QString("%1 LOGOUT\r\n") | 47 | _ibase->sendCommand(QString("%1 LOGOUT\r\n") |
47 | .arg(tag())); | 48 | .arg(tag())); |
48 | return tag(false); | 49 | return tag(false); |
49 | } | 50 | } |
50 | 51 | ||
51 | QString IMAPHandler::iAuthenticate(const QString &mechanism) | 52 | QString IMAPHandler::iAuthenticate(const QString &mechanism) |
52 | { | 53 | { |
53 | _ibase->sendCommand(QString("%1 AUTHENTICATE \"%2\"\r\n") | 54 | _ibase->sendCommand(QString("%1 AUTHENTICATE \"%2\"\r\n") |
54 | .arg(tag()) | 55 | .arg(tag()) |
55 | .arg(escape(mechanism))); | 56 | .arg(escape(mechanism))); |
56 | return tag(false); | 57 | return tag(false); |
57 | } | 58 | } |
58 | 59 | ||
59 | QString IMAPHandler::iLogin(const QString &user, const QString &pass) | 60 | QString IMAPHandler::iLogin(const QString &user, const QString &pass) |
60 | { | 61 | { |
61 | _ibase->sendCommand(QString("%1 LOGIN \"%2\" \"%3\"\r\n") | 62 | _ibase->sendCommand(QString("%1 LOGIN \"%2\" \"%3\"\r\n") |
62 | .arg(tag()) | 63 | .arg(tag()) |
63 | .arg(escape(user)) | 64 | .arg(escape(user)) |
64 | .arg(escape(pass))); | 65 | .arg(escape(pass))); |
65 | return tag(false); | 66 | return tag(false); |
66 | } | 67 | } |
67 | 68 | ||
68 | QString IMAPHandler::iSelect(const QString &mailbox) | 69 | QString IMAPHandler::iSelect(const QString &mailbox) |
69 | { | 70 | { |
70 | doLogin(); | 71 | doLogin(); |
71 | 72 | ||
72 | _ibase->sendCommand(QString("%1 SELECT \"%2\"\r\n") | 73 | _ibase->sendCommand(QString("%1 SELECT \"%2\"\r\n") |
73 | .arg(tag()) | 74 | .arg(tag()) |
74 | .arg(escape(mailbox))); | 75 | .arg(escape(mailbox))); |
75 | return tag(false); | 76 | return tag(false); |
76 | } | 77 | } |
77 | 78 | ||
78 | QString IMAPHandler::iExamine(const QString &mailbox) | 79 | QString IMAPHandler::iExamine(const QString &mailbox) |
79 | { | 80 | { |
80 | doLogin(); | 81 | doLogin(); |
81 | 82 | ||
82 | _ibase->sendCommand(QString("%1 EXAMINE \"%2\"\r\n") | 83 | _ibase->sendCommand(QString("%1 EXAMINE \"%2\"\r\n") |
83 | .arg(tag()) | 84 | .arg(tag()) |
84 | .arg(escape(mailbox))); | 85 | .arg(escape(mailbox))); |
85 | return tag(false); | 86 | return tag(false); |
86 | } | 87 | } |
87 | 88 | ||
88 | QString IMAPHandler::iCreate(const QString &mailbox) | 89 | QString IMAPHandler::iCreate(const QString &mailbox) |
89 | { | 90 | { |
90 | doLogin(); | 91 | doLogin(); |
91 | 92 | ||
92 | _ibase->sendCommand(QString("%1 CREATE \"%2\"\r\n") | 93 | _ibase->sendCommand(QString("%1 CREATE \"%2\"\r\n") |
93 | .arg(tag()) | 94 | .arg(tag()) |
94 | .arg(escape(mailbox))); | 95 | .arg(escape(mailbox))); |
95 | return tag(false); | 96 | return tag(false); |
96 | } | 97 | } |
97 | 98 | ||
98 | QString IMAPHandler::iDelete(const QString &mailbox) | 99 | QString IMAPHandler::iDelete(const QString &mailbox) |
99 | { | 100 | { |
100 | doLogin(); | 101 | doLogin(); |
101 | 102 | ||
102 | _ibase->sendCommand(QString("%1 DELETE \"%2\"\r\n") | 103 | _ibase->sendCommand(QString("%1 DELETE \"%2\"\r\n") |
103 | .arg(tag()) | 104 | .arg(tag()) |
104 | .arg(escape(mailbox))); | 105 | .arg(escape(mailbox))); |
105 | return tag(false); | 106 | return tag(false); |
106 | } | 107 | } |
107 | 108 | ||
108 | QString IMAPHandler::iRename(const QString &mailbox, const QString &newMailbox) | 109 | QString IMAPHandler::iRename(const QString &mailbox, const QString &newMailbox) |
109 | { | 110 | { |
110 | doLogin(); | 111 | doLogin(); |
111 | 112 | ||
112 | _ibase->sendCommand(QString("%1 RENAME \"%2\" \"%3\"\r\n") | 113 | _ibase->sendCommand(QString("%1 RENAME \"%2\" \"%3\"\r\n") |
113 | .arg(tag()) | 114 | .arg(tag()) |
114 | .arg(escape(mailbox)) | 115 | .arg(escape(mailbox)) |
115 | .arg(escape(newMailbox))); | 116 | .arg(escape(newMailbox))); |
116 | return tag(false); | 117 | return tag(false); |
117 | } | 118 | } |
118 | 119 | ||
119 | QString IMAPHandler::iSubscribe(const QString &mailbox) | 120 | QString IMAPHandler::iSubscribe(const QString &mailbox) |
120 | { | 121 | { |
121 | doLogin(); | 122 | doLogin(); |
122 | 123 | ||
123 | _ibase->sendCommand(QString("%1 SUBSCRIBE \"%2\"\r\n") | 124 | _ibase->sendCommand(QString("%1 SUBSCRIBE \"%2\"\r\n") |
124 | .arg(tag()) | 125 | .arg(tag()) |
125 | .arg(escape(mailbox))); | 126 | .arg(escape(mailbox))); |
126 | return tag(false); | 127 | return tag(false); |
127 | } | 128 | } |
128 | 129 | ||
129 | QString IMAPHandler::iUnsubscribe(const QString &mailbox) | 130 | QString IMAPHandler::iUnsubscribe(const QString &mailbox) |
130 | { | 131 | { |
131 | doLogin(); | 132 | doLogin(); |
132 | 133 | ||
133 | _ibase->sendCommand(QString("%1 UNSUBSCRIBE \"%2\"\r\n") | 134 | _ibase->sendCommand(QString("%1 UNSUBSCRIBE \"%2\"\r\n") |
134 | .arg(tag()) | 135 | .arg(tag()) |
135 | .arg(escape(mailbox))); | 136 | .arg(escape(mailbox))); |
@@ -164,171 +165,179 @@ QString IMAPHandler::iStatus(const QString &mailbox, const QString &items) | |||
164 | 165 | ||
165 | _ibase->sendCommand(QString("%1 STATUS \"%2\" (%3)\r\n") | 166 | _ibase->sendCommand(QString("%1 STATUS \"%2\" (%3)\r\n") |
166 | .arg(tag()) | 167 | .arg(tag()) |
167 | .arg(escape(mailbox)) | 168 | .arg(escape(mailbox)) |
168 | .arg(escape(items))); | 169 | .arg(escape(items))); |
169 | return tag(false); | 170 | return tag(false); |
170 | } | 171 | } |
171 | 172 | ||
172 | QString IMAPHandler::iAppend(const QString &mailbox, const QString &literal, const QString &flags, const QString &datetime = 0) | 173 | QString IMAPHandler::iAppend(const QString &mailbox, const QString &literal, const QString &flags, const QString &datetime = 0) |
173 | { | 174 | { |
174 | doLogin(); | 175 | doLogin(); |
175 | 176 | ||
176 | _ibase->sendCommand(QString("%1 APPEND \"%2\" (%3) \"%4\" {%5}\r\n%6\r\n") | 177 | _ibase->sendCommand(QString("%1 APPEND \"%2\" (%3) \"%4\" {%5}\r\n%6\r\n") |
177 | .arg(tag()) | 178 | .arg(tag()) |
178 | .arg(escape(mailbox)) | 179 | .arg(escape(mailbox)) |
179 | .arg(flags) | 180 | .arg(flags) |
180 | .arg(escape(datetime)) | 181 | .arg(escape(datetime)) |
181 | .arg(literal.length()) | 182 | .arg(literal.length()) |
182 | .arg(literal)); | 183 | .arg(literal)); |
183 | return tag(false); | 184 | return tag(false); |
184 | } | 185 | } |
185 | 186 | ||
186 | QString IMAPHandler::iCheck() | 187 | QString IMAPHandler::iCheck() |
187 | { | 188 | { |
188 | doLogin(); | 189 | doLogin(); |
189 | 190 | ||
190 | _ibase->sendCommand(QString("%1 CHECK\r\n") | 191 | _ibase->sendCommand(QString("%1 CHECK\r\n") |
191 | .arg(tag())); | 192 | .arg(tag())); |
192 | return tag(false); | 193 | return tag(false); |
193 | } | 194 | } |
194 | 195 | ||
195 | QString IMAPHandler::iClose() | 196 | QString IMAPHandler::iClose() |
196 | { | 197 | { |
197 | doLogin(); | 198 | doLogin(); |
198 | 199 | ||
199 | _ibase->sendCommand(QString("%1 CLOSE\r\n") | 200 | _ibase->sendCommand(QString("%1 CLOSE\r\n") |
200 | .arg(tag())); | 201 | .arg(tag())); |
201 | return tag(false); | 202 | return tag(false); |
202 | } | 203 | } |
203 | 204 | ||
204 | QString IMAPHandler::iExpunge() | 205 | QString IMAPHandler::iExpunge() |
205 | { | 206 | { |
206 | doLogin(); | 207 | doLogin(); |
207 | 208 | ||
208 | _ibase->sendCommand(QString("%1 EXPUNGE\r\n") | 209 | _ibase->sendCommand(QString("%1 EXPUNGE\r\n") |
209 | .arg(tag())); | 210 | .arg(tag())); |
210 | return tag(false); | 211 | return tag(false); |
211 | } | 212 | } |
212 | 213 | ||
213 | QString IMAPHandler::iSearch(const QString &search, const QString &charset) | 214 | QString IMAPHandler::iSearch(const QString &search, const QString &charset) |
214 | { | 215 | { |
215 | doLogin(); | 216 | doLogin(); |
216 | 217 | ||
217 | _ibase->sendCommand(QString("%1 SEARCH %2 %3\r\n") | 218 | _ibase->sendCommand(QString("%1 SEARCH %2 %3\r\n") |
218 | .arg(tag()) | 219 | .arg(tag()) |
219 | .arg(charset.isEmpty() ? QString(0) : escape(charset)) | 220 | .arg(charset.isEmpty() ? QString(0) : escape(charset)) |
220 | .arg(search)); | 221 | .arg(search)); |
221 | return tag(false); | 222 | return tag(false); |
222 | } | 223 | } |
223 | 224 | ||
224 | QString IMAPHandler::iFetch(const QString &message, const QString &items) | 225 | QString IMAPHandler::iFetch(const QString &message, const QString &items) |
225 | { | 226 | { |
226 | doLogin(); | 227 | doLogin(); |
227 | 228 | ||
228 | _ibase->sendCommand(QString("%1 FETCH %2 (%3)\r\n") | 229 | _ibase->sendCommand(QString("%1 FETCH %2 (%3)\r\n") |
229 | .arg(tag()) | 230 | .arg(tag()) |
230 | .arg(message) | 231 | .arg(message) |
231 | .arg(items)); | 232 | .arg(items)); |
232 | return tag(false); | 233 | return tag(false); |
233 | } | 234 | } |
234 | 235 | ||
235 | QString IMAPHandler::iStore(const QString &message, const QString &items) | 236 | QString IMAPHandler::iStore(const QString &message, const QString &items) |
236 | { | 237 | { |
237 | doLogin(); | 238 | doLogin(); |
238 | 239 | ||
239 | _ibase->sendCommand(QString("%1 STORE %2 %3\r\n") | 240 | _ibase->sendCommand(QString("%1 STORE %2 %3\r\n") |
240 | .arg(tag()) | 241 | .arg(tag()) |
241 | .arg(message) | 242 | .arg(message) |
242 | .arg(items)); | 243 | .arg(items)); |
243 | return tag(false); | 244 | return tag(false); |
244 | } | 245 | } |
245 | 246 | ||
246 | QString IMAPHandler::iCopy(const QString &message, const QString &mailbox) | 247 | QString IMAPHandler::iCopy(const QString &message, const QString &mailbox) |
247 | { | 248 | { |
248 | doLogin(); | 249 | doLogin(); |
249 | 250 | ||
250 | _ibase->sendCommand(QString("%1 COPY %2 \"%3\"\r\n") | 251 | _ibase->sendCommand(QString("%1 COPY %2 \"%3\"\r\n") |
251 | .arg(tag()) | 252 | .arg(tag()) |
252 | .arg(message) | 253 | .arg(message) |
253 | .arg(escape(mailbox))); | 254 | .arg(escape(mailbox))); |
254 | return tag(false); | 255 | return tag(false); |
255 | } | 256 | } |
256 | 257 | ||
257 | QString IMAPHandler::iUid(const QString &command, const QString &arguments) | 258 | QString IMAPHandler::iUid(const QString &command, const QString &arguments) |
258 | { | 259 | { |
259 | doLogin(); | 260 | doLogin(); |
260 | 261 | ||
261 | _ibase->sendCommand(QString("%1 UID %2 %3\r\n") | 262 | _ibase->sendCommand(QString("%1 UID %2 %3\r\n") |
262 | .arg(tag()) | 263 | .arg(tag()) |
263 | .arg(command) | 264 | .arg(command) |
264 | .arg(arguments)); | 265 | .arg(arguments)); |
265 | return tag(false); | 266 | return tag(false); |
266 | } | 267 | } |
267 | 268 | ||
268 | QString IMAPHandler::iX(const QString &commandAtom, const QString &arguments) | 269 | QString IMAPHandler::iX(const QString &commandAtom, const QString &arguments) |
269 | { | 270 | { |
270 | doLogin(); | 271 | doLogin(); |
271 | 272 | ||
272 | _ibase->sendCommand(QString("%1 X%2 %3\r\n") | 273 | _ibase->sendCommand(QString("%1 X%2 %3\r\n") |
273 | .arg(tag()) | 274 | .arg(tag()) |
274 | .arg(commandAtom) | 275 | .arg(commandAtom) |
275 | .arg(arguments)); | 276 | .arg(arguments)); |
276 | return tag(false); | 277 | return tag(false); |
277 | } | 278 | } |
278 | 279 | ||
279 | QString IMAPHandler::escape(const QString &in) | 280 | 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 | ||
285 | QString IMAPHandler::tag(bool count) | 286 | QString 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 | ||
290 | void IMAPHandler::slotDataReceived(const QString &data) | 291 | void 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; |
304 | emit IMAPError(IMAPBase::IMAPErrLoginFailed); | 313 | emit IMAPError(IMAPBase::IMAPErrLoginFailed); |
305 | } | 314 | } |
306 | } | 315 | } |
307 | } | 316 | } |
308 | 317 | ||
309 | void IMAPHandler::slotLookingUpHost() | 318 | void IMAPHandler::slotLookingUpHost() |
310 | { | 319 | { |
311 | emit IMAPLookingUpHost(); | 320 | emit IMAPLookingUpHost(); |
312 | } | 321 | } |
313 | 322 | ||
314 | void IMAPHandler::slotHostFound() | 323 | void IMAPHandler::slotHostFound() |
315 | { | 324 | { |
316 | emit IMAPHostFound(); | 325 | emit IMAPHostFound(); |
317 | } | 326 | } |
318 | 327 | ||
319 | void IMAPHandler::slotConnected() | 328 | void IMAPHandler::slotConnected() |
320 | { | 329 | { |
321 | emit IMAPConnected(); | 330 | emit IMAPConnected(); |
322 | } | 331 | } |
323 | 332 | ||
324 | void IMAPHandler::slotDisconnected() | 333 | void IMAPHandler::slotDisconnected() |
325 | { | 334 | { |
326 | _loggedin = false; | 335 | _loggedin = false; |
327 | emit IMAPDisconnected(); | 336 | emit IMAPDisconnected(); |
328 | } | 337 | } |
329 | 338 | ||
330 | void IMAPHandler::slotError(int err) | 339 | void IMAPHandler::slotError(int err) |
331 | { | 340 | { |
332 | emit IMAPError(err); | 341 | emit IMAPError(err); |
333 | } | 342 | } |
334 | 343 | ||
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 | |||
@@ -1,86 +1,86 @@ | |||
1 | #ifndef IMAPHANDLER_H | 1 | #ifndef IMAPHANDLER_H |
2 | #define IMAPHANDLER_H | 2 | #define IMAPHANDLER_H |
3 | 3 | ||
4 | #include <qobject.h> | 4 | #include <qobject.h> |
5 | 5 | ||
6 | #include "configfile.h" | 6 | #include "configfile.h" |
7 | 7 | ||
8 | class IMAPBase; | 8 | class IMAPBase; |
9 | class IMAPResponse; | 9 | class IMAPResponse; |
10 | 10 | ||
11 | class IMAPHandler : public QObject | 11 | class IMAPHandler : public QObject |
12 | { | 12 | { |
13 | Q_OBJECT | 13 | Q_OBJECT |
14 | 14 | ||
15 | public: | 15 | public: |
16 | IMAPHandler(const Account &account); | 16 | IMAPHandler(const Account &account); |
17 | 17 | ||
18 | QString iCapability(); | 18 | QString iCapability(); |
19 | QString iNoop(); | 19 | QString iNoop(); |
20 | QString iLogout(); | 20 | QString iLogout(); |
21 | 21 | ||
22 | QString iAuthenticate(const QString &mechanism); | 22 | QString iAuthenticate(const QString &mechanism); |
23 | QString iLogin(const QString &user, const QString &pass); | 23 | QString iLogin(const QString &user, const QString &pass); |
24 | 24 | ||
25 | QString iSelect(const QString &mailbox); | 25 | QString iSelect(const QString &mailbox); |
26 | QString iExamine(const QString &mailbox); | 26 | QString iExamine(const QString &mailbox); |
27 | QString iCreate(const QString &mailbox); | 27 | QString iCreate(const QString &mailbox); |
28 | QString iDelete(const QString &mailbox); | 28 | QString iDelete(const QString &mailbox); |
29 | QString iRename(const QString &mailbox, const QString &newMailbox); | 29 | QString iRename(const QString &mailbox, const QString &newMailbox); |
30 | 30 | ||
31 | QString iSubscribe(const QString &mailbox); | 31 | QString iSubscribe(const QString &mailbox); |
32 | QString iUnsubscribe(const QString &mailbox); | 32 | QString iUnsubscribe(const QString &mailbox); |
33 | 33 | ||
34 | QString iList(const QString &reference, const QString &mailbox); | 34 | QString iList(const QString &reference, const QString &mailbox); |
35 | QString iLsub(const QString &reference, const QString &mailbox); | 35 | QString iLsub(const QString &reference, const QString &mailbox); |
36 | 36 | ||
37 | QString iStatus(const QString &mailbox, const QString &items); | 37 | QString iStatus(const QString &mailbox, const QString &items); |
38 | 38 | ||
39 | QString iAppend(const QString &mailbox, const QString &literal, const QString &flags = 0, const QString &datetime = 0); | 39 | QString iAppend(const QString &mailbox, const QString &literal, const QString &flags = 0, const QString &datetime = 0); |
40 | 40 | ||
41 | QString iCheck(); | 41 | QString iCheck(); |
42 | QString iClose(); | 42 | QString iClose(); |
43 | QString iExpunge(); | 43 | QString iExpunge(); |
44 | 44 | ||
45 | QString iSearch(const QString &search, const QString &charset = 0); | 45 | QString iSearch(const QString &search, const QString &charset = 0); |
46 | 46 | ||
47 | QString iFetch(const QString &message, const QString &items); | 47 | QString iFetch(const QString &message, const QString &items); |
48 | 48 | ||
49 | QString iStore(const QString &message, const QString &items); | 49 | QString iStore(const QString &message, const QString &items); |
50 | QString iCopy(const QString &message, const QString &mailbox); | 50 | QString iCopy(const QString &message, const QString &mailbox); |
51 | 51 | ||
52 | QString iUid(const QString &command, const QString &arguments); | 52 | QString iUid(const QString &command, const QString &arguments); |
53 | 53 | ||
54 | QString iX(const QString &commandAtom, const QString &arguments); | 54 | QString iX(const QString &commandAtom, const QString &arguments); |
55 | 55 | ||
56 | signals: | 56 | signals: |
57 | void gotResponse(IMAPResponse &response); | 57 | void gotResponse(IMAPResponse &response); |
58 | 58 | ||
59 | void IMAPLookingUpHost(); | 59 | void IMAPLookingUpHost(); |
60 | void IMAPHostFound(); | 60 | void IMAPHostFound(); |
61 | void IMAPConnected(); | 61 | void IMAPConnected(); |
62 | void IMAPDisconnected(); | 62 | void IMAPDisconnected(); |
63 | void IMAPError(int err); | 63 | void IMAPError(int err); |
64 | 64 | ||
65 | protected: | 65 | protected: |
66 | void doLogin(); | 66 | void doLogin(); |
67 | QString escape(const QString &in); | 67 | QString escape(const QString &in); |
68 | QString tag(bool count = true); | 68 | QString tag(bool count = true); |
69 | 69 | ||
70 | protected slots: | 70 | protected 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 | ||
78 | private: | 78 | private: |
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 |