Commit 38b3c589 authored by Nigel Kukard's avatar Nigel Kukard
Browse files

Ensure no duplication of pids in decoding

parent 69329a6d
......@@ -589,7 +589,8 @@ sub decodePolicyData
my $recipientData = shift;
my %recipientToPolicy = ();
my $recipientToPolicy = { };
# Build policy str list and recipients list
foreach my $item (split(/\//,$recipientData)) {
# Skip over first /
......@@ -606,13 +607,21 @@ sub decodePolicyData
my ($prio,$policyIDs) = ( $policy =~ /(\d+)=(.*)/ );
# Pull off policyID's from string
foreach my $pid (split(/,/,$policyIDs)) {
push(@{$recipientToPolicy{$email}{$prio}},$pid);
$recipientToPolicy->{$email}{$prio}->{$pid} = 1;
}
}
}
}
return \%recipientToPolicy;
# Work through the list and build our result, which is a priority hash with matches as an array
foreach my $email (keys %{$recipientToPolicy}) {
foreach my $prio (keys %{$recipientToPolicy->{$email}}) {
my @policies = keys %{$recipientToPolicy->{$email}{$prio}};
$recipientToPolicy->{$email}{$prio} = \@policies;
}
}
return $recipientToPolicy;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment