author | groucho <groucho> | 2003-04-28 08:31:24 (UTC) |
---|---|---|
committer | groucho <groucho> | 2003-04-28 08:31:24 (UTC) |
commit | 63d3f7ca039d93612abaa4a65fc00b337c42ec9d (patch) (unidiff) | |
tree | ea4a08e00d5a229f20c3e4150f707a2ac8f9e882 /noncore/unsupported/mailit/popclient.cpp | |
parent | c3b703405fe77fbe16596ebd7d814a6e463f9243 (diff) | |
download | opie-63d3f7ca039d93612abaa4a65fc00b337c42ec9d.zip opie-63d3f7ca039d93612abaa4a65fc00b337c42ec9d.tar.gz opie-63d3f7ca039d93612abaa4a65fc00b337c42ec9d.tar.bz2 |
- bug fixes in the parser (from header)
- bug fixes in address selector (uses cc: now)
- remove now selects next item afterwards (speeds up mass deletion)
- smaller fixes
Diffstat (limited to 'noncore/unsupported/mailit/popclient.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/mailit/popclient.cpp | 80 |
1 files changed, 19 insertions, 61 deletions
diff --git a/noncore/unsupported/mailit/popclient.cpp b/noncore/unsupported/mailit/popclient.cpp index 67306be..6105d09 100644 --- a/noncore/unsupported/mailit/popclient.cpp +++ b/noncore/unsupported/mailit/popclient.cpp | |||
@@ -60,7 +60,7 @@ void PopClient::newConnection(QString target, int port) | |||
60 | 60 | ||
61 | socket->connectToHost(target, port); | 61 | socket->connectToHost(target, port); |
62 | receiving = TRUE; | 62 | receiving = TRUE; |
63 | selected = FALSE; | 63 | //selected = FALSE; |
64 | 64 | ||
65 | emit updateStatus("DNS lookup"); | 65 | emit updateStatus("DNS lookup"); |
66 | } | 66 | } |
@@ -184,13 +184,14 @@ void PopClient::incomingData() | |||
184 | messageCount = 1; | 184 | messageCount = 1; |
185 | } | 185 | } |
186 | 186 | ||
187 | if (selected) { | 187 | if (selected) { |
188 | int *ptr = mailList->first(); | 188 | int *ptr = mailList->first(); |
189 | if (ptr != 0) { | 189 | if (ptr != 0) { |
190 | newMessages++; //to ensure no early jumpout | 190 | newMessages++; //to ensure no early jumpout |
191 | messageCount = *(mailList->first()); | 191 | messageCount = *ptr; |
192 | } else newMessages = 0; | 192 | } else newMessages = 0; |
193 | } | 193 | } |
194 | |||
194 | } else errorHandling(ErrUnknownResponse); | 195 | } else errorHandling(ErrUnknownResponse); |
195 | } | 196 | } |
196 | //Read message number x, count upwards to messageCount | 197 | //Read message number x, count upwards to messageCount |
@@ -204,12 +205,12 @@ void PopClient::incomingData() | |||
204 | emit updateStatus(tr("Retrieving ") + temp + "/" + temp2); | 205 | emit updateStatus(tr("Retrieving ") + temp + "/" + temp2); |
205 | } else { | 206 | } else { |
206 | //completing a previously closed transfer | 207 | //completing a previously closed transfer |
207 | if ( (messageCount - lastSync) <= 0) { | 208 | /* if ( (messageCount - lastSync) <= 0) { |
208 | temp.setNum(messageCount); | 209 | temp.setNum(messageCount); |
209 | emit updateStatus(tr("Previous message ") + temp); | 210 | emit updateStatus(tr("Previous message ") + temp); |
210 | } else { | 211 | } else {*/ |
211 | emit updateStatus(tr("Completing message ") + temp); | 212 | emit updateStatus(tr("Completing message ") + temp); |
212 | } | 213 | //} |
213 | } | 214 | } |
214 | break; | 215 | break; |
215 | } else { | 216 | } else { |
@@ -237,7 +238,7 @@ void PopClient::incomingData() | |||
237 | //Read message number x, count upwards to messageCount | 238 | //Read message number x, count upwards to messageCount |
238 | case Retr: { | 239 | case Retr: { |
239 | if (status != Quit) { | 240 | if (status != Quit) { |
240 | if (mailSize <= headerLimit) | 241 | if ((selected)||(mailSize <= headerLimit)) |
241 | { | 242 | { |
242 | *stream << "RETR " << messageCount << "\r\n"; | 243 | *stream << "RETR " << messageCount << "\r\n"; |
243 | } else { //only header | 244 | } else { //only header |
@@ -272,37 +273,24 @@ void PopClient::incomingData() | |||
272 | if (x == -1) { | 273 | if (x == -1) { |
273 | break; | 274 | break; |
274 | } else { //message reach entire size | 275 | } else { //message reach entire size |
275 | //complete mail downloaded | 276 | |
276 | //if ( (!preview ) || ((preview) && (mailSize <= headerLimit)) ){ | 277 | if ( (selected)||(mailSize <= headerLimit)) //mail size limit is not used if late download is active |
277 | if ( mailSize <= headerLimit) | ||
278 | { | 278 | { |
279 | emit newMessage(message, messageCount-1, mailSize, TRUE); | 279 | emit newMessage(message, messageCount-1, mailSize, TRUE); |
280 | } else { //incomplete mail downloaded | 280 | } else { //incomplete mail downloaded |
281 | emit newMessage(message, messageCount-1, mailSize, FALSE); | 281 | emit newMessage(message, messageCount-1, mailSize, FALSE); |
282 | } | 282 | } |
283 | if (messageCount > newMessages) //that was the last message | 283 | |
284 | if ((messageCount > newMessages)||(selected)) //last message ? | ||
285 | { | ||
284 | status = Quit; | 286 | status = Quit; |
285 | else { //ask for new message | ||
286 | if (selected) { //grab next from queue | 287 | if (selected) { //grab next from queue |
287 | int *ptr = mailList->next(); | ||
288 | if (ptr != 0) { | ||
289 | messageCount = *ptr; | ||
290 | *stream << "LIST " << messageCount << "\r\n"; | ||
291 | status = Size; | ||
292 | //completing a previously closed transfer | ||
293 | if ( (messageCount - lastSync) <= 0) { | ||
294 | temp.setNum(messageCount); | ||
295 | emit updateStatus(tr("Previous message ") + temp); | ||
296 | } else { | ||
297 | temp.setNum(messageCount - lastSync); | ||
298 | emit updateStatus(tr("Completing message ") + temp); | ||
299 | } | ||
300 | break; | ||
301 | } else { | ||
302 | newMessages--; | 288 | newMessages--; |
303 | status = Quit; | 289 | status = Quit; |
304 | } | 290 | } |
305 | } else { | 291 | } |
292 | else | ||
293 | { | ||
306 | *stream << "LIST " << messageCount << "\r\n"; | 294 | *stream << "LIST " << messageCount << "\r\n"; |
307 | status = Size; | 295 | status = Size; |
308 | temp2.setNum(newMessages - lastSync); | 296 | temp2.setNum(newMessages - lastSync); |
@@ -310,12 +298,11 @@ void PopClient::incomingData() | |||
310 | emit updateStatus(tr("Retrieving ") + temp + "/" + temp2); | 298 | emit updateStatus(tr("Retrieving ") + temp + "/" + temp2); |
311 | 299 | ||
312 | break; | 300 | break; |
313 | } | 301 | } |
314 | } | 302 | } |
315 | } | 303 | } |
316 | if (status != Quit) | 304 | if (status != Quit) |
317 | break; | 305 | break; |
318 | } | ||
319 | } | 306 | } |
320 | case Quit: { | 307 | case Quit: { |
321 | *stream << "Quit\r\n"; | 308 | *stream << "Quit\r\n"; |
@@ -336,32 +323,3 @@ void PopClient::incomingData() | |||
336 | } | 323 | } |
337 | 324 | ||
338 | } | 325 | } |
339 | |||
340 | // if( bAPOPAuthentication ) | ||
341 | // { | ||
342 | // if( m_strTimeStamp.IsEmpty() ) | ||
343 | // { | ||
344 | // SetLastError("Apop error!"); | ||
345 | // return false; | ||
346 | // } | ||
347 | // strMD5Source = m_strTimeStamp+pszPassword; | ||
348 | // strMD5Dst = MD5_GetMD5( (BYTE*)(const char*)strMD5Source , strMD5Source.GetLength() ); | ||
349 | // sprintf(msg , "apop %s %s\r\n" , pszUser , strMD5Dst); | ||
350 | // ret = send(m_sPop3Socket , msg , strlen(msg) , NULL); | ||
351 | // if(ret == SOCKET_ERROR) | ||
352 | // { | ||
353 | // SetLastError("Socket error!"); | ||
354 | // m_bSocketOK = false; | ||
355 | // m_bConnected = false; | ||
356 | // return false; | ||
357 | // } | ||
358 | // if( !GetSocketResult(&strResult , COMMAND_END_FLAG) ) | ||
359 | // return false; | ||
360 | // if( 0 == strResult.Find('-' , 0) ) | ||
361 | // { | ||
362 | // SetLastError("Username or Password error!"); | ||
363 | // return false; | ||
364 | // } | ||
365 | // m_bConnected = true; | ||
366 | |||
367 | // } | ||