]>
Commit | Line | Data |
---|---|---|
1 | package App::FonBot::Plugin::BitlBee; | |
2 | ||
3 | our $VERSION = '0.000_5'; | |
4 | ||
5 | use v5.14; | |
6 | use strict; | |
7 | use warnings; | |
8 | ||
9 | use parent qw/App::FonBot::Plugin::IRC/; | |
10 | ||
11 | use POE; | |
12 | use POE::Component::IRC::Plugin::Connector; | |
13 | ||
14 | use App::FonBot::Plugin::Config qw/$bitlbee_enabled $bitlbee_nick $bitlbee_server $bitlbee_port $bitlbee_password/; | |
15 | ||
16 | ################################################## | |
17 | ||
18 | sub _start{ | |
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') | |
35 | } | |
36 | ||
37 | sub irc_public{ | |
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:/; | |
41 | } | |
42 | ||
43 | 1; | |
44 | __END__ | |
45 | ||
46 | =encoding utf-8 | |
47 | ||
48 | =head1 NAME | |
49 | ||
50 | App::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 | ||
61 | This 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 | ||
65 | These are the L<App::FonBot::Plugin::Config> configuration variables used in this module | |
66 | ||
67 | =over | |
68 | ||
69 | =item C<$bitlbee_enabled> | |
70 | ||
71 | If false, the BitlBee plugin is disabled. | |
72 | ||
73 | =item C<$bitlbee_nick> | |
74 | ||
75 | BitlBee nickname | |
76 | ||
77 | =item C<$bilbee_server> | |
78 | ||
79 | BitlBee server hostname | |
80 | ||
81 | =item C<$bitlbee_port> | |
82 | ||
83 | BitlBee server port | |
84 | ||
85 | =item C<$bitlbee_password> | |
86 | ||
87 | BitlBee identify password | |
88 | ||
89 | =back | |
90 | ||
91 | =head1 AUTHOR | |
92 | ||
93 | Marius Gavrilescu C<< <marius@ieval.ro> >> | |
94 | ||
95 | =head1 COPYRIGHT AND LICENSE | |
96 | ||
97 | Copyright 2013 Marius Gavrilescu | |
98 | ||
99 | This file is part of fonbotd. | |
100 | ||
101 | fonbotd is free software: you can redistribute it and/or modify | |
102 | it under the terms of the GNU Affero General Public License as published by | |
103 | the Free Software Foundation, either version 3 of the License, or | |
104 | (at your option) any later version. | |
105 | ||
106 | fonbotd is distributed in the hope that it will be useful, | |
107 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
108 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
109 | GNU Affero General Public License for more details. | |
110 | ||
111 | You should have received a copy of the GNU Affero General Public License | |
112 | along with fonbotd. If not, see <http://www.gnu.org/licenses/> | |
113 | ||
114 | ||
115 | =cut |