]> git.donarmstrong.com Git - infobot.git/blobdiff - src/IRC/IrcHooks.pl
don't allow those without HOSTS in the user file to DCC CHAT.
[infobot.git] / src / IRC / IrcHooks.pl
index 2c93f495a58d6f59435ee4fa0add7b9cb1adf8eb..a1b710f2ad9887232caee0c2a85149d36c63f6cc 100644 (file)
@@ -238,13 +238,23 @@ sub on_dcc_open {
     $type ||= "???";
 
     if ($type eq 'SEND') {
+
        &status("${b_green}DCC lGET$ob established with $b_cyan$nick$ob");
+
     } elsif ($type eq 'CHAT') {
+
        &status("${b_green}DCC CHAT$ob established with $b_cyan$nick$ob $b_yellow($ob$nuh{$nick}$b_yellow)$ob");
+
        &verifyUser($nick, $nuh{lc $nick});
+
+       if (!exists $users{$userHandle}{HOSTS}) {
+           &pSReply("you have no hosts defined in my user file; rejecting.");
+           ### TODO: $sock->close();
+           return;
+       }
+
        my $crypto      = $users{$userHandle}{PASS};
        $dcc{'CHAT'}{$nick} = $sock;
-
        foreach (keys %{ $users{$userHandle} }) {
            &VERB("   $_ => $users{$userHandle}{$_}",2);
        }
@@ -255,12 +265,16 @@ sub on_dcc_open {
        } else {
            &dccsay($nick,"Welcome to blootbot DCC CHAT interface, $userHandle.");
        }
+
     } elsif ($type eq 'SEND') {
+
        &DEBUG("Starting DCC receive.");
        foreach ($event->args) {
            &DEBUG("  => '$_'.");
        }
+
     } else {
+
        &WARN("${b_green}DCC $type$ob (3)");
     }
 }