| 1474 | } |
| 1475 | |
| 1476 | Array * /* IMAPFolder */ IMAPSession::fetchSubscribedFolders(ErrorCode * pError) |
| 1477 | { |
| 1478 | int r; |
| 1479 | clist * imap_folders; |
| 1480 | |
| 1481 | MCLog("fetch subscribed"); |
| 1482 | loginIfNeeded(pError); |
| 1483 | if (* pError != ErrorNone) |
| 1484 | return NULL; |
| 1485 | |
| 1486 | if (mDelimiter == 0) { |
| 1487 | char delimiter; |
| 1488 | |
| 1489 | delimiter = fetchDelimiterIfNeeded(mDelimiter, pError); |
| 1490 | if (* pError != ErrorNone) |
| 1491 | return NULL; |
| 1492 | |
| 1493 | //setDelimiter(delimiter); |
| 1494 | mDelimiter = delimiter; |
| 1495 | } |
| 1496 | |
| 1497 | String * prefix; |
| 1498 | prefix = defaultNamespace()->mainPrefix(); |
| 1499 | if (prefix == NULL) { |
| 1500 | prefix = MCSTR(""); |
| 1501 | } |
| 1502 | if (prefix->length() > 0) { |
| 1503 | if (!prefix->hasSuffix(String::stringWithUTF8Format("%c", mDelimiter))) { |
| 1504 | prefix = prefix->stringByAppendingUTF8Format("%c", mDelimiter); |
| 1505 | } |
| 1506 | } |
| 1507 | |
| 1508 | r = mailimap_lsub(mImap, MCUTF8(prefix), "*", &imap_folders); |
| 1509 | MCLog("fetch subscribed %u", r); |
| 1510 | Array * result = resultsWithError(r, imap_folders, pError); |
| 1511 | if (* pError == ErrorConnection || * pError == ErrorParse) |
| 1512 | mShouldDisconnect = true; |
| 1513 | return result; |
| 1514 | } |
| 1515 | |
| 1516 | Array * /* IMAPFolder */ IMAPSession::fetchAllFolders(ErrorCode * pError) |
| 1517 | { |
no test coverage detected