+ delete $dcc{$type};
+ }
+}
+
+sub joinfloodCheck {
+ my($who,$chan,$userhost) = @_;
+
+ return unless (&IsChanConf("joinfloodCheck"));
+
+ if (exists $netsplit{lc $who}) { # netsplit join.
+ &DEBUG("joinfloodCheck: $who was in netsplit; not checking.");
+ }
+
+ if (exists $floodjoin{$chan}{$who}{Time}) {
+ &WARN("floodjoin{$chan}{$who} already exists?");
+ }
+
+ $floodjoin{$chan}{$who}{Time} = time();
+ $floodjoin{$chan}{$who}{Host} = $userhost;
+
+ ### Check...
+ foreach (keys %floodjoin) {
+ my $c = $_;
+ my $count = scalar keys %{ $floodjoin{$c} };
+ next unless ($count > 5);
+ &DEBUG("joinflood: count => $count");
+
+ my $time;
+ foreach (keys %{ $floodjoin{$c} }) {
+ $time += $floodjoin{$c}{$_}{Time};
+ }
+ &DEBUG("joinflood: time => $time");
+ $time /= $count;
+
+ &DEBUG("joinflood: new time => $time");
+ }
+
+ ### Clean it up.
+ my $delete = 0;
+ foreach $chan (keys %floodjoin) {
+ foreach $who (keys %{ $floodjoin{$chan} }) {
+ my $time = time() - $floodjoin{$chan}{$who}{Time};
+ next unless ($time > 10);
+ delete $floodjoin{$chan}{$who};
+ $delete++;
+ }
+ }
+
+ &DEBUG("joinfloodCheck: $delete deleted.") if ($delete);
+}
+
+sub getHostMask {
+ my($n) = @_;
+
+ if (exists $nuh{$n}) {
+ return &makeHostMask($nuh{$n});
+ } else {
+ $cache{on_who_Hack} = 1;
+ &rawout("WHO $n");