Merge pull request 'Issue #2: Added whitelist filtering.' (#6) from issue-2-whitelist into master

This commit is contained in:
Stefan Härter 2023-07-10 17:44:20 +02:00 committed by Gitea
parent 288409a1c2
commit f916bec78a

View File

@ -41,6 +41,9 @@ sub new {
# load remembered update ids
$Self->{MessageIDs} = YAML::LoadFile("$FindBin::Bin/message_ids.yml");
# whitelist
$Self->{Whitelist} = $Param{Whitelist};
return $Self;
}
@ -389,6 +392,11 @@ sub fetchMessages {
MESSAGE:
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}}) {
$Self->{LogObject}->info('fetchMessages: Skipping known message_id');
next MESSAGE;