# works? needs to actually do something
# should likely listen on a tcp port instead
- #$irc->addfh(STDIN, \&on_stdin, "r");
+ #$irc->addfh(STDIN, \&on_stdin, 'r');
&status("starting main loop");
my ($buf) = @_;
$buf =~ s/\n//gi;
- # slow down a bit if traffic is "high".
+ # slow down a bit if traffic is 'high'.
# need to take into account time of last message sent.
if ($last{buflen} > 256 and length($buf) > 256) {
sleep 1;
my ($msg) = @_;
my $mynick = $conn->nick();
if (!defined $msg) {
- $msg ||= "NULL";
+ $msg ||= 'NULL';
&WARN("say: msg == $msg.");
return;
}
+ if (&getChanConf('silent', $talkchannel)) {
+ &DEBUG("say: silent in $talkchannel, not saying $msg");
+ return;
+ }
+
if ( $postprocess ) {
undef $postprocess;
} elsif ($postprocess = &getChanConf('postprocess', $talkchannel)) {
&DEBUG("say: $postprocess $msg");
- &parseCmdHook("main", $postprocess . ' ' . $msg);
- &parseCmdHook("extra", $postprocess . ' ' . $msg);
+ &parseCmdHook($postprocess . ' ' . $msg);
undef $postprocess;
return;
}
return unless (&whatInterface() =~ /IRC/);
- $msg = "zero" if ($msg =~ /^0+$/);
+ $msg = 'zero' if ($msg =~ /^0+$/);
my $t = time();
$pubcount++;
$pubsize += length $msg;
- my $i = &getChanConfDefault("sendPublicLimitLines", 3);
- my $j = &getChanConfDefault("sendPublicLimitBytes", 1000);
+ my $i = &getChanConfDefault('sendPublicLimitLines', 3, $chan);
+ my $j = &getChanConfDefault('sendPublicLimitBytes', 1000, $chan);
if ( ($pubcount % $i) == 0 and $pubcount) {
sleep 1;
}
if (!defined $msg) {
- $msg ||= "NULL";
+ $msg ||= 'NULL';
&WARN("msg: msg == $msg.");
return;
}
+ # some say() end up here (eg +help)
+ if (&getChanConf('silent', $nick)) {
+ &DEBUG("msg: silent in $nick, not saying $msg");
+ return;
+ }
+
&status(">$nick< $msg");
return unless (&whatInterface() =~ /IRC/);
$msgcount++;
$msgsize += length $msg;
- my $i = &getChanConfDefault("sendPrivateLimitLines", 3);
- my $j = &getChanConfDefault("sendPrivateLimitBytes", 1000);
+ my $i = &getChanConfDefault('sendPrivateLimitLines', 3, $chan);
+ my $j = &getChanConfDefault('sendPrivateLimitBytes', 1000, $chan);
if ( ($msgcount % $i) == 0 and $msgcount) {
sleep 1;
} elsif ($msgsize > $j) {
return;
}
+ if (&getChanConf('silent', $target)) {
+ &DEBUG("action: silent in $target, not doing $txt");
+ return;
+ }
+
if (length $txt > 480) {
&status("action: txt too long; truncating.");
chop($txt) while (length $txt > 480);
$notcount++;
$notsize += length $txt;
- my $i = &getChanConfDefault("sendNoticeLimitLines", 3);
- my $j = &getChanConfDefault("sendNoticeLimitBytes", 1000);
+ my $i = &getChanConfDefault('sendNoticeLimitLines', 3, $chan);
+ my $j = &getChanConfDefault('sendNoticeLimitBytes', 1000, $chan);
if ( ($notcount % $i) == 0 and $notcount) {
sleep 1;
sub joinchan {
my ($chan, $key) = @_;
- $key ||= &getChanConf("chankey", $chan);
- $key ||= "";
+ $key ||= &getChanConf('chankey', $chan);
+ $key ||= '';
# forgot for about 2 years to implement channel keys when moving
# over to Net::IRC...
my $chan;
foreach $chan (@_) {
- next if ($chan eq "");
+ next if ($chan eq '');
$chan =~ tr/A-Z/a-z/; # lowercase.
if ($chan !~ /^$mask{chan}$/) {
sub op {
my ($chan, @who) = @_;
- my $os = "o" x scalar(@who);
+ my $os = 'o' x scalar(@who);
&mode($chan, "+$os @who");
}
sub deop {
my ($chan, @who) = @_;
- my $os = "o" x scalar(@who);
+ my $os = 'o' x scalar(@who);
&mode($chan, "-$os ".@who);
}
sub kick {
my ($nick,$chan,$msg) = @_;
- my (@chans) = ($chan eq "") ? (keys %channels) : lc($chan);
+ my (@chans) = ($chan eq '') ? (keys %channels) : lc($chan);
my $mynick = $conn->nick();
- if ($chan ne "" and &validChan($chan) == 0) {
+ if ($chan ne '' and &validChan($chan) == 0) {
&ERROR("kick: invalid channel $chan.");
return;
}
}
# chanserv check: global channels, in case we missed one.
- foreach ( &ChanConfList("chanServ_ops") ) {
+ foreach ( &ChanConfList('chanServ_ops') ) {
&chanServCheck($_);
}
}
my $nick = $conn->nick();
foreach (keys %chanconf) {
- next if ($_ eq "_default");
+ next if ($_ eq '_default');
my $skip = 0;
my $val = $chanconf{$_}{autojoin};
if (defined $val) {
- $skip++ if ($val eq "0");
- if ($val eq "1") {
+ $skip++ if ($val eq '0');
+ if ($val eq '1') {
# convert old +autojoin to autojoin <nick>
- $val = $nick;
+ $val = lc $nick;
$chanconf{$_}{autojoin} = $val;
}
- $skip++ if ($val ne $nick);
+ $skip++ if (lc $val ne lc $nick);
} else {
$skip++;
}
sub joinfloodCheck {
my($who,$chan,$userhost) = @_;
- return unless (&IsChanConf("joinfloodCheck"));
+ return unless (&IsChanConf('joinfloodCheck') > 0);
if (exists $netsplit{lc $who}) { # netsplit join.
&DEBUG("joinfloodCheck: $who was in netsplit; not checking.");