From: dms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Date: Sat, 16 Dec 2000 12:29:36 +0000 (+0000)
Subject: - &dccsay() added.
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=eb25f4cda97370a6ae49e7e37e4a0372ad2df7c3;p=infobot.git

- &dccsay() added.
- &dcc_close() added.
- use dccsay in performStrictReply()


git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@201 c11ca15a-4712-0410-83d8-924469b57eb5
---

diff --git a/blootbot/src/IRC/Irc.pl b/blootbot/src/IRC/Irc.pl
index 2f3b3b4..8232a22 100644
--- a/blootbot/src/IRC/Irc.pl
+++ b/blootbot/src/IRC/Irc.pl
@@ -202,6 +202,10 @@ sub msg {
     }
     $last{msg} = $msg;
 
+    if ($msg =~ /\cB/) {
+	&status("^B hrm.");
+    }
+
     &status(">$nick< $msg");
     $conn->privmsg($nick, $msg) if (&whatInterface() =~ /IRC/);
 }
@@ -301,11 +305,7 @@ sub performStrictReply {
     } elsif ($msgType eq 'public') {
 	&say($reply);
     } elsif ($msgType eq 'chat') {
-	if (!exists $dcc{'CHAT'}{$who}) {
-	    &WARN("pSR: dcc{'CHAT'}{$who} does not exist.");
-	    return;
-	}
-	$conn->privmsg($dcc{'CHAT'}{$who}, $reply);
+	&dccsay($who,$reply);
     } else {
 	&ERROR("pSR: msgType invalid? ($msgType).");
     }
@@ -313,6 +313,28 @@ sub performStrictReply {
     return '';
 }
 
+sub dccsay {
+    my ($who, $reply) = @_;
+    if (!exists $dcc{'CHAT'}{$who}) {
+	&WARN("pSR: dcc{'CHAT'}{$who} does not exist.");
+	return '';
+    }
+
+    $conn->privmsg($dcc{'CHAT'}{$who}, $reply);
+}
+
+sub dcc_close {
+    my($who) = @_;
+    my $type;
+
+    foreach $type (keys %dcc) {
+	&FIXME("dcc_close: $who");
+	my @who = grep /^\Q$who\E$/i, keys %{$dcc{$type}};
+	next unless (scalar @who);
+	$who = $who[0];
+    }
+}
+
 sub joinchan {
     my ($chankey) = @_;
     my $chan = lc $chankey;
@@ -599,10 +621,14 @@ sub makeChanList {
 }
 
 sub closeDCC {
+    &DEBUG("closeDCC called.");
+
     foreach $type (keys %dcc) {
+	next if ($type ne uc($type));
+ 
 	foreach (keys %{$dcc{$type}}) {
 	    &DEBUG("closing DCC $type to $_ (FIXME).");
-###	    $irc->removeconn($dcc{$type}{$_});
+	    $dcc{$type}{$_}->close();
 	}
     }
 }