1 package POE
::Component
::IRC
::Plugin
::Logger
::Irssi
;
3 our $VERSION = 0.001001;
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 }
45 POE::Component::IRC::Plugin::Logger::Irssi - Log IRC events like irssi
49 use POE::Component::IRC::Plugin::Logger::Irssi qw/irssi_format/;
51 $irc->plugin_add(Logger => POE::Component::IRC::Plugin::Logger->new(
52 Format => irssi_format,
58 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.
60 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.
64 Marius Gavrilescu C<< <marius@ieval.ro> >>
66 =head1 COPYRIGHT AND LICENSE
68 Copyright (C) 2013 by Marius Gavrilescu
70 This library is free software; you can redistribute it and/or modify
71 it under the same terms as Perl itself, either Perl version 5.14.2 or,
72 at your option, any later version of Perl 5 you may have available.
This page took 0.026119 seconds and 4 git commands to generate.