3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-03 01:48:38 +02:00

FactoidCommands: use full hostmask when testing for owner of locked factoid

This commit is contained in:
Pragmatic Software 2019-08-22 09:49:14 -07:00
parent de84ce48ff
commit be528094b6

View File

@ -601,9 +601,19 @@ sub factset {
if (defined $owner_channel) {
my $factoid = $self->{pbot}->{factoids}->{factoids}->hash->{$owner_channel}->{$owner_trigger};
my ($owner) = $factoid->{'owner'} =~ m/([^!]+)/;
my $owner;
my $mask;
if ($factoid->{'locked'}) {
# check owner against full hostmask for locked factoids
$owner = $factoid->{'owner'};
$mask = "$nick!$user\@$host";
} else {
# otherwise just the nick
($owner) = $factoid->{'owner'} =~ m/([^!]+)/;
$mask = $nick;
}
if ((defined $value and $key ne 'action') and lc $nick ne lc $owner and $level == 0) {
if ((defined $value and $key ne 'action') and lc $mask ne lc $owner and $level == 0) {
return "You are not the owner of $trigger.";
}
}
@ -1073,7 +1083,7 @@ sub factrem {
$channel = '.*' if $channel eq 'global';
$from_chan = '.*' if $channel eq 'global';
my $trigger_text = $trigger =~ / / ? "\"$trigger\"" : $trigger;;
my $trigger_text = $trigger =~ / / ? "\"$trigger\"" : $trigger;
if ($factoids->{$channel}->{$trigger}->{type} eq 'module') {
$self->{pbot}->{logger}->log("$nick!$user\@$host attempted to remove $trigger_text [not factoid]\n");