IMAP: retrieve message count on folder

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2027 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2012-09-18 22:30:54 +00:00
parent cdfad5a8ba
commit da71c7002d
5 changed files with 15 additions and 0 deletions

View File

@ -1524,6 +1524,10 @@ public abstract class ExchangeSession {
* Folder class (PR_CONTAINER_CLASS).
*/
public String folderClass;
/**
* Folder message count.
*/
public int count;
/**
* Folder unread message count.
*/

View File

@ -1715,7 +1715,10 @@ public class DavExchangeSession extends ExchangeSession {
folder.folderClass = getPropertyIfExists(properties, "folderclass");
folder.hasChildren = "1".equals(getPropertyIfExists(properties, "hassubs"));
folder.noInferiors = "1".equals(getPropertyIfExists(properties, "nosubs"));
folder.count = getIntPropertyIfExists(properties, "count");
folder.unreadCount = getIntPropertyIfExists(properties, "unreadcount");
// fake recent value
folder.recent = folder.unreadCount;
folder.ctag = getPropertyIfExists(properties, "contenttag");
folder.etag = getPropertyIfExists(properties, "lastmodified");
@ -1764,6 +1767,7 @@ public class DavExchangeSession extends ExchangeSession {
FOLDER_PROPERTIES.add("folderclass");
FOLDER_PROPERTIES.add("hassubs");
FOLDER_PROPERTIES.add("nosubs");
FOLDER_PROPERTIES.add("count");
FOLDER_PROPERTIES.add("unreadcount");
FOLDER_PROPERTIES.add("contenttag");
FOLDER_PROPERTIES.add("lastmodified");

View File

@ -106,6 +106,7 @@ public class Field {
createField("folderclass", SCHEMAS_EXCHANGE, "outlookfolderclass");
createField(DAV, "hassubs");
createField(DAV, "nosubs");
createField("count", DAV, "objectcount");
createField(URN_SCHEMAS_HTTPMAIL, "unreadcount");
createField(SCHEMAS_REPL, "contenttag");

View File

@ -938,6 +938,7 @@ public class EwsExchangeSession extends ExchangeSession {
FOLDER_PROPERTIES.add(Field.get("lastmodified"));
FOLDER_PROPERTIES.add(Field.get("folderclass"));
FOLDER_PROPERTIES.add(Field.get("ctag"));
FOLDER_PROPERTIES.add(Field.get("count"));
FOLDER_PROPERTIES.add(Field.get("unread"));
FOLDER_PROPERTIES.add(Field.get("hassubs"));
FOLDER_PROPERTIES.add(Field.get("uidNext"));
@ -951,7 +952,10 @@ public class EwsExchangeSession extends ExchangeSession {
folder.folderClass = item.get(Field.get("folderclass").getResponseName());
folder.etag = item.get(Field.get("lastmodified").getResponseName());
folder.ctag = item.get(Field.get("ctag").getResponseName());
folder.count = item.getInt(Field.get("count").getResponseName());
folder.unreadCount = item.getInt(Field.get("unread").getResponseName());
// fake recent value
folder.recent = folder.unreadCount;
folder.hasChildren = item.getBoolean(Field.get("hassubs").getResponseName());
// noInferiors not implemented
folder.uidNext = item.getInt(Field.get("uidNext").getResponseName());

View File

@ -40,7 +40,9 @@ public final class Field {
// folder
FIELD_MAP.put("ctag", new ExtendedFieldURI(0x670a, ExtendedFieldURI.PropertyType.SystemTime)); // PR_LOCAL_COMMIT_TIME_MAX
FIELD_MAP.put("count", new ExtendedFieldURI(0x3602, ExtendedFieldURI.PropertyType.Integer)); // PR_CONTENT_COUNT
FIELD_MAP.put("unread", new ExtendedFieldURI(0x3603, ExtendedFieldURI.PropertyType.Integer)); // PR_CONTENT_UNREAD
FIELD_MAP.put("hassubs", new ExtendedFieldURI(0x360a, ExtendedFieldURI.PropertyType.Boolean)); // PR_SUBFOLDERS
FIELD_MAP.put("folderDisplayName", new UnindexedFieldURI("folder:DisplayName"));