[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: greeting routine request
- Date: Wed, 26 Jan 2000 01:18:25 +0900
- From: Simon Cozens <simon@brecon.co.uk>
- Subject: Re: greeting routine request
On Tue, Jan 25, 2000 at 08:07:57AM -0800, mapoole wrote:
> Could someone add an only welcome recent on_joins?
No.
diff -ruN ../infobot-oxford/src/Irc.pl ./src/Irc.pl
--- ../infobot-oxford/src/Irc.pl Thu Jan 6 23:54:02 2000
+++ ./src/Irc.pl Wed Jan 26 01:12:51 2000
@@ -141,6 +141,7 @@
} else {
&status(">>> $nick ($user\@$host) has joined $chan");
}
+ &IrcNickHook($nick,$chan);
} elsif ($type=~/QUIT/) {
$chan=~s/\r//;
if ($chan=~/^([\d\w\_\-\/]+\.[\.\d\w\_\-\/]+)\s([\d\w\_\-\/]+\.[\.\d\w\_\-\/]+)$/) {
diff -ruN ../infobot-oxford/src/IrcHooks.pl ./src/IrcHooks.pl
--- ../infobot-oxford/src/IrcHooks.pl Thu Jan 6 23:54:02 2000
+++ ./src/IrcHooks.pl Wed Jan 26 01:14:40 2000
@@ -54,6 +54,11 @@
return;
}
+sub IrcJoinHook {
+ my($nick, $where) = @_;
+ $joined{$nick}=20;
+}
+
sub hook_dcc_request {
my($type, $text) = @_;
if ($type =~ /chat/i) {
diff -ruN ../infobot-oxford/src/Process.pl ./src/Process.pl
--- ../infobot-oxford/src/Process.pl Wed Jan 26 01:17:29 2000
+++ ./src/Process.pl Wed Jan 26 01:16:24 2000
@@ -9,6 +9,10 @@
$origMessage = $message;
$message =~ s/[\cA-\c_]//ig; # strip control characters
+ for (keys %joined) {
+ delete $joined{$_} if --$joined{$_}<1;
+ }
+
$addressed = 0;
return if $instance =~ /antihelp/;
@@ -529,7 +533,7 @@
}
my($r) = $hello[int(rand(@hello))];
- if ($msgType =~ /public/) {
+ if ($msgType =~ /public/ and exists $joined{$who}) {
&performSay($r.", $who");
} else {
&msg($who, $r);