mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-14 11:42:23 -05:00
Caldav: improve getICSValue, do not return values inside VALARM section
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@766 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
cc9b6e56c3
commit
d99f8b2866
@ -2106,13 +2106,19 @@ public class ExchangeSession {
|
||||
}
|
||||
|
||||
protected String getICSValue(String icsBody, String prefix, String defval) throws IOException {
|
||||
// only return values in VEVENT section, not VALARM
|
||||
Stack<String> sectionStack = new Stack<String>();
|
||||
BufferedReader reader = null;
|
||||
|
||||
try {
|
||||
reader = new ICSBufferedReader(new StringReader(icsBody));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
if (line.startsWith(prefix)) {
|
||||
if (line.startsWith("BEGIN:")) {
|
||||
sectionStack.push(line);
|
||||
} else if (line.startsWith("END:") && !sectionStack.isEmpty()) {
|
||||
sectionStack.pop();
|
||||
} else if (!sectionStack.isEmpty() && "BEGIN:VEVENT".equals(sectionStack.peek()) && line.startsWith(prefix)) {
|
||||
return line.substring(prefix.length());
|
||||
}
|
||||
}
|
||||
@ -2131,16 +2137,7 @@ public class ExchangeSession {
|
||||
}
|
||||
|
||||
protected String getICSDescription(String icsBody) throws IOException {
|
||||
String description = getICSValue(icsBody, "DESCRIPTION:", "");
|
||||
|
||||
if ("reminder".equalsIgnoreCase(description)) {
|
||||
// Ignore this as a description text because
|
||||
// it's likely part of the valarm segment
|
||||
// (the default valarm description from outlook is "reminder")
|
||||
return "";
|
||||
}
|
||||
|
||||
return description;
|
||||
return getICSValue(icsBody, "DESCRIPTION:", "");
|
||||
}
|
||||
|
||||
static class Participants {
|
||||
|
Loading…
Reference in New Issue
Block a user