home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.madoka.org
/
2014.12.ftp.madoka.org.tar
/
ftp.madoka.org
/
pub
/
plum
/
2.x
/
plum2_32_1.lzh
/
module
/
log
/
recent.plm
< prev
next >
Wrap
Text File
|
1999-02-20
|
8KB
|
282 lines
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><!-- $_ if 0; # -*- perl -*-
# $Id: recent.plm,v 2.17 1999/01/20 14:51:01 hasegawa Exp $
# copyright (c)1997-1999 Yoshinori Hasegawa <hasegawa@madoka.org>
package log_recent;
$HEADER = '%H:%M';
$LINE = 50;
$COMMAND = &'list('privmsg');
$_ = 'log_recent';
sub module_disable {
local($userno) = @_;
undef($recent[$userno]);
}
sub client_open {
local($clientno) = @_;
foreach $log (&'array($recent[$'userno[$clientno]])) {
&'c_print($clientno, '', 'NOTICE', $'nick[$clientno], $log);
}
}
sub ss_privmsg {
local($serverno, $prefix, $cmd, @params) = @_;
local($nick, $vchan);
if ($params[1] && &savecommand($'userno[$serverno], $cmd)) {
$nick = &'prefix($prefix);
if (&'channel($params[0])) {
$vchan = &'alias($params[0]);
if (&'exist($'nameslist{$serverno, $params[0]}, $nick, "\+$nick", "\@$nick")) {
&writelog($serverno, "<$vchan:$nick> $params[1]");
} else {
&writelog($serverno, "($vchan:$nick) $params[1]");
}
} else {
&writelog($serverno, "=$nick= $params[1]");
}
}
return ($prefix, $cmd, @params);
}
sub ss_notice {
local($serverno, $prefix, $cmd, @params) = @_;
local($nick, $vchan);
if ($params[1] && &savecommand($'userno[$serverno], $cmd)) {
$nick = &'prefix($prefix);
if (&'channel($params[0])) {
$vchan = &'alias($params[0]);
if (&'exist($'nameslist{$serverno, $params[0]}, $nick, "\+$nick", "\@$nick")) {
&writelog($serverno, "<$vchan:$nick> $params[1]");
} else {
&writelog($serverno, "($vchan:$nick) $params[1]");
}
} else {
&writelog($serverno, "=$nick= $params[1]");
}
}
return ($prefix, $cmd, @params);
}
sub ss_join {
local($serverno, $prefix, $cmd, @params) = @_;
local($nick, $name, $mode, $vchan);
if (&savecommand($'userno[$serverno], $cmd)) {
$nick = &'prefix($prefix);
($name, $mode) = (split(/\cG/, $params[0]), '');
$vchan = &'alias($name);
if (index($mode, 'o') != -1) {
&writelog($serverno, "+ \@$nick ($prefix) to $vchan");
} elsif (index($mode, 'v') != -1) {
&writelog($serverno, "+ +$nick ($prefix) to $vchan");
} else {
&writelog($serverno, "+ $nick ($prefix) to $vchan");
}
}
return ($prefix, $cmd, @params);
}
sub ss_part {
local($serverno, $prefix, $cmd, @params) = @_;
local($nick, $vchan);
if (&savecommand($'userno[$serverno], $cmd)) {
$nick = &'prefix($prefix);
$vchan = &'alias($params[0]);
&writelog($serverno, "- $nick from $vchan ($params[1])");
}
return ($prefix, $cmd, @params);
}
sub ss_kick {
local($serverno, $prefix, $cmd, @params) = @_;
local($nick, $vchan);
if (&savecommand($'userno[$serverno], $cmd)) {
$nick = &'prefix($prefix);
$vchan = &'alias($params[0]);
&writelog($serverno, "- $params[1] by $nick from $vchan ($params[2])");
}
return ($prefix, $cmd, @params);
}
sub ss_invite {
local($serverno, $prefix, $cmd, @params) = @_;
local($nick, $vchan);
if (&savecommand($'userno[$serverno], $cmd)) {
$nick = &'prefix($prefix);
$vchan = &'alias($params[1]);
&writelog($serverno, "Invited by $nick: $vchan");
}
return ($prefix, $cmd, @params);
}
sub ss_mode {
local($serverno, $prefix, $cmd, @params) = @_;
local($nick, $vchan, @mode);
@mode = @params;
shift(@mode);
if (&savecommand($'userno[$serverno], $cmd)) {
$nick = &'prefix($prefix);
if (&'channel($params[0])) {
$vchan = &'alias($params[0]);
&writelog($serverno, "Mode by $nick: $vchan " . join(' ', @mode));
} else {
&writelog($serverno, "Mode by $nick: $params[0] " . join(' ', @mode));
}
}
return ($prefix, $cmd, @params);
}
sub ss_nick {
local($serverno, $prefix, $cmd, @params) = @_;
local($nick);
if (&savecommand($'userno[$serverno], $cmd)) {
$nick = &'prefix($prefix);
if ($nick eq $'nick[$serverno] || $params[0] eq $'nick[$serverno]) {
&writelog($serverno, "My nick is changed ($nick -\> $params[0])");
} else {
&writelog($serverno, "$nick -\> $params[0]");
}
}
return ($prefix, $cmd, @params);
}
sub ss_quit {
local($serverno, $prefix, $cmd, @params) = @_;
local($nick);
if (&savecommand($'userno[$serverno], $cmd)) {
$nick = &'prefix($prefix);
&writelog($serverno, "! $nick ($params[0])");
}
return ($prefix, $cmd, @params);
}
sub ss_topic {
local($serverno, $prefix, $cmd, @params) = @_;
local($nick, $vchan);
if (&savecommand($'userno[$serverno], $cmd)) {
$nick = &'prefix($prefix);
$vchan = &'alias($params[0]);
&writelog($serverno, "Topic of channel $vchan by $nick: $params[1]");
}
return ($prefix, $cmd, @params);
}
sub sp_privmsg {
local($serverno, $prefix, $cmd, @params) = @_;
local($chan, $vchan);
if ($params[1] && &savecommand($'userno[$serverno], $cmd)) {
foreach $chan (split(/\,/, $params[0])) {
if (&'channel($chan)) {
$vchan = &'alias($chan);
&writelog($serverno, ">$vchan:$'nick[$serverno]< $params[1]");
} else {
&writelog($serverno, ">$chan< $params[1]");
}
}
}
return ($prefix, $cmd, @params);
}
sub sp_notice {
local($serverno, $prefix, $cmd, @params) = @_;
local($chan, $vchan);
if ($params[1] && &savecommand($'userno[$serverno], $cmd)) {
foreach $chan (split(/\,/, $params[0])) {
if (&'channel($chan)) {
$vchan = &'alias($chan);
&writelog($serverno, ">$vchan:$'nick[$serverno]< $params[1]");
} else {
&writelog($serverno, ">$chan< $params[1]");
}
}
}
return ($prefix, $cmd, @params);
}
sub savecommand {
local($userno, $cmd) = @_;
local($save);
$save = &'property($userno, 'command');
if (defined($save)) {
$save = '';
foreach $mask (&'property($userno, 'command')) {
$save = &'add($save, split(/\,/, $mask));
}
} else {
$save = $COMMAND;
}
return &'exist($save, $cmd);
}
sub writelog {
local($serverno, $log) = @_;
local($userno, @log, $header, $line);
$userno = $'userno[$serverno];
$header = &'property($userno, 'header');
$header = $HEADER unless defined($header);
$header = &'date($header);
@log = &'array($recent[$userno]);
push(@log, "$header $log");
$line = &'property($userno, 'line');
$line = $LINE unless defined($line);
while (@log > $line) {
shift(@log);
}
$recent[$userno] = &'list(@log);
}
__END__
--><HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-2022-JP">
<LINK REV="made" HREF="mailto:hasegawa@madoka.org">
<TITLE>log/recent.plm</TITLE></HEAD><BODY>
$B%*%s%i%$%s%I%-%e%a%s%H(B
<HR><H3>$BL>A0(B</H3>
log/recent.plm - $B%/%i%$%"%s%H$r@\B3$7$?$H$-$K:G6a$N%a%C%;!<%8$rAw$k(B
<HR><H3>$B@bL@(B</H3>
$B:G6a$N%a%C%;!<%8$r;XDj$7$??t$@$1J]B8$7$F$*$-!"(B
$B%/%i%$%"%s%H$r@\B3$7$?$H$-$K!"$=$l$rAw$j$^$9!#(B
<HR><H3>$B%W%m%Q%F%#(B</H3>
<DL>
<DT> log.recent.header $B$X%C%@(B
</DT>
<DD> $B%m%0$N;~9o$N%U%)!<%^%C%H$r;XDj$7$^$9!#(B
%$B$G$O$8$^$kJ8;z$,$"$k$H!"BP1~$9$k;~4V$KJQ49$5$l$^$9!#(B
</DD>
<DT> log.recent.line $B9T?t(B
</DT>
<DD> $B%m%0$r;D$99T?t$r;XDj$7$^$9!#%G%U%)%k%H$G$O(B50$B9T$G$9!#(B
</DD>
<DT> log.recent.command ({invite|join|kick|mode|nick|notice|part|privmsg|quit|topic})
</DT>
<DD> $BJ]B8$9$k%a%C%;!<%8$N<oN`$r;XDj$7$^$9!#(B
$B%G%U%)%k%H$G$O!V(Bprivmsg$B!W$@$1$G$9!#(B
</DD>
</DL>
<HR><H3>$B@_DjNc(B</H3>
<PRE>
log.recent.header: %H%M%S
log.recent.command: notice,privmsg,topic
</PRE>
$B$X%C%@$r!V(B%H%M%S$B!W$K$7!"%m%0$N<oN`$r!V(Bnotice$B!W!"!V(Bprivmsg$B!W!"!V(Btopic$B!W(B
$B$N(B3$B<oN`$K$7$^$9!#(B
$B!V(B%H$B!W!"!V(B%M$B!W!"!V(B%S$B!W$O$=$l$>$l8=:_$N;~!"J,!"IC$KJQ49$5$l$^$9!#(B
</BODY></HTML>