Bump version and update Changes
[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
8f7e36dc 3our $VERSION = '0.001002';
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 = (
8d8f2a70
MG
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]) .']' },
e628c597
MG
31);
32
33for my $letter ('a' .. 'z', 'A' .. 'Z') {
8d8f2a70
MG
34 $irssi_format{"+$letter"} = sub { my $nick = shift; "-!- mode [+$letter @_] by $nick" };
35 $irssi_format{"-$letter"} = sub { my $nick = shift; "-!- mode [-$letter @_] by $nick" }
e628c597
MG
36}
37
38sub irssi_format { \%irssi_format }
39
401;
41__END__
42
9a6fbcf1
MG
43=encoding utf-8
44
e628c597
MG
45=head1 NAME
46
47POE::Component::IRC::Plugin::Logger::Irssi - Log IRC events like irssi
48
49=head1 SYNOPSIS
50
51 use POE::Component::IRC::Plugin::Logger::Irssi qw/irssi_format/;
52 ...
53 $irc->plugin_add(Logger => POE::Component::IRC::Plugin::Logger->new(
54 Format => irssi_format,
55 ...
56 ));
57
58=head1 DESCRIPTION
59
60POE::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.
61
62It 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.
63
64=head1 AUTHOR
65
66Marius Gavrilescu C<< <marius@ieval.ro> >>
67
68=head1 COPYRIGHT AND LICENSE
69
70Copyright (C) 2013 by Marius Gavrilescu
71
72This library is free software; you can redistribute it and/or modify
73it under the same terms as Perl itself, either Perl version 5.14.2 or,
74at your option, any later version of Perl 5 you may have available.
75
76
77=cut
This page took 0.015163 seconds and 4 git commands to generate.