mirror of
https://github.com/moparisthebest/davmail
synced 2024-08-13 16:53:51 -04:00
IMAP: implement search check after append
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@304 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
98f4ea5e51
commit
f619571390
@ -789,20 +789,18 @@ public class ExchangeSession {
|
||||
* @throws IOException when unable to change folder
|
||||
*/
|
||||
public Folder getFolder(String folderName) throws IOException {
|
||||
Folder folder = new Folder();
|
||||
folder.folderUrl = getFolderPath(folderName);
|
||||
|
||||
Vector<String> reqProps = new Vector<String>();
|
||||
reqProps.add("DAV:hassubs");
|
||||
reqProps.add("DAV:nosubs");
|
||||
reqProps.add("DAV:objectcount");
|
||||
reqProps.add("urn:schemas:httpmail:unreadcount");
|
||||
reqProps.add("DAV:getlastmodified");
|
||||
Enumeration folderEnum = wdr.propfindMethod(folder.folderUrl, 0, reqProps);
|
||||
|
||||
Enumeration folderEnum = wdr.propfindMethod(getFolderPath(folderName), 0, reqProps);
|
||||
Folder folder = null;
|
||||
if (folderEnum.hasMoreElements()) {
|
||||
ResponseEntity entity = (ResponseEntity) folderEnum.nextElement();
|
||||
folder = buildFolder(entity);
|
||||
folder.folderName = folderName;
|
||||
}
|
||||
return folder;
|
||||
}
|
||||
@ -814,6 +812,7 @@ public class ExchangeSession {
|
||||
public boolean hasChildren;
|
||||
public boolean noInferiors;
|
||||
public long lastModified;
|
||||
public String folderName;
|
||||
|
||||
public String getFlags() {
|
||||
if (noInferiors) {
|
||||
|
@ -171,7 +171,9 @@ public class ImapConnection extends AbstractConnection {
|
||||
sendClient(commandId + " BAD missing create argument");
|
||||
}
|
||||
} else if ("uid".equalsIgnoreCase(command)) {
|
||||
if (tokens.hasMoreTokens() && "fetch".equalsIgnoreCase(tokens.nextToken())) {
|
||||
if (tokens.hasMoreTokens()) {
|
||||
String subcommand = tokens.nextToken();
|
||||
if ("fetch".equalsIgnoreCase(subcommand)) {
|
||||
if (tokens.hasMoreTokens()) {
|
||||
String messageParameter = tokens.nextToken();
|
||||
if (currentFolder == null) {
|
||||
@ -231,6 +233,29 @@ public class ImapConnection extends AbstractConnection {
|
||||
} else {
|
||||
sendClient(commandId + " BAD command unrecognized");
|
||||
}
|
||||
} else if ("search".equalsIgnoreCase(subcommand)) {
|
||||
// only create check search
|
||||
String messageId = null;
|
||||
int messageIndex = 0;
|
||||
while (tokens.hasMoreTokens()) {
|
||||
messageId = tokens.nextToken();
|
||||
}
|
||||
// reload messages
|
||||
messages = session.getAllMessages(currentFolder.folderName);
|
||||
for (int i = 0; i < messages.size(); i++) {
|
||||
if (messageId.equals(messages.get(i).messageId)) {
|
||||
messageIndex = i + 1;
|
||||
}
|
||||
}
|
||||
if (messageIndex > 0) {
|
||||
sendClient("* SEARCH " + messageIndex);
|
||||
}
|
||||
sendClient(commandId + " OK SEARCH completed");
|
||||
|
||||
} else if ("store".equalsIgnoreCase(subcommand)) {
|
||||
// TODO
|
||||
sendClient(commandId + " OK STORE completed");
|
||||
}
|
||||
} else {
|
||||
sendClient(commandId + " BAD command unrecognized");
|
||||
}
|
||||
@ -262,6 +287,11 @@ public class ImapConnection extends AbstractConnection {
|
||||
session.createMessage(session.getFolderPath(folderName), "test", null, new String(buffer), true);
|
||||
sendClient(commandId + " OK APPEND completed");
|
||||
} else if ("noop".equalsIgnoreCase(command)) {
|
||||
if (currentFolder != null) {
|
||||
currentFolder = session.getFolder(currentFolder.folderName);
|
||||
sendClient("* " + currentFolder.objectCount + " EXISTS");
|
||||
sendClient("* " + currentFolder.objectCount + " RECENT");
|
||||
}
|
||||
sendClient(commandId + " OK NOOP completed");
|
||||
} else {
|
||||
sendClient(commandId + " BAD command unrecognized");
|
||||
|
Loading…
Reference in New Issue
Block a user