synccompare: IMPP + X-ABLabel:Other normalization

Google CardDAV always adds the "Other" label to IMPP properties.
Ignore this by replacing the group of these two properties
with just the IMPP property. The normalization is intentionally
only done for two grouped properties. If we end up with more,
we need to check what that means instead of removing the label.
It's also more efficient and easier to implement this way.
This commit is contained in:
Patrick Ohly 2014-05-16 01:15:41 -07:00
parent 87dd789b99
commit 18a18d057e

View file

@ -808,6 +808,16 @@ sub NormalizeItem {
my @expanded;
foreach (@tagged) {
if ($_->[2]) {
if ($#{$_} == 4) {
# Simplify IMPP + X-ABLabel:Other to just IMPP without group tag.
# For the sake of simplicity we only do that if the number of
# grouped properties is exactly two. Otherwise we would have
# to search in the list of extra properties.
if ($_->[3] =~ /^IMPP[;:]/ &&
$_->[4][3] =~ /^X-ABLabel:Other$/) {
splice(@{$_}, 4);
}
}
if ($#{$_} == 3) {
# Remove redundant group tags.
$_->[2] = "";