Reindent code
[app-fonbot-daemon.git] / lib / App / FonBot / Plugin / BitlBee.pm
CommitLineData
8dc70d07
MG
1package App::FonBot::Plugin::BitlBee;
2
3our $VERSION = '0.000_3';
4
5use v5.14;
6use strict;
7use warnings;
8
9use parent qw/App::FonBot::Plugin::IRC/;
10
11use POE;
12use POE::Component::IRC::Plugin::Connector;
13
14use App::FonBot::Plugin::Config qw/$bitlbee_enabled $bitlbee_nick $bitlbee_server $bitlbee_port $bitlbee_password/;
15
16##################################################
17
18sub _start{
962dff7b
MG
19 return unless $bitlbee_enabled;
20 my $self=$_[OBJECT];
21
22 $self->{irc} = POE::Component::IRC->spawn(
23 Flood => 1,
24 Nick => $bitlbee_nick,
25 Username => $bitlbee_nick,
26 Ircname => 'FonBot',
27 Server => $bitlbee_server,
28 Port => $bitlbee_port,
29 );
30 $self->{irc}->yield(register => qw/msg public/);
31 $self->{irc}->yield(connect => {});
32 $self->{irc}->plugin_add(Connector => POE::Component::IRC::Plugin::Connector->new);
33
34 $_[KERNEL]->alias_set('BITLBEE')
8dc70d07
MG
35}
36
37sub irc_public{
962dff7b
MG
38 my ($self, $msg)=@_[OBJECT, ARG2];
39 $self->{irc}->yield(privmsg => '&bitlbee', "identify $bitlbee_password") if $msg =~ /^Welcome to the BitlBee gateway!$/;
40 $self->{irc}->yield(privmsg => '&bitlbee', 'yes') if $msg =~ /New request:/;
8dc70d07
MG
41}
42
431;
44__END__
45
46=encoding utf-8
47
48=head1 NAME
49
50App::FonBot::Plugin::BitlBee - FonBot plugin that provides the BitlBee user interface
51
52=head1 SYNOPSIS
53
54 use App::FonBot::Plugin::BitlBee;
55 App::FonBot::Plugin::BitlBee->init;
56
57 END { App::FonBot::Plugin::BitlBee->fini }
58
59=head1 DESCRIPTION
60
61This is one of the two implementations of C<App::FonBot::Plugin::IRC>. It identifies with a bitlbee server, accepts all buddy requests and processes received commands.
62
63=head1 CONFIGURATION VARIABLES
64
65These are the L<App::FonBot::Plugin::Config> configuration variables used in this module
66
67=over
68
69=item C<$bitlbee_enabled>
70
71If false, the BitlBee plugin is disabled.
72
73=item C<$bitlbee_nick>
74
75BitlBee nickname
76
77=item C<$bilbee_server>
78
79BitlBee server hostname
80
81=item C<$bitlbee_port>
82
83BitlBee server port
84
85=item C<$bitlbee_password>
86
87BitlBee identify password
88
89=back
90
91=head1 AUTHOR
92
93Marius Gavrilescu C<< <marius@ieval.ro> >>
94
95=head1 COPYRIGHT AND LICENSE
96
97Copyright 2013 Marius Gavrilescu
98
99This file is part of fonbotd.
100
101fonbotd is free software: you can redistribute it and/or modify
102it under the terms of the GNU Affero General Public License as published by
103the Free Software Foundation, either version 3 of the License, or
104(at your option) any later version.
105
106fonbotd is distributed in the hope that it will be useful,
107but WITHOUT ANY WARRANTY; without even the implied warranty of
108MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
109GNU Affero General Public License for more details.
110
111You should have received a copy of the GNU Affero General Public License
112along with fonbotd. If not, see <http://www.gnu.org/licenses/>
113
114
115=cut
This page took 0.015428 seconds and 4 git commands to generate.