home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.madoka.org
/
2014.12.ftp.madoka.org.tar
/
ftp.madoka.org
/
pub
/
plum
/
plum2_33_1.lzh
/
module
/
log
/
daily.plm
< prev
next >
Wrap
Text File
|
1999-03-24
|
10KB
|
339 lines
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><!-- $_ if 0; # -*- perl -*-
# $Id: daily.plm,v 2.30 1999/02/04 13:52:14 hasegawa Exp $
# copyright (c)1997-1999 Yoshinori Hasegawa <hasegawa@madoka.org>
package log_daily;
$DIRECTORY = '.';
$FILE = 'log%m%d';
$HEADER = '%H:%M';
$COMMAND = &'list('privmsg', 'join', 'part', 'kick' ,'invite', 'mode', 'nick', 'quit', 'topic');
$_ = 'log_daily';
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($fileno, $msg) = @_;
local($userno, $file, $name, $code, $dir, $name, $header, $mode);
$userno = $'userno[$fileno];
$file = &'property($userno, 'file') || $FILE;
($name, $code) = &filename($file);
if ($name !~ /^[\\\/]/) {
$dir = &'expand(&'property($userno, 'directory') || $DIRECTORY);
$name = "$dir/$name";
}
$name = &'date($name);
$header = &'property($userno, 'header');
$header = $HEADER unless defined($header);
$header = &'date($header);
$msg = &jis_code($msg, $code) if $code;
if (!-e $name) {
if (open(FILE, ">$name")) {
close(FILE);
$mode = &'property($userno, 'mode');
if (defined($mode)) {
chmod(oct($mode), $name);
}
}
}
if (open(FILE, ">>$name")) {
print FILE $header, ' ', $msg, "\n";
close(FILE);
}
}
sub filename {
local($file) = @_;
local($idx, $name, $code);
return ('', '') unless $file;
if (($idx = rindex($file, ';')) != -1) {
$name = substr($file, 0, $idx);
$code = substr($file, $idx + 1);
} else {
$name = $file;
$code = '';
}
return (&'expand($name), $code);
}
sub jis_code {
local($line, $list) = @_;
local($code);
$code = (split(/\,/, "\L$list\E"))[0];
if ($code eq 'euc') {
$line = &'jis_euc($line);
} elsif ($code eq 'jis') {
$line = &'jis_jis($line);
} elsif ($code eq 'sjis') {
$line = &'jis_sjis($line);
}
return $line;
}
__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/daily.plm</TITLE></HEAD><BODY>
$B%*%s%i%$%s%I%-%e%a%s%H(B
<HR><H3>$BL>A0(B</H3>
log/daily.plm - $B%a%C%;!<%8$r%m%0$KJ]B8$9$k(B
<HR><H3>$B@bL@(B</H3>
$B%m%0$r;XDj$7$?%U%!%$%k$KJ]B8$7$^$9!#(B
<HR><H3>$B%W%m%Q%F%#(B</H3>
<DL>
<DT> log.daily.directory $B%G%#%l%/%H%j(B
</DT>
<DD> $B%m%0$r:n@.$9$k%G%#%l%/%H%j$r;XDj$7$^$9!#(B
$B%G%#%l%/%H%j$O(Bplum$B$r<B9T$7$?%G%#%l%/%H%j$+$i$NAjBP%Q%9$K$J$j$^$9!#(B
UNIX$B$J$i!V(B~/$B!W$d!V(B~user$B!W$H$$$&;XDj$b$G$-$^$9!#(B
</DD>
<DT> log.daily.file $B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9!#(B
$B!V(B%y$B!W!"!V(B%m$B!W!"!V(B%d$B!W$O$=$l$>$l8=:_$NG/!"7n!"F|$KJQ49$5$l$^$9!#(B
<PRE>
+ log/daily.plm
log.daily.file: log%+1O%m%d
log.daily.command: privmsg,topic,join,part,kick,nick
</PRE>
$BJ]B8$9$k%m%0$r!V(Bprivmsg$B!W!"!V(Btopic$B!W!"!V(Bjoin$B!W!"!V(Bpart$B!W!"!V(Bkick$B!W!"(B
$B!V(Bnick$B!W$N(B6$B<oN`$K$7$^$9!#(B
$B%m%0$N%U%!%$%k$O%+%l%s%H%G%#%l%/%H%j$N!V(Blog%m%d$B!W$K$J$j$^$9!#(B
$B!V(B%m$B!W!"!V(B%d$B!W$O$=$l$>$l8=:_$NG/!"7n!"F|$KJQ49$5$l$^$9!#(B
$B%m%0%U%!%$%k$N%U%!%$%kL>$OKhF|(B23$B;~$KMbF|$NF|IU$N$b$N$KJQ$o$j$^$9!#(B
</BODY></HTML>