mirror of
https://github.com/moparisthebest/davmail
synced 2025-01-07 03:38:05 -05:00
IMAP: fix keywords implementation, make it case insensitive, implement KEYWORD search
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2024 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
9475873dd9
commit
e33fafb8b2
@ -537,7 +537,7 @@ public class Field {
|
|||||||
} else if (field.isMultivalued) {
|
} else if (field.isMultivalued) {
|
||||||
// multivalued field, split values separated by \n
|
// multivalued field, split values separated by \n
|
||||||
List<XmlSerializable> valueList = new ArrayList<XmlSerializable>();
|
List<XmlSerializable> valueList = new ArrayList<XmlSerializable>();
|
||||||
String[] values = value.split("\n");
|
String[] values = value.split(",");
|
||||||
for (final String singleValue : values) {
|
for (final String singleValue : values) {
|
||||||
valueList.add(new XmlSerializable() {
|
valueList.add(new XmlSerializable() {
|
||||||
public Element toXml(Document document) {
|
public Element toXml(Document document) {
|
||||||
|
@ -1271,6 +1271,8 @@ public class ImapConnection extends AbstractConnection {
|
|||||||
session.contains("from", value),
|
session.contains("from", value),
|
||||||
session.contains("to", value),
|
session.contains("to", value),
|
||||||
session.contains("cc", value));
|
session.contains("cc", value));
|
||||||
|
} else if ("KEYWORD".equals(token)) {
|
||||||
|
return session.contains("keywords", tokens.nextToken());
|
||||||
} else if ("FROM".equals(token)) {
|
} else if ("FROM".equals(token)) {
|
||||||
return session.contains("from", tokens.nextToken());
|
return session.contains("from", tokens.nextToken());
|
||||||
} else if ("TO".equals(token)) {
|
} else if ("TO".equals(token)) {
|
||||||
@ -1412,7 +1414,7 @@ public class ImapConnection extends AbstractConnection {
|
|||||||
String[] keywords = message.keywords.split(",");
|
String[] keywords = message.keywords.split(",");
|
||||||
HashSet<String> keywordSet = new HashSet<String>();
|
HashSet<String> keywordSet = new HashSet<String>();
|
||||||
for (String value : keywords) {
|
for (String value : keywords) {
|
||||||
if (!value.equals(flag)) {
|
if (!value.equalsIgnoreCase(flag)) {
|
||||||
keywordSet.add(value);
|
keywordSet.add(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1444,13 +1446,19 @@ public class ImapConnection extends AbstractConnection {
|
|||||||
message.junk = true;
|
message.junk = true;
|
||||||
} else {
|
} else {
|
||||||
HashSet<String> keywordSet = new HashSet<String>();
|
HashSet<String> keywordSet = new HashSet<String>();
|
||||||
|
boolean hasFlag = false;
|
||||||
if (message.keywords != null) {
|
if (message.keywords != null) {
|
||||||
String[] keywords = message.keywords.split(",");
|
String[] keywords = message.keywords.split(",");
|
||||||
for (String value : keywords) {
|
for (String value : keywords) {
|
||||||
keywordSet.add(value);
|
keywordSet.add(value);
|
||||||
|
if (value.equalsIgnoreCase(flag)) {
|
||||||
|
hasFlag = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
keywordSet.add(flag);
|
if (!hasFlag) {
|
||||||
|
keywordSet.add(flag);
|
||||||
|
}
|
||||||
message.keywords = StringUtil.join(keywordSet, ",");
|
message.keywords = StringUtil.join(keywordSet, ",");
|
||||||
properties.put("keywords", message.keywords);
|
properties.put("keywords", message.keywords);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user