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
/
mode
/
oper
/
set.plm
< prev
Wrap
Text File
|
1999-02-20
|
7KB
|
249 lines
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><!-- $_ if 0; # -*- perl -*-
# $Id: set.plm,v 2.26 1999/01/28 12:19:26 hasegawa Exp $
# copyright (c)1997-1999 Yoshinori Hasegawa <hasegawa@madoka.org>
package channel_mode_oper_set;
$DELAY = 20;
$_ = 'channel_mode_oper_set';
sub main_loop {
local($userno) = @_;
local($delay, $no, $chan, @names, $nick);
$delay = &'property($userno, 'delay');
$delay = $DELAY unless defined($delay);
foreach $key (keys(%operlist)) {
($no, $chan) = split(/$;/, $key, 2);
next unless $'userno[$no] == $userno;
next unless &'exist($'nameslist{$no, $chan}, "\@$'nick[$no]");
next unless $operlist{$key};
$wait[$userno]++;
@names = &'array($operlist{$key});
next unless $wait[$userno] >= $delay;
$nick = shift(@names);
next if &'exist($'nameslist{$no, $chan}, "\@$nick");
&'s_print($no, '', 'MODE', $chan, '+o', $nick);
$operlist{$key} = &'list(@names);
$wait[$userno] = 0;
}
}
sub module_disable {
local($userno) = @_;
local($no, $chan);
foreach $key (keys(%operlist)) {
($no, $chan) = split(/$;/, $key, 2);
next unless $'userno[$no] == $userno;
delete $operlist{$key};
}
}
sub server_close {
local($serverno) = @_;
local(@keys, $no, $chan);
@keys = keys(%operlist);
foreach $key (@keys) {
($no, $chan) = split(/$;/, $key, 2);
next unless $no == $serverno;
delete $operlist{$key};
}
}
sub ss_join {
local($serverno, $prefix, $cmd, @params) = @_;
local($userno, $nick, $regex, $name, $mode, $delay);
$userno = $'userno[$serverno];
$nick = &'prefix($prefix);
($name, $mode) = (split(/\cG/, $params[0]), '');
if ($nick ne $'nick[$serverno] && index($mode, 'o') == -1) {
if (&check_mask($userno, $prefix, $params[0])) {
$delay = &'property($userno, 'delay');
$delay = $DELAY unless defined($delay);
if ($delay) {
$operlist{$serverno, $name} = &'add($operlist{$serverno, $name}, $nick);
} else {
&'s_print($serverno, '', 'MODE', $name, '+o', $nick);
}
}
}
return ($prefix, $cmd, @params);
}
sub ss_mode {
local($serverno, $prefix, $cmd, @params) = @_;
local($chan, $mode, @modes) = @params;
local($userno, $flag, $name);
$userno = $'userno[$serverno];
foreach $char (split(//, $mode)) {
if ($char eq '+' || $char eq '-') {
$flag = $char;
} elsif ($char eq 'b') {
shift(@modes);
} elsif ($char eq 'e') {
shift(@modes);
} elsif ($char eq 'I') {
shift(@modes);
} elsif ($char eq 'k') {
shift(@modes);
} elsif ($char eq 'l') {
shift(@modes) if $flag eq '+';
} elsif ($char eq 'O') {
shift(@modes);
} elsif ($char eq 'o') {
$name = shift(@modes);
if ($flag eq '+') {
$operlist{$serverno, $chan} = &'remove($operlist{$serverno, $chan}, $name);
}
} elsif ($char eq 'v') {
shift(@modes);
}
}
return ($prefix, $cmd, @params);
}
sub ss_nick {
local($serverno, $prefix, $cmd, @params) = @_;
local($userno, $nick, $no, $chan);
$userno = $'userno[$serverno];
$nick = &'prefix($prefix);
if ($nick ne $'nick[$serverno]) {
foreach $key (keys(%operlist)) {
($no, $chan) = split(/$;/, $key, 2);
next unless $no == $serverno;
$operlist{$no, $chan} = &'change($operlist{$no, $chan}, $nick, $params[0]);
}
}
return ($prefix, $cmd, @params);
}
sub ss_part {
local($serverno, $prefix, $cmd, @params) = @_;
local($nick, $userno);
$userno = $'userno[$serverno];
$nick = &'prefix($prefix);
if ($nick eq $'nick[$serverno]) {
delete $operlist{$serverno, $params[0]};
} else {
$operlist{$serverno, $params[0]} = &'remove($operlist{$serverno, $params[0]}, $nick);
}
return ($prefix, $cmd, @params);
}
sub ss_quit {
local($serverno, $prefix, $cmd, @params) = @_;
local($userno, $nick, $no, $chan);
$userno = $'userno[$serverno];
$nick = &'prefix($prefix);
foreach $key (keys(%operlist)) {
($no, $chan) = split(/$;/, $key, 2);
next unless $no == $serverno;
$operlist{$no, $chan} = &'remove($operlist{$no, $chan}, $nick);
}
return ($prefix, $cmd, @params);
}
sub ss_kick {
local($serverno, $prefix, $cmd, @params) = @_;
local($userno);
$userno = $'userno[$serverno];
if ($params[1] eq $'nick[$serverno]) {
delete $operlist{$serverno, $params[0]};
} else {
$operlist{$serverno, $params[0]} = &'remove($operlist{$serverno, $params[0]}, $params[1]);
}
return ($prefix, $cmd, @params);
}
sub check_mask {
local($userno, $prefix, $chan) = @_;
local($user, $chlist, $list);
foreach $mask (&'property($userno, 'mask')) {
($user, $chlist) = split(/\s+/, $mask);
$list = '';
foreach $vchan (split(/\,/, $chlist || '')) {
$list = &'add($list, &'real($vchan));
}
if (&'channel($chan)) {
next unless (!$list || &'exist($list, $chan));
} else {
next unless (!$list || &'exist($list, '*'));
}
if ($user =~ /^\-/) {
$regex = &'regex(substr($user, 1));
return 0 if $prefix =~ /$regex/i;
}
if ($user =~ /^\+/) {
$regex = &'regex(substr($user, 1));
} else {
$regex = &'regex($user);
}
return 1 if $prefix =~ /$regex/i;
}
return 0;
}
__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/mode/oper/set.plm</TITLE></HEAD><BODY>
$B%*%s%i%$%s%I%-%e%a%s%H(B
<HR><H3>$BL>A0(B</H3>
channel/mode/oper/set.plm - $BFCDj$N?M$r%A%c%s%M%k%*%Z%l!<%?$K$9$k(B
<HR><H3>$B@bL@(B</H3>
$B%A%c%s%M%k$KF~$C$F$-$??M$,;XDj$5$l$??M$J$i!"(B
$B$=$N?M$r%A%c%s%M%k%*%Z%l!<%?$K$7$^$9!#(B
$B<B:]$K$O%A%c%s%M%k$KF~$C$F$-$?$H$-$K$9$0$K%A%c%s%M%k%*%Z%l!<%?(B
$B$K$9$k$o$1$G$O$J$/!"0lDj;~4VBT$C$F$+$i%A%c%s%M%k%*%Z%l!<%?$K$7$^$9!#(B
<HR><H3>$B%W%m%Q%F%#(B</H3>
<DL>
<DT> channel.mode.oper.set.delay $BBT$A;~4V(B
</DT>
<DD> $B%A%c%s%M%k%*%Z%l!<%?$K$9$k$^$G$NBT$A;~4V$G$9!#(B
$BC/$+$,%A%c%s%M%k$KF~$C$F$/$k$H!"(B
$B$3$3$G;XDj$5$l$?$N?t$@$1FbIt$G%+%&%s%H$7!"(B
$B$=$N8e$G$=$N?M$r%A%c%s%M%k%*%Z%l!<%?$K$7$^$9!#(B
$B%G%U%)%k%H$G$O(B20$B$H$J$C$F$$$^$9!#(B
</DD>
<DT> channel.mode.oper.set.mask* $B%f!<%6%^%9%/(B [($B%A%c%s%M%kL>(B)]
</DT>
<DD> $B%A%c%s%M%k$KF~$C$F$-$??M$,$3$3$G;XDj$7$?$b$N$K%^%C%A$7$?$i!"(B
$B$=$N?M$r%A%c%s%M%k%*%Z%l!<%?$K$7$^$9!#(B
</DD>
</DL>
<HR><H3>$B@_DjNc(B</H3>
<PRE>
+ channel/mode/oper/set.plm
channel.mode.oper.set.mask: +pupu_j!*@*
channel.mode.oper.set.mask: +pupu_d!*@*
</PRE>
$B%A%c%s%M%k$KF~$C$F$-$??M$,!V(Bpupu_j!*@*$B!W$+!V(Bpupu_d!*@*$B!W$K(B
$B%^%C%A$7$?>l9g!"$=$N?M$r%A%c%s%M%k%*%Z%l!<%?$K$7$^$9!#(B
<PRE>
+ channel/mode/oper/set.plm
channel.mode.oper.set.delay: 0
channel.mode.oper.set.mask: -*!*@*.com
channel.mode.oper.set.mask: +*!*@* %$B$^$I$+(B,#$B$W$i$`(B
</PRE>
$B!V(B%$B$^$I$+!W$+!V(B#$B$W$i$`!W$KF~$C$F$-$??M$,!V(B*!*@*.com$B!W$K%^%C%A$7$J$1$l$P!"(B
$B$=$N?M$r$9$0$K%A%c%s%M%k%*%Z%l!<%?$K$7$^$9!#(B
</BODY></HTML>