App-Bondage
view release on metacpan or search on metacpan
lib/App/Bondage/Recall.pm view on Meta::CPAN
$line =~ s/^(\S+ +\S+) +\S+ +(.*)/$1 $me $2/;
push @lines, $line;
}
push @lines, ":$server MODE $me :" . $irc->umode() if $irc->umode();
push @lines, @{ $self->{recall} };
push @lines, ":$server CAP * ACK :identify-msg" if $self->{idmsg};
if ($self->{Mode} eq 'all' && $#{ $self->{recall} } > $self->{last_detach}) {
# remove all PMs received since we last detached
for my $line ($self->{last_detach} .. $#{ $self->{recall} }) {
my $in = shift @{ $self->{filter}->get( $self->{recall} ) };
if ($in->{command} eq 'PRIVMSG' && $in->{params}[0] !~ /^[#&+!]/) {
delete $self->{recall}[$line];
}
}
}
elsif ($self->{Mode} eq 'missed') {
$self->{recall} = [ ];
push @{ $self->{recall} }, $self->_chan_info();
}
elsif ($self->{Mode} eq 'none') {
$self->{recall} = [ ];
push @lines, $self->_chan_info();
}
return @lines;
}
1;
=encoding utf8
=head1 NAME
App::Bondage::Recall - A PoCo-IRC plugin which can greet proxy clients
with the messages they missed while they were away.
=head1 SYNOPSIS
use App::Bondage::Recall;
$irc->plugin_add('Recall', App::Bondage::Recall->new( Mode => 'missed' ));
=head1 DESCRIPTION
This plugin requires the IRC component to be
L<POE::Component::IRC::State|POE::Component::IRC::State> or a subclass thereof.
It also requires a
L<POE::Component::IRC::Plugin::BotTraffic|POE::Component::IRC::Plugin::BotTraffic>
to be in the plugin pipeline. It will be added automatically if it is not present.
=head1 METHODS
=head2 C<new>
One optional argument:
B<'Mode'>, which public messages you want it to recall. B<'missed'>, the
default, makes it only recall public messages that were received while no
proxy client was attached. B<'all'> will recall public messages from all
channels since they were joined. B<'none'> will recall none. The plugin will
always recall missed private messages, regardless of this option.
Returns a plugin object suitable for feeding to
L<POE::Component::IRC|POE::Component::IRC>'s C<plugin_add()> method.
=head1 AUTHOR
Hinrik E<Ouml>rn SigurE<eth>sson, hinrik.sig@gmail.com
=cut
( run in 0.904 second using v1.01-cache-2.11-cpan-e1769b4cff6 )