home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.madoka.org
/
2014.12.ftp.madoka.org.tar
/
ftp.madoka.org
/
pub
/
plum
/
2.x
/
plum2_15_2.lzh
/
module
/
log
/
recent.plm
< prev
next >
Wrap
Text File
|
1997-12-07
|
7KB
|
242 lines
# <!-- -*- perl -*-
# $Id: recent.plm,v 2.3 1997/12/07 14:11:35 hasegawa Exp $
# copyright (c)1997 pupu_j <hasegawa@agusa.nuie.nagoya-u.ac.jp>
package log_recent;
$HEADER = '%H:%M';
$LINE = 50;
$SAVE = &'list('privmsg');
$_ = 'log_recent';
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, $chan, $msg) = @_;
local($nick, $vchan);
if (&savecommand($'userno[$serverno], $cmd)) {
$nick = &'prefix($prefix);
if ($chan =~ /^[\#\&\+\-]/) {
$vchan = &'alias($chan);
if (&'exist($'nameslist{$'userno[$serverno], $chan}, $nick, "\+$nick", "\@$nick")) {
&writelog($'userno[$serverno], "<$vchan:$nick> $msg");
} else {
&writelog($'userno[$serverno], "($vchan:$nick) $msg");
}
} else {
&writelog($'userno[$serverno], "=$nick= $msg");
}
}
return ($prefix, $cmd, $chan, $msg);
}
sub ss_notice {
local($serverno, $prefix, $cmd, $chan, $msg) = @_;
local($nick, $vchan);
if (&savecommand($'userno[$serverno], $cmd)) {
$nick = &'prefix($prefix);
if ($chan =~ /^[\#\&\+\-]/) {
$vchan = &'alias($chan);
if (&'exist($'nameslist{$'userno[$serverno], $chan}, $nick, "\+$nick", "\@$nick")) {
&writelog($'userno[$serverno], "<$vchan:$nick> $msg");
} else {
&writelog($'userno[$serverno], "($vchan:$nick) $msg");
}
} else {
&writelog($'userno[$serverno], "=$nick= $msg");
}
}
return ($prefix, $cmd, $chan, $msg);
}
sub ss_join {
local($serverno, $prefix, $cmd, $chan) = @_;
local($nick, $name, $mode, $vchan);
if (&savecommand($'userno[$serverno], $cmd)) {
$nick = &'prefix($prefix);
($name, $mode) = (split(/\cG/, $chan), '');
$vchan = &'alias($name);
if (index($mode, 'o') != -1) {
&writelog($'userno[$serverno], "+ \@$nick ($prefix) to $vchan");
} elsif (index($mode, 'v') != -1) {
&writelog($'userno[$serverno], "+ +$nick ($prefix) to $vchan");
} else {
&writelog($'userno[$serverno], "+ $nick ($prefix) to $vchan");
}
}
return ($prefix, $cmd, $chan);
}
sub ss_part {
local($serverno, $prefix, $cmd, $chan, $msg) = @_;
local($nick, $vchan);
if (&savecommand($'userno[$serverno], $cmd)) {
$nick = &'prefix($prefix);
$vchan = &'alias($chan);
$msg = '' unless $msg;
&writelog($'userno[$serverno], "- $nick from $vchan ($msg)");
}
return ($prefix, $cmd, $chan, $msg);
}
sub ss_kick {
local($serverno, $prefix, $cmd, $chan, $whom, $msg) = @_;
local($nick, $vchan);
if (&savecommand($'userno[$serverno], $cmd)) {
$nick = &'prefix($prefix);
$vchan = &'alias($chan);
&writelog($'userno[$serverno], "- $whom by $nick from $vchan ($msg)");
}
return ($prefix, $cmd, $chan, $whom, $msg);
}
sub ss_invite {
local($serverno, $prefix, $cmd, $me, $chan) = @_;
local($nick, $vchan);
if (&savecommand($'userno[$serverno], $cmd)) {
$nick = &'prefix($prefix);
$vchan = &'alias($chan);
&writelog($'userno[$serverno], "Invited by $nick: $vchan");
}
return ($prefix, $cmd, $me, $chan);
}
sub ss_mode {
local($serverno, $prefix, $cmd, $chan, @modes) = @_;
local($nick, $vchan);
if (&savecommand($'userno[$serverno], $cmd)) {
$nick = &'prefix($prefix);
$vchan = &'alias($chan);
&writelog($'userno[$serverno], "Mode by $nick: $vchan " . join(' ', @modes));
}
return ($prefix, $cmd, $chan, @modes);
}
sub ss_nick {
local($serverno, $prefix, $cmd, $newnick) = @_;
local($nick);
if (&savecommand($'userno[$serverno], $cmd)) {
$nick = &'prefix($prefix);
if ($nick eq $'nick[$serverno] || $newnick eq $'nick[$serverno]) {
&writelog($'userno[$serverno], "My nick is changed ($nick -> $newnick)");
} else {
&writelog($'userno[$serverno], "$nick -> $newnick");
}
}
return ($prefix, $cmd, $newnick);
}
sub ss_quit {
local($serverno, $prefix, $cmd, $msg) = @_;
local($nick);
if (&savecommand($'userno[$serverno], $cmd)) {
$nick = &'prefix($prefix);
&writelog($'userno[$serverno], "! $nick ($msg)");
}
return ($prefix, $cmd, $msg);
}
sub ss_topic {
local($serverno, $prefix, $cmd, $chan, $topic) = @_;
local($nick, $vchan);
if (&savecommand($'userno[$serverno], $cmd)) {
$nick = &'prefix($prefix);
$vchan = &'alias($chan);
&writelog($'userno[$serverno], "Topic of channel $vchan by $nick: $topic");
}
return ($prefix, $cmd, $chan, $topic);
}
sub sp_privmsg {
local($serverno, $prefix, $cmd, $chan, $msg) = @_;
local($vchan);
if (&savecommand($'userno[$serverno], $cmd)) {
$vchan = &'alias($chan);
&writelog($'userno[$serverno], ">$vchan:$'nick[$serverno]< $msg");
}
return ($prefix, $cmd, $chan, $msg);
}
sub savecommand {
local($userno, $cmd) = @_;
local($save);
$save = &'property($userno, 'save');
if (defined($save)) {
$save = '';
foreach $mask (&'property($userno, 'save')) {
$save = &'add($save, split(/\,/, "\L$mask\U"));
}
} else {
$save = $SAVE;
}
return &'exist($save, "\L$cmd\E");
}
sub writelog {
local($userno, $log) = @_;
local(@log, $header, $line);
$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 (scalar(@log) > $line) {
shift(@log);
}
$recent[$userno] = &'list(@log);
}
__END__
--><!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML><HEAD><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
<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
<DT> log.recent.line $B9T?t(B
<DD> $B%m%0$r;D$99T?t$r;XDj$7$^$9!#(B
$B%G%U%)%k%H$G$O(B50$B9T$G$9!#(B
<DT> log.recent.save ({invite|join|kick|mode|nick|notice|part|privmsg|quit|topic})
<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
</DL>
<HR><H3> $B@_DjNc(B </H3>
<PRE>
log.recent.header: %H%M%S
log.recent.save: 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>