/usr/share/perl5/App/Alice/MessageBuffer.pm is in alice 0.19-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | package App::Alice::MessageBuffer;
use Any::Moose;
has store => (
is => 'ro',
lazy => 1,
default => sub {
my $self = shift;
eval "require App::Alice::MessageStore::".$self->store_class;
("App::Alice::MessageStore::".$self->store_class)->new(id => $self->id);
}
);
has id => (
is => 'ro',
required => 1,
);
has store_class => (
is => 'ro',
default => 'Memory',
);
has previous_nick => (
is => 'rw',
default => "",
);
sub clear {
my $self = shift;
$self->previous_nick("");
$self->store->clear;
}
sub add {
my ($self, $message) = @_;
$message->{event} ne "say" ? $self->previous_nick("")
: $self->previous_nick($message->{nick});
$self->store->add($message);
}
sub with_messages {
my $self = shift;
$self->store->with_messages(@_);
}
__PACKAGE__->meta->make_immutable;
1;
|