MCPcopy Create free account
hub / github.com/MailCore/mailcore2 / sessionWithMinQueue

Method sessionWithMinQueue

src/async/imap/MCIMAPAsyncSession.cpp:367–389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

365}
366
367IMAPAsyncConnection * IMAPAsyncSession::sessionWithMinQueue(bool filterByFolder, String * folder)
368{
369 IMAPAsyncConnection * chosenSession = NULL;
370 unsigned int minOperationsCount = 0;
371
372 for (unsigned int i = 0 ; i < mSessions->count() ; i ++) {
373 IMAPAsyncConnection * s = (IMAPAsyncConnection *) mSessions->objectAtIndex(i);
374 if ((chosenSession == NULL) || (s->operationsCount() < minOperationsCount)) {
375 bool matched = true;
376 if (filterByFolder) {
377 // filter by last selested folder
378 matched = ((folder != NULL && s->lastFolder() != NULL && s->lastFolder()->isEqual(folder))
379 || (folder == NULL && s->lastFolder() == NULL));
380 }
381 if (matched) {
382 chosenSession = s;
383 minOperationsCount = s->operationsCount();
384 }
385 }
386 }
387
388 return chosenSession;
389}
390
391IMAPFolderInfoOperation * IMAPAsyncSession::folderInfoOperation(String * folder)
392{

Callers

nothing calls this directly

Calls 5

objectAtIndexMethod · 0.80
operationsCountMethod · 0.80
lastFolderMethod · 0.80
countMethod · 0.45
isEqualMethod · 0.45

Tested by

no test coverage detected