Issue #2: Added whitelist filtering. #6
@ -41,6 +41,9 @@ sub new {
|
|||||||
# load remembered update ids
|
# load remembered update ids
|
||||||
$Self->{MessageIDs} = YAML::LoadFile("$FindBin::Bin/message_ids.yml");
|
$Self->{MessageIDs} = YAML::LoadFile("$FindBin::Bin/message_ids.yml");
|
||||||
|
|
||||||
|
# whitelist
|
||||||
|
$Self->{Whitelist} = $Param{Whitelist};
|
||||||
|
|
||||||
return $Self;
|
return $Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,6 +392,11 @@ sub fetchMessages {
|
|||||||
|
|
||||||
MESSAGE:
|
MESSAGE:
|
||||||
for my $Message (@Messages) {
|
for my $Message (@Messages) {
|
||||||
|
if ( $Self->{Whitelist}{$Message->{message}{from}{id}} ) {
|
||||||
|
$Self->{LogObject}
|
||||||
|
->info( 'fetchMessages: User not whitelisted, skipping message ' . Dumper($MessageDataRaw) );
|
||||||
|
next MESSAGE;
|
||||||
|
}
|
||||||
if ($Self->{MessageIDs}{$Message->{message}{message_id}}) {
|
if ($Self->{MessageIDs}{$Message->{message}{message_id}}) {
|
||||||
$Self->{LogObject}->info('fetchMessages: Skipping known message_id');
|
$Self->{LogObject}->info('fetchMessages: Skipping known message_id');
|
||||||
next MESSAGE;
|
next MESSAGE;
|
||||||
|
Loading…
Reference in New Issue
Block a user