[Relay-bot-cvs] CVS: relay-bot relay-bot.config,1.8,1.9 relay-bot.pl,1.31,1.32
Brought to you by:
freiheit
From: Eric E. <fre...@us...> - 2002-10-14 17:49:51
|
Update of /cvsroot/relay-bot/relay-bot In directory usw-pr-cvs1:/tmp/cvs-serv15593 Modified Files: relay-bot.config relay-bot.pl Log Message: Patch from wepprop to add daemon (run in background) capability. It uses the Proc::Daemon module, but "require"'s it rather than "use"'s it, so that people who don't intend to use daemon mode aren't required to install the package. Index: relay-bot.config =================================================================== RCS file: /cvsroot/relay-bot/relay-bot/relay-bot.config,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** relay-bot.config 13 Oct 2002 07:41:34 -0000 1.8 --- relay-bot.config 14 Oct 2002 17:49:45 -0000 1.9 *************** *** 26,29 **** --- 26,32 ---- $echo_topic = 1; + # Run in background + $daemonize = 0; + # IP Address of interface to connect through. # Sometimes needed with multiple Index: relay-bot.pl =================================================================== RCS file: /cvsroot/relay-bot/relay-bot/relay-bot.pl,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -r1.31 -r1.32 *** relay-bot.pl 13 Oct 2002 07:41:34 -0000 1.31 --- relay-bot.pl 14 Oct 2002 17:49:45 -0000 1.32 *************** *** 10,13 **** --- 10,14 ---- use vars qw/$echo_join $echo_part $echo_nick $echo_kick $echo_cmode/; use vars qw/$echo_umode $echo_quit $interface_address $echo_public_msg/; + use vars qw/$daemonize/; my $config_file_name = "relay-bot.config"; *************** *** 28,35 **** my $set_echo_quit = $unused_option; my $set_echo_topic = $unused_option; my $set_interface_address = ""; ! my $valid_args = "acefhijkmnpqtuv"; for ( my $i = 0, my $interval = 1 ; $i <= $#ARGV ; $i += $interval ) { --- 29,37 ---- my $set_echo_quit = $unused_option; my $set_echo_topic = $unused_option; + my $set_daemonize = $unused_option; my $set_interface_address = ""; ! my $valid_args = "acedhijkmnpqtuv"; for ( my $i = 0, my $interval = 1 ; $i <= $#ARGV ; $i += $interval ) { *************** *** 66,69 **** --- 68,79 ---- } + # -d + if( $arg =~ /^\-[$valid_args]*d/ ) { + $set_daemonize = 0; + } + if( $arg =~ /^\+[$valid_args]*d/ ) { + $set_daemonize = 1; + } + # -e if( $arg =~ /^\-[$valid_args]*e/ ) { *************** *** 89,107 **** print " [+|-]n Echo nick changes \n"; ! print " [+|-]e Echo channel msgs "; print " [+|-]p Echo parts \n"; ! print " -f <fname> Specify config file "; print " [+|-]q Echo quits \n"; ! print " -h Command option help "; print " [+|-]t Echo topic \n"; ! print " -i <ipaddr> Specify interface "; print " [+|-]u Echo user modes \n"; ! print " [+|-]j Echo joins "; print " -v Version information \n"; print " [+|-]k Echo kicks \n"; --- 99,119 ---- print " [+|-]n Echo nick changes \n"; ! print " [+|-]d Run in background "; print " [+|-]p Echo parts \n"; ! print " [+|-]e Echo channel msgs "; print " [+|-]q Echo quits \n"; ! print " -f <fname> Specify config file "; print " [+|-]t Echo topic \n"; ! print " -h Command option help "; print " [+|-]u Echo user modes \n"; ! ! print " -i <ipaddr> Specify interface "; print " -v Version information \n"; + print " [+|-]j Echo joins "; print " [+|-]k Echo kicks \n"; *************** *** 232,235 **** --- 244,250 ---- $echo_topic = 1; } + if( !defined( $daemonize ) ) { + $daemonize = 0; + } # Override config file settings with command line args where req'd. *************** *** 270,277 **** --- 285,301 ---- $interface_address = $set_interface_address; } + if ( $set_daemonize != $unused_option ) { + $daemonize = $set_daemonize; + } + # Actual IRC object... my $irc = Net::IRC->new(); print "Created Net::IRC object\n"; + + if ( $daemonize ) { + require Proc::Daemon; + Proc::Daemon::Init(); + } # Actual IRC connections kept here, kinda... |