Fix Makefile.PL, bump version to 0.001001
[poe-component-irc-plugin-logger-irssi.git] / lib / POE / Component / IRC / Plugin / Logger / Irssi.pm
CommitLineData
e628c597
MG
1package POE::Component::IRC::Plugin::Logger::Irssi;
2
440c5c51 3our $VERSION = 0.001001;
e628c597
MG
4
5use 5.014000;
6use strict;
7use warnings;
8
9use parent qw/Exporter/;
10
11our @EXPORT_OK = qw/irssi_format/;
12
13##################################################
14
15my %irssi_format = (
16 nick_change => sub { "-!- $_[0] is now known as $_[1]" },
17 topic_is => sub { "-!- Topic for $_[0]: $_[1]"},
18 topic_change => sub {
19 my ($nick, $topic) = @_;
20 return "-!- $nick changed the topic to: $topic" if $topic;
21 return "-!- Topic unset by $nick" unless $topic;
22 },
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]) .']' },
31);
32
33for 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" }
36}
37
38sub irssi_format { \%irssi_format }
39
401;
41__END__
42
43=head1 NAME
44
45POE::Component::IRC::Plugin::Logger::Irssi - Log IRC events like irssi
46
47=head1 SYNOPSIS
48
49 use POE::Component::IRC::Plugin::Logger::Irssi qw/irssi_format/;
50 ...
51 $irc->plugin_add(Logger => POE::Component::IRC::Plugin::Logger->new(
52 Format => irssi_format,
53 ...
54 ));
55
56=head1 DESCRIPTION
57
58POE::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.
59
60It 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.
61
62=head1 AUTHOR
63
64Marius Gavrilescu C<< <marius@ieval.ro> >>
65
66=head1 COPYRIGHT AND LICENSE
67
68Copyright (C) 2013 by Marius Gavrilescu
69
70This library is free software; you can redistribute it and/or modify
71it under the same terms as Perl itself, either Perl version 5.14.2 or,
72at your option, any later version of Perl 5 you may have available.
73
74
75=cut
This page took 0.013387 seconds and 4 git commands to generate.