The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

App::FonBot::Plugin::Common - FonBot plugin that provides global variables and functions

SYNOPSIS

        use App::FonBot::Plugin::Common;
        App::FonBot::Plugin::Common->init;

        $ok_user_addresses{'marius OFTC mgvx'}=1; # Let user marius send messages to mgvx via the OFTC plugin
        sendmsg 'marius', 'OFTC mgvx', 'echo', 'Hello', 'world!';

        App::FonBot::Plugin::Common->fini;

DESCRIPTION

This FonBot plugin provides global variables and functions to the other plugins. It also sets the user and group according to the configuration file. It is a required plugin, since most other plugins depend on it.

CONFIGURATION VARIABLES

These are the App::FonBot::Plugin::Config configuration variables used in this module

$dir

Directory to chdir to.

$user

User to change to.

$group

Group to change to.

@supplementary_groups

Supplementary groups list to set.

EXPORTED SYMBOLS

%ok_user_addresses

Hash that records combinations of username, driver and address that have sent commands to us. The key format is "$username $drivername $address". fonbotd will never send a message to an address which is not found in this hash.

Example entry: $ok_user_address{"nobody EMAIL nobody@mailinator.com"}.

%commands

Hash from usernames to a Storable::freezed array of pending commands for the user.

%waiting_requests

Hash from usernames to a waiting HTTP::Response, as defined by the POE::Component::Server::HTTP documentation.

sendmsg($touser, $requestid, $replyto, $command, @args)

Sends a command to $touser's phone. The command includes a command name ($command), a list of arguments (@args) and a reply address ($replyto). If $requestid is defined, the command will also include that request ID.

METHODS

App::FonBot::Plugin::Common->init

Sets the user and group according to the configuration variables and reads the exported variables from the disk.

App::FonBot::Plugin::Common->fini

Writes the exported variables to the disk.

AUTHOR

Marius Gavrilescu <marius@ieval.ro>

COPYRIGHT AND LICENSE

Copyright 2013 Marius Gavrilescu

This file is part of fonbotd.

fonbotd is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

fonbotd is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with fonbotd. If not, see <http://www.gnu.org/licenses/>