if (defined $l and &IsChanConf("chanlimitcheck")) {
my $plus = &getChanConfDefault("chanlimitcheckPlus", 5, $chan);
my $count = scalar(keys %{ $channels{$chan}{''} });
- &DEBUG("plus = $plus, count = $count");
- my $delta = $count + $plus - $l;
- $delta =~ s/^\-//;
- &DEBUG(" delta => $delta");
+
+ my $delta = $count + $plus - $l;
+ $delta =~ s/^\-//;
if ($plus <= 3) {
&WARN("clc: stupid to have plus at $plus, fix it!");
my ($user,$host) = split(/\@/, $event->userhost);
$chan = lc( ($event->to)[0] ); # CASING!!!!
$who = $event->nick();
+# doesn't work properly, for news :(
+# $msgType = "private"; # for &IsChanConf().
$chanstats{$chan}{'Join'}++;
$userstats{lc $who}{'Join'} = time() if (&IsChanConf("seenStats"));
last;
}
+ # no need to go further.
+ return if ($netsplit);
+
### ROOTWARN:
&rootWarn($who,$user,$host,$chan)
if (&IsChanConf("rootWarn") &&
$channels{$chan}{'o'}{$ident});
### NEWS:
+ # why isn't this "enabled" just as someone joins?
+
if (&IsChanConf("news") && &IsChanConf("newsKeepRead")) {
- # todo: what if it hasn't been loaded?
- &News::latest($chan);
+ if (!&loadMyModule("news")) { # just in case.
+ &DEBUG("could not load news.");
+ } else {
+ &News::latest($chan);
+ }
}
### chanlimit check.
### .* wait (\d+) second/) {
&status("on_ttf: X1 $msg") if (defined $msg);
my $sleep = 5;
- &status("going to sleep for $sleep...");
+ &status("targettoofast: going to sleep for $sleep...");
sleep $sleep;
&joinNextChan();
### }
&seenFlushOld(2);
&ircCheck(1); # mandatory
&miscCheck(1); # mandatory
- &miscCheck2(1); # mandatory
+ &miscCheck2(2); # mandatory
&shmFlush(1); # mandatory
&slashdotLoop(2);
&freshmeatLoop(2);
if (&IsNickInAnyChan($_)) {
&DEBUG("netsplitC: $_ is in some chan; removing from netsplit list.");
delete $netsplit{$_};
+ next;
}
next unless (time() - $netsplit{$_} > 60*10);
return;
}
- $chan = $chans[0];
+ $chan = $chans[0];
&::DEBUG("Guessed $::who being on chan $chan");
+ $::chan = $chan; # hack for IsChanConf().
}
if (!defined $what or $what =~ /^\s*$/) {
&read($2);
} elsif ($what =~ /^(latest|new)(\s+(.*))?$/i) {
- &::DEBUG("latest called... hrm");
&latest($3 || $chan, 1);
} elsif ($what =~ /^list$/i) {
return;
}
+ if (&::IsChanConf("newsNotifyAll") and !defined $t) {
+# $::newsuser{$chan}{$::who} = 1;
+ $t = 1;
+ }
+
+ if (!defined $t) {
+ &::DEBUG("something went really wrong.");
+ &::msg($::who, "something went really wrong.");
+ return;
+ }
+
my @new;
foreach (keys %{ $::news{$chan} }) {
- if (&::IsChanConf("newsNotifyAll") and !defined $t) {
- &::DEBUG("setting time for $::who to 1...");
- $::newsuser{$chan}{$::who} = 1;
- $t = 1;
- }
next if (!defined $t);
next if ($t > $::news{$chan}{$_}{Time});
&::msg($::who, "+==== New news for \002$chan\002 (".
scalar(@new)." new items):");
- my $timestr = &::Time2String( time() - $::newsuser{$chan}{$::who} );
- &::msg($::who, "|= Last time read $timestr ago");
+ if ($::newsuser{$chan}{$::who}) {
+ my $timestr = &::Time2String( time() - $::newsuser{$chan}{$::who} );
+ &::msg($::who, "|= Last time read $timestr ago");
+ }
+ my @sorted;
foreach (@new) {
my $i = &newsS2N($_);
- my $age = time() - $::news{$chan}{$_}{Time};
+ $sorted[$i] = $_;
+ }
+
+ for (my $i=0; $i<=scalar(@sorted); $i++) {
+ my $news = $sorted[$i];
+ next unless (defined $news);
+
+ my $age = time() - $::news{$chan}{$news}{Time};
&::msg($::who, sprintf("\002[\002%2d\002]\002 %s",
- $i, $_) );
+ $i, $news) );
# $i, $_, &::Time2String($age) ) );
}
sub newsS2N {
my($what) = @_;
+ my $item = 0;
my @items;
my $no;
### TODO: VERBOSITY on how chanconf returned 1 or 0 or -1.
my %chan = &getChanConfList($param);
if (!defined $msgType) {
+# &DEBUG("icc: !def msgType...");
return $chan{_default} || 0;
}
if ($msgType eq "public") {
+ if ($chan{lc $chan}) {
+# &DEBUG("iCC: public: $chan/$param");
+ } elsif ($chan{_default}) {
+# &DEBUG("iCC: public: _default/$param")
+ } else {
+# &DEBUG("iCC: public: 0/$param");
+ }
+
return $chan{lc $chan} || $chan{_default} || 0;
}
if ($msgType eq "private") {
- return $chan{_default} || 0;
+ if ($chan{_default}) {
+# &DEBUG("iCC: private: _default/$param");
+ } elsif ($chan{lc $chan}) {
+# &DEBUG("iCC: private: $chan/$param");
+ } else {
+# &DEBUG("iCC: private: 0/$param");
+ }
+
+ return $chan{lc $chan} || $chan{_default} || 0;
}
### debug purposes only.
# &DEBUG(" $_ => $chan{$_}");
# }
+ &DEBUG("icc: returning 0...");
+
return 0;
}