[Relay-bot-cvs] CVS: relay-bot relay-bot.pl,1.34,1.35
Brought to you by:
freiheit
From: Eric E. <fre...@us...> - 2002-10-16 00:16:06
|
Update of /cvsroot/relay-bot/relay-bot In directory usw-pr-cvs1:/tmp/cvs-serv25085 Modified Files: relay-bot.pl Log Message: Moved the checks for the "echo_" config items (except the on_join which also handles ops) down to the spot where the subroutines are bound to Net::IRC; more efficient to simply not call the subroutine at all if you don't want to use it, than to check at the beginning of the subroutine if it should run. Index: relay-bot.pl =================================================================== RCS file: /cvsroot/relay-bot/relay-bot/relay-bot.pl,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -r1.34 -r1.35 *** relay-bot.pl 16 Oct 2002 00:05:28 -0000 1.34 --- relay-bot.pl 16 Oct 2002 00:15:59 -0000 1.35 *************** *** 564,568 **** # Look at the topic for a channel you join. sub on_topic { - return unless $config{echo_topic}; my ($self, $event) = @_; my @args = $event->args(); --- 564,567 ---- *************** *** 613,623 **** } ! print "Adding topic handler\n"; ! for (@irc) { ! $_->add_handler('topic', \&on_topic); } sub public_msg { - return unless $config{echo_public_msg}; my $self = shift; my $event = shift; --- 612,623 ---- } ! if ($config{echo_topic}) { ! print "Adding topic handler\n"; ! for (@irc) { ! $_->add_handler('topic', \&on_topic); ! } } sub public_msg { my $self = shift; my $event = shift; *************** *** 662,666 **** sub public_action { - return unless $config{echo_public_action}; my ($self, $event) = @_; my ($nick, @args) = ($event->nick, $event->args); --- 662,665 ---- *************** *** 690,694 **** sub private_msg { - return unless $config{echo_private_msg}; my $self = shift; my $event = shift; --- 689,692 ---- *************** *** 779,783 **** sub on_nick_change { - return unless $config{echo_nick}; my $self = shift; my $event = shift; --- 777,780 ---- *************** *** 800,804 **** sub on_part { - return unless $config{echo_part}; my $self = shift; my $event = shift; --- 797,800 ---- *************** *** 825,829 **** sub on_kick { - return unless $config{echo_kick}; my $self = shift; my $event = shift; --- 821,824 ---- *************** *** 844,849 **** } ! sub on_mode { ! return unless $config{echo_cmode}; my $self = shift; my $event = shift; --- 839,843 ---- } ! sub on_cmode { my $self = shift; my $event = shift; *************** *** 863,867 **** sub on_umode { - return unless $config{echo_umode}; my $self = shift; my $event = shift; --- 857,860 ---- *************** *** 881,885 **** sub on_quit { - return unless $config{echo_quit}; my $self = shift; my $event = shift; --- 874,877 ---- *************** *** 900,913 **** print "Adding other handlers\n"; for (@irc) { ! $_->add_handler('public', \&public_msg); ! $_->add_handler('msg', \&private_msg); ! $_->add_handler('caction', \&public_action); $_->add_handler('join', \&on_join); ! $_->add_handler('part', \&on_part); ! $_->add_handler('nick', \&on_nick_change); ! $_->add_handler('kick', \&on_kick); ! $_->add_handler('mode', \&on_mode); ! $_->add_handler('umode', \&on_umode); ! $_->add_handler('quit', \&on_quit); } --- 892,925 ---- print "Adding other handlers\n"; for (@irc) { ! if ($config{echo_public_msg}) { ! $_->add_handler('public', \&public_msg); ! } ! if ($config{echo_public_action}) { ! $_->add_handler('caction', \&public_action); ! } ! if($config{echo_private_msg}) { ! $_->add_handler('msg', \&private_msg); ! } ! $_->add_handler('join', \&on_join); ! ! if($config{echo_part}) { ! $_->add_handler('part', \&on_part); ! } ! if($config{echo_nick}) { ! $_->add_handler('nick', \&on_nick_change); ! } ! if($config{echo_kick}) { ! $_->add_handler('kick', \&on_kick); ! } ! if($config{echo_cmode}) { ! $_->add_handler('mode', \&on_cmode); ! } ! if($config{echo_umode}) { ! $_->add_handler('umode', \&on_umode); ! } ! if($config{echo_quit}) { ! $_->add_handler('quit', \&on_quit); ! } } |