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
/
daily.plm
< prev
next >
Wrap
Text File
|
1997-11-21
|
9KB
|
286 lines
# <!-- -*- perl -*-
# $Id: daily.plm,v 2.2 1997/11/22 01:52:26 hasegawa Exp $
# copyright (c)1997 pupu_j <hasegawa@agusa.nuie.nagoya-u.ac.jp>
package log_daily;
$DIRECTORY = '.';
$FILE = 'log%m%d';
$HEADER = '%H:%M';
$MODE = umask() ^ 0666;
$SAVE = &'list('privmsg', 'join', 'part', 'kick' ,'invite', 'mode', 'nick', 'quit', 'topic');
$_ = 'log_daily';
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, $msg) = @_;
local($file, $directory, $name, $header, $mode, $kanji);
$file = &'property($userno, 'file');
$file = $FILE unless defined($file);
$file = &'expand($file);
if ($file =~ /^\//) {
$name = $file;
} else {
$directory = &'property($userno, 'directory');
$directory = $DIRECTORY unless defined($directory);
$directory = &'expand($directory);
$directory .= '/' unless $directory =~ /\/$/;
$name = $directory . $file;
}
$name = &'date($name);
$header = &'property($userno, 'header');
$header = $HEADER unless defined($header);
$header = &'date($header);
$kanji = &'property($userno, 'kanji') || '';
if ("\L$kanji\E" eq 'euc') {
$msg = &'jis_euc($msg);
} elsif ("\L$kanji\E" eq 'jis') {
$msg = &'jis_jis($msg);
} elsif ("\L$kanji\E" eq 'sjis') {
$msg = &'jis_sjis($msg);
}
if (!-w $name) {
if (!-f $name && open(FILE, ">$name")) {
close(FILE);
}
$mode = &'property($userno, 'mode');
if (defined($mode)) {
$mode = oct($mode) | 0200;
} else {
$mode = $MODE | 0200;
}
chmod($mode, $name) if -f $name;
}
if (open(FILE, ">>$name")) {
select((select(FILE), $| = 1)[0]);
print FILE $header, ' ', $msg, "\n";
close(FILE);
}
}
__END__
--><!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML><HEAD><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
<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
<DT> log.daily.file $B%U%!%$%kL>(B
$B%m%0$rJ]B8$9$k%U%!%$%k$r;XDj$7$^$9!#(B
%$B$G$O$8$^$kJ8;z$,$"$k$HBP1~$9$kF|IU$KJQ49$5$l$^$9!#(B
$B%G%U%)%k%H$G$O!V(Blog%m%d$B!W$G$9!#(B
<DT> log.daily.header $B$X%C%@(B
<DD> $B%m%0$K=PNO$9$k;~9o$N%U%)!<%^%C%H$r;XDj$7$^$9!#(B
%$B$G$O$8$^$kJ8;z$,$"$k$HBP1~$9$k;~4V$KJQ49$5$l$^$9!#(B
$B%G%U%)%k%H$G$O!V(B%H:%M$B!W$G$9!#(B
<DT> log.daily.mode $B%U%!%$%k%b!<%I(B
<DD> $B%m%0$N%U%!%$%k%b!<%I$r$3$3$G;XDj$7$?CM$K$7$^$9!#(B
<DT> log.daily.kanji {euc|jis|sjis}
<DD> $B=PNO$9$k%m%0$N4A;z%3!<%I$r;XDj$7$^$9!#(B
$B%G%U%)%k%H$G$O(BJIS$B$G=PNO$7$^$9!#(B
<DT> log.daily.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(Bnotice$B!W0J30$N$9$Y$F$G$9!#(B
</DL>
<HR><H3> $B@_DjNc(B </H3>
<PRE>
+ log/daily.plm
log.daily.file: log/log%y%m%d
log.daily.kanji: euc
</PRE>
$B%m%0$r!V(Blog/log%y%m%d$B!W$KJ]B8$7$^$9!#$^$?!"%m%0$N4A;z%3!<%I$r(BEUC$B$K$7$^$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.save: 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
</BODY></HTML>