1 package POE
::Component
::IRC
::Plugin
::Logger
::Irssi
;
3 our $VERSION = '0.001002';
9 use parent qw
/Exporter/;
11 our @EXPORT_OK = qw
/irssi_format/;
13 ##################################################
16 nick_change
=> sub { "-!- $_[0] is now known as $_[1]" },
17 topic_is
=> sub { "-!- Topic for $_[0]: $_[1]"},
19 my ($nick, $topic) = @_;
20 return "-!- $nick changed the topic to: $topic" if $topic;
21 return "-!- Topic unset by $nick" unless $topic;
23 privmsg
=> sub{ "<$_[0]> $_[1]" },
24 notice
=> sub { "-$_[0]- $_[1]" },
25 action
=> sub { "* $_[0] $_[1]" },
26 join => sub { "-!- $_[0] [$_[1]] has joined $_[2]" },
27 part
=> sub { "-!- $_[0] [$_[1]] has left $_[2] [$_[3]]" },
28 quit
=> sub { "-!- $_[0] [$_[1]] has quit [$_[2]]"},
29 kick
=> sub { "-!- $_[1] was kicked from $_[2] by $_[0] [$_[3]]"},
30 topic_set_by
=> sub { "-!- Topic set by $_[1] [". localtime($_[2]) .']' },
33 for my $letter ('a' .. 'z', 'A' .. 'Z') {
34 $irssi_format{"+$letter"} = sub { my $nick = shift; "-!- mode [+$letter @_] by $nick" };
35 $irssi_format{"-$letter"} = sub { my $nick = shift; "-!- mode [-$letter @_] by $nick" }
38 sub irssi_format
{ \
%irssi_format }
47 POE::Component::IRC::Plugin::Logger::Irssi - Log IRC events like irssi
51 use POE::Component::IRC::Plugin::Logger::Irssi qw/irssi_format/;
53 $irc->plugin_add(Logger => POE::Component::IRC::Plugin::Logger->new(
54 Format => irssi_format,
60 POE::Component::IRC::Plugin::Logger::Irssi is an extension to the L<POE::Component::IRC::Plugin::Logger> PoCo-IRC plugin that logs everything in a format similar to the one used by the irssi IRC client.
62 It exports one function, B<irssi_format>, that returns a hashref to be used as the value to C<< POE::Component::IRC::Plugin::Logger->new >>'s C<format> argument.
66 Marius Gavrilescu C<< <marius@ieval.ro> >>
68 =head1 COPYRIGHT AND LICENSE
70 Copyright (C) 2013 by Marius Gavrilescu
72 This library is free software; you can redistribute it and/or modify
73 it under the same terms as Perl itself, either Perl version 5.14.2 or,
74 at your option, any later version of Perl 5 you may have available.
This page took 0.024212 seconds and 4 git commands to generate.