filters: fix calendar filter parsing
Fix parsing of colons. Since the field separator is also the colon, it
could mess up the parsed fields, i.e. a subject line like "WG: dinner"
could end up as "WG" instead of keeping the entire string.
Fixes: ab941eb
("filters: posix compliant rewrite of calendar filter")
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
parent
132b5fed9e
commit
0db924dc14
1 changed files with 16 additions and 5 deletions
|
@ -115,20 +115,24 @@ BEGIN {
|
||||||
}
|
}
|
||||||
|
|
||||||
/^UID/ {
|
/^UID/ {
|
||||||
id = $2
|
line = prepare($0)
|
||||||
|
id = line
|
||||||
}
|
}
|
||||||
|
|
||||||
/^STATUS/ {
|
/^STATUS/ {
|
||||||
status = $2
|
line = prepare($0)
|
||||||
|
status = line
|
||||||
}
|
}
|
||||||
|
|
||||||
/^DESCRIPTION/ {
|
/^DESCRIPTION/ {
|
||||||
entry = entry $2
|
line = prepare($0)
|
||||||
|
entry = entry line
|
||||||
indescription = 1;
|
indescription = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/^SUMMARY/ {
|
/^SUMMARY/ {
|
||||||
summary = $2
|
line = prepare($0)
|
||||||
|
summary = line
|
||||||
insummary = 1;
|
insummary = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +142,8 @@ BEGIN {
|
||||||
}
|
}
|
||||||
|
|
||||||
/^LOCATION/ {
|
/^LOCATION/ {
|
||||||
location = unescape($2, 0);
|
line = prepare($0)
|
||||||
|
location = unescape(line, 0);
|
||||||
inlocation = 1;
|
inlocation = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,6 +192,11 @@ BEGIN {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func prepare(line) {
|
||||||
|
gsub($1, "", line)
|
||||||
|
gsub(/^[: ]/, "", line)
|
||||||
|
return line
|
||||||
|
}
|
||||||
|
|
||||||
function unescape(input, preserve_newlines)
|
function unescape(input, preserve_newlines)
|
||||||
{
|
{
|
||||||
|
@ -237,6 +247,7 @@ function add_attendee(attendee)
|
||||||
function find_full_name(line)
|
function find_full_name(line)
|
||||||
{
|
{
|
||||||
name = get_value(line, "CN=[^;:]+", "=")
|
name = get_value(line, "CN=[^;:]+", "=")
|
||||||
|
gsub(/"[^"]*"/,"",line)
|
||||||
email = get_value(line, "(mailto|MAILTO):[^;]+", ":")
|
email = get_value(line, "(mailto|MAILTO):[^;]+", ":")
|
||||||
|
|
||||||
if (name == "") {
|
if (name == "") {
|
||||||
|
|
Loading…
Reference in a new issue