+# really custom sub to get NUH since Net::IRC doesn't appear to support
+# it.
+sub on_dcc_open_chat {
+ my(undef, $nick, $sock) = @_;
+
+ if ($nuh{$nick} eq "GETTING-NOW") {
+ &FIXME("getting nuh for $nick failed.");
+ return;
+ }
+
+ &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.");
+ $sock->close();
+ return;
+ }
+
+ my $crypto = $users{$userHandle}{PASS};
+ $dcc{'CHAT'}{$nick} = $sock;
+
+ # todo: don't make DCC CHAT established in the first place.
+ if ($userHandle eq "_default") {
+ &dccsay($nick, "_default/guest not allowed");
+ $sock->close();
+ return;
+ }
+
+ if (defined $crypto) {
+ &status("DCC CHAT: going to use ".$nick."'s crypt.");
+ &dccsay($nick,"Enter your password.");
+ } else {
+# &dccsay($nick,"Welcome to blootbot DCC CHAT interface, $userHandle.");
+ }
+}
+