diff --git a/agc_2-X/branches/agc_30/lib/Astguiclient/Daemon/Dialer.pm b/agc_2-X/branches/agc_30/lib/Astguiclient/Daemon/Dialer.pm new file mode 100644 index 00000000..250416e0 --- /dev/null +++ b/agc_2-X/branches/agc_30/lib/Astguiclient/Daemon/Dialer.pm @@ -0,0 +1,86 @@ +package Astguiclient::Daemon::Dialer; + +use strict; +use Astguiclient::Dialer; +use base qw/Astguiclient::Daemon Class::Accessor::Fast/; + +__PACKAGE__->mk_accessors( qw/ dialer / ); + +=head1 NAME + +Astguiclient::Daemon::Dialer - Dialer module. + +=head1 DESCRIPTION + +This modules creates a daemon for auto dialing. + +=head2 loop + +Called by daemon. + +=cut +sub loop { + my $self = shift; + + $self->dialer->run(); + + # Check dialer status. + if( $self->dialer->status() eq 'off') { + # No agents are signed in. Reset sleep timer. + $self->sleep(30); + } else { + $self->sleep(2); + } +} + +=head2 init + +Called by daemon in init process. + +=cut + +sub init { + my $self = shift; + $self->dialer( Astguiclient::Dialer->new() ); + + $self->SUPER::init(); +} + +=head2 cleanup { + +Called when process is killed. + +=cut + +sub cleanup { + my $self = shift; + $self->dialer->cleanup(); + + $self->SUPER::cleanup(); +} + +=head1 AUTHOR + +Jason Yates + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2006 Matt Florell + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program 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 General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +=cut + +1;