#!/usr/bin/perl 
# xDash - Asynchronous Messaging and Instant Messaging reunited

#===
package EventLogger;
use base xDash::Logger::File;
# Check the correct file path for logger (absolute path if daemon!) and
# Uncomment 1.line and comment out 2.line below after debugging.
#sub Open { shift->SUPER::Open( '/root/Ex1S1R/a.archi@xdash_PC/event.log' ) }
sub Open { shift->SUPER::Open( STDOUT ) }

package ErrorLogger;
use base xDash::Logger::File;
# Check the correct file path for logger (absolute path if daemon!) and
# Uncomment 1.line and comment out 2.line below after debugging.
#sub Open { shift->SUPER::Open( '/root/Ex1S1R/a.archi@xdash_PC/error.log' ) }
sub Open { shift->SUPER::Open( STDERR ) }

package MessageLogger;
# Check the correct file path for logger and
# Uncomment the 1.line and comment out 2.line & 3.line below after debugging.
#use base xDash::Logger::Dumb;
use base xDash::Logger::File;
sub Open { shift->SUPER::Open( STDOUT ) }

package EmergencyLogger;
# Check the correct file path for logger (absolute path if daemon!).
use base xDash::Logger::File;
sub Open { shift->SUPER::Open( '/root/Ex1S1R/a.archi@xdash_PC/emergency.log' ) }

package Archive;
use base xDash::Archive::Pg;
# Set up your own database access parameters 
sub SetParameters { shift->SUPER::SetDatabaseConnection(
 name => 'xdash', user => '', password => '' ) }
#===

package main;
use strict;
use warnings;
use xDash::Archivist;

my $archivist = new xDash::Archivist;

# After debugging change:
# daemon => 1, for running as daemon (daemon => O, console usage)
# delay => 10, for waiting 10 seconds before becomming a daemon
# timeout => 100, for waiting 100 seconds to try to reconnect
# Test settings:
$archivist->SetMode( daemon => 0, delay => 0, timeout => 100 );

# Parameters from archivist.xml and default connection parameters 
# from package Net::Jabber::Client (::Connect()) can be overriden here:
#	hostname => string, port => integer,
# 	connectiontype => tcpip|http, ssl => 0|1
# Uncomment if needed, method is optional.
# $archivist->SetConnectionParameters( ... => ... , );

# Initiate Archivist's JID (absolute path if daemon!)
$archivist->SetParticipants( '/root/Ex1S1R/a.archi@xdash_PC/archivist.xml' );

# A comma separated list of archive error numbers on which Archivist's script
# dies and is restarted by the operating system.
$archivist->SetRestartArchiveError( -1 );

# Go on ...
$archivist->Process();
