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
/
channel
/
filter.plm
< prev
Wrap
Text File
|
1999-02-20
|
7KB
|
263 lines
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><!-- $_ if 0; # -*- perl -*-
# $Id: filter.plm,v 2.4 1999/01/24 15:18:29 hasegawa Exp $
# copyright (c)1999 Yoshinori Hasegawa <hasegawa@madoka.org>
package channel_filter;
$_ = 'channel_filter';
sub module_enable {
local($userno) = @_;
foreach $cno (&'array($'clientlist)) {
next unless $'avail[$cno];
next unless $'userno[$cno] == $userno;
$visiblelist[$cno] = $'channellist[$cno];
$joinlist[$cno] = '';
}
}
sub module_disable {
local($userno) = @_;
foreach $cno (&'array($'clientlist)) {
next unless $'avail[$cno];
next unless $'userno[$cno] == $userno;
foreach $chan (&'array($'channellist[$'server[$cno]])) {
if (!&'exist($visiblelist[$cno], $chan)) {
$joinlist[$cno] = &'add($joinlist[$cno], $chan);
&join_channel($cno, $chan);
}
}
$visiblelist[$cno] = '';
$joinlist[$cno] = '';
}
}
sub client_open {
local($clientno) = @_;
$visiblelist[$clientno] = '';
$joinlist[$clientno] = '';
}
sub client_close {
local($clientno) = @_;
$visiblelist[$clientno] = '';
$joinlist[$clientno] = '';
}
sub cp_kick {
local($clientno, $prefix, $cmd, @params) = @_;
if (!&'exist($visiblelist[$clientno], $params[0])) {
return ();
}
return ($prefix, $cmd, @params);
}
sub cs_join {
local($clientno, $prefix, $cmd, @params) = @_;
local(@chan, @key, @joinchan, @joinkey, $i);
if ($params[0]) {
@chan = split(/\,/, $params[0]);
@key = split(/\,/, $params[1] || '');
@joinchan = ();
@joinkey = ();
for ($i = 0; $i < @chan; $i++) {
$rchan = &'real($chan[$i]);
next unless &'channel($rchan);
$joinlist[$clientno] = &'add($joinlist[$clientno], $rchan);
if (&'exist($'channellist[$'server[$clientno]], $rchan)) {
&join_channel($clientno, $rchan);
} elsif (!&'exist($visiblelist[$clientno], $rchan)) {
push(@joinchan, $rchan);
push(@joinkey, $key[$i] || '');
}
}
}
if (@joinchan) {
return ($prefix, $cmd, join(',', @joinchan), join(',', @joinkey));
}
return ();
}
sub cp_join {
local($clientno, $prefix, $cmd, @params) = @_;
if (&'exist($joinlist[$clientno], $params[0])) {
$visiblelist[$clientno] = &'add($visiblelist[$clientno], $params[0]);
$joinlist[$clientno] = &'remove($joinlist[$clientno], $params[0]);
return ($prefix, $cmd, @params);
}
return ();
}
sub cp_nick {
local($clientno, $prefix, $cmd, @params) = @_;
local($nick);
$nick = &'prefix($prefix);
if ($nick eq $'nick[$clientno]) {
return ($prefix, $cmd, @params);
}
foreach $chan (&'array($visiblelist[$clientno])) {
if (&'exist($'nameslist{$clientno, $chan}, $nick, "\+$nick", "\@$nick")) {
return ($prefix, $cmd, @params);
}
}
return ();
}
sub cp_notice {
local($clientno, $prefix, $cmd, @params) = @_;
if (&'channel($params[0])) {
if (!&'exist($visiblelist[$clientno], $params[0])) {
return ();
}
}
return ($prefix, $cmd, @params);
}
sub cp_mode {
local($clientno, $prefix, $cmd, @params) = @_;
if (&'channel($params[0])) {
if (!&'exist($visiblelist[$clientno], $params[0])) {
return ();
}
}
return ($prefix, $cmd, @params);
}
sub cs_part {
local($clientno, $prefix, $cmd, @params) = @_;
&'c_print($clientno, &'user($clientno), $cmd, @params);
return ();
}
sub cp_privmsg {
local($clientno, $prefix, $cmd, @params) = @_;
if (&'channel($params[0])) {
if (!&'exist($visiblelist[$clientno], $params[0])) {
return ();
}
}
return ($prefix, $cmd, @params);
}
sub cp_quit {
local($clientno, $prefix, $cmd, @params) = @_;
local($nick);
$nick = &'prefix($prefix);
foreach $chan (&'array($visiblelist[$clientno])) {
if (&'exist($'nameslist{$clientno, $chan}, $nick, "\+$nick", "\@$nick")) {
return ($prefix, $cmd, @params);
}
}
return ();
}
sub cp_topic {
local($clientno, $prefix, $cmd, @params) = @_;
if (!&'exist($visiblelist[$clientno], $params[0])) {
return ();
}
return ($prefix, $cmd, @params);
}
sub cp_332 {
local($clientno, $prefix, $cmd, @params) = @_;
if (!&'exist($visiblelist[$clientno], $params[1])) {
return ();
}
return ($prefix, $cmd, @params);
}
sub cp_353 {
local($clientno, $prefix, $cmd, @params) = @_;
if (!&'exist($visiblelist[$clientno], $params[2])) {
return ();
}
return ($prefix, $cmd, @params);
}
sub cp_366 {
local($clientno, $prefix, $cmd, @params) = @_;
if (!&'exist($visiblelist[$clientno], $params[1])) {
return ();
}
return ($prefix, $cmd, @params);
}
sub cp_405 {
local($clientno, $prefix, $cmd, @params) = @_;
$joinlist[$clientno] = &'remove($joinlist[$clientno], $params[1]);
return ($prefix, $cmd, @params);
}
sub cp_471 {
local($clientno, $prefix, $cmd, @params) = @_;
$joinlist[$clientno] = &'remove($joinlist[$clientno], $params[1]);
return ($prefix, $cmd, @params);
}
sub cp_473 {
local($clientno, $prefix, $cmd, @params) = @_;
$joinlist[$clientno] = &'remove($joinlist[$clientno], $params[1]);
return ($prefix, $cmd, @params);
}
sub cp_474 {
local($clientno, $prefix, $cmd, @params) = @_;
$joinlist[$clientno] = &'remove($joinlist[$clientno], $params[1]);
return ($prefix, $cmd, @params);
}
sub cp_475 {
local($clientno, $prefix, $cmd, @params) = @_;
$joinlist[$clientno] = &'remove($joinlist[$clientno], $params[1]);
return ($prefix, $cmd, @params);
}
sub cp_476 {
local($clientno, $prefix, $cmd, @params) = @_;
$joinlist[$clientno] = &'remove($joinlist[$clientno], $params[1]);
return ($prefix, $cmd, @params);
}
sub join_channel {
local($cno, $chan) = @_;
local($sno);
$sno = $'server[$cno];
&'c_print($cno, &'user($cno), 'JOIN', $chan);
&'c_print($cno, $'servername[$cno], '332', $'nick[$cno], $chan, $'topic{$sno, $chan}) if $'topic{$sno, $chan};
&'c_print($cno, $'servername[$cno], '353', $'nick[$cno], '=', $chan, join(' ', reverse(&'array($'nameslist{$sno, $chan}))));
&'c_print($cno, $'servername[$cno], '366', $'nick[$cno], $chan, 'End of /NAMES list.');
}
__END__
--><HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-2022-JP">
<LINK REV="made" HREF="mailto:hasegawa@madoka.org">
<TITLE>channel/filter.plm</TITLE></HEAD><BODY>
$B%*%s%i%$%s%I%-%e%a%s%H(B
<HR><H3>$BL>A0(B</H3>
channel/filter.plm - $B%/%i%$%"%s%H$+$i8+$($k%A%c%s%M%k$r@)8B$9$k(B
<HR><H3>$B@bL@(B</H3>
$B%/%i%$%"%s%H$r@\B3$7$?$H$-$K!"<B:]$K$O$$$/$D$+$N%A%c%s%M%k$K(B
$BF~$C$F$$$F$b!"%/%i%$%"%s%H$+$i$O$=$l$,8+$($J$$$h$&$K$7$^$9!#(B
$B$^$?!"%A%c%s%M%k$rH4$1$h$&$H$7$F$b!"<B:]$K$OH4$1$^$;$s!#(B
<HR><H3>$B%W%m%Q%F%#(B</H3>
<HR><H3>$B@_DjNc(B</H3>
<PRE>
+ channel/filter.plm
</PRE>
</BODY></HTML>