IMAP: Implement davmail.folderSizeLimit

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2177 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2013-09-14 17:35:04 +00:00
parent bb70c7f092
commit ad9ac4f0ad
2 changed files with 4 additions and 2 deletions

View File

@ -2057,7 +2057,8 @@ public class DavExchangeSession extends ExchangeSession {
@Override
public MessageList searchMessages(String folderPath, Set<String> attributes, Condition condition) throws IOException {
MessageList messages = new MessageList();
MultiStatusResponse[] responses = searchItems(folderPath, attributes, and(isFalse("isfolder"), isFalse("ishidden"), condition), FolderQueryTraversal.Shallow, 0);
int maxCount = Settings.getIntProperty("davmail.folderSizeLimit", 0);
MultiStatusResponse[] responses = searchItems(folderPath, attributes, and(isFalse("isfolder"), isFalse("ishidden"), condition), FolderQueryTraversal.Shallow, maxCount);
for (MultiStatusResponse response : responses) {
Message message = buildMessage(response);

View File

@ -663,7 +663,8 @@ public class EwsExchangeSession extends ExchangeSession {
@Override
public MessageList searchMessages(String folderPath, Set<String> attributes, Condition condition) throws IOException {
MessageList messages = new MessageList();
List<EWSMethod.Item> responses = searchItems(folderPath, attributes, condition, FolderQueryTraversal.SHALLOW, 0);
int maxCount = Settings.getIntProperty("davmail.folderSizeLimit", 0);
List<EWSMethod.Item> responses = searchItems(folderPath, attributes, condition, FolderQueryTraversal.SHALLOW, maxCount);
for (EWSMethod.Item response : responses) {
if (MESSAGE_TYPES.contains(response.type)) {