home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.madoka.org
/
2014.12.ftp.madoka.org.tar
/
ftp.madoka.org
/
pub
/
plum
/
1.x
/
plum11.lzh
/
plum11
/
waitoper.plm
< prev
next >
Wrap
Text File
|
1997-08-28
|
3KB
|
122 lines
package waitoper;
$WAITMAX = 20;
$waittime = 0;
$_ = 'waitoper';
sub main_loop {
local($userno) = @_;
local($no, $chan, $max, @names);
$max = &'property($userno, 'waitmax') || $WAITMAX;
foreach $key (keys(%operlist)) {
($no, $chan) = split(/$;/, $key, 2);
next unless $no == $userno;
next unless &'exist($'nameslist{$key}, "\@$'nickname[$userno]");
next if $operlist{$key} eq $;;
$waittime++;
@names = (&'array($operlist{$key}));
next unless $waittime > $WAITMAX;
$waittime = 0;
&'s_print($'server[$userno], '', 'MODE', $chan, '+o', shift(@names));
$operlist{$key} = &'list(@names);
}
}
sub ss_join {
local($serverno, $prefix, $cmd, $chan) = @_;
local($nick, $regex, $userno, $name, $mode);
$userno = $'userno[$serverno];
$nick = &'prefix($prefix);
($name, $mode) = (split(/\cG/, $chan), '');
if ($nick ne $'nick[$serverno] && $mode !~ /o/i) {
foreach $waitoper (&'property($userno, 'waitoper')) {
$regex = &'regex($waitoper);
next unless $prefix =~ /$regex/i;
$operlist{$userno, $name} = &'add($operlist{$userno, $name}, $nick);
last;
}
}
return ($prefix, $cmd, $chan);
}
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 'i') {
} elsif ($char eq 'k') {
shift(@modes);
} elsif ($char eq 'l') {
shift(@modes) if $flag eq '+';
} elsif ($char eq 'o') {
$name = shift(@modes);
if ($flag eq '+') {
$operlist{$userno, $chan} = &'remove($operlist{$userno, $chan}, $name);
}
} elsif ($char eq 'v') {
shift(@modes);
}
}
return ($prefix, $cmd, @params);
}
sub ss_nick {
local($serverno, $prefix, $cmd, $newnick) = @_;
local($userno, $nick, $no, $var);
$userno = $'userno[$serverno];
$nick = &'prefix($prefix);
if ($nick ne $'nick[$serverno]) {
foreach $key (keys(%operlist)) {
($no, $var) = split(/$;/, $key, 2);
next unless $no == $userno;
$operlist{$key} = &'change($operlist{$key}, $nick, $newnick);
}
}
return ($prefix, $cmd, $newnick);
}
sub ss_part {
local($serverno, $prefix, $cmd, $chan, $msg) = @_;
local($nick, $userno);
$userno = $'userno[$serverno];
$nick = &'prefix($prefix);
if ($nick eq $'nick[$serverno]) {
delete $operlist{$userno, $chan};
} else {
$operlist{$userno, $chan} = &'remove($operlist{$userno, $chan}, $nick);
}
return ($prefix, $cmd, $chan, $msg);
}
sub ss_quit {
local($serverno, $prefix, $cmd, $msg) = @_;
local($userno, $nick, $no, $var);
$userno = $'userno[$serverno];
$nick = &'prefix($prefix);
foreach $key (keys(%operlist)) {
($no, $var) = split(/$;/, $key, 2);
next unless $no == $userno;
$operlist{$key} = &'remove($operlist{$key}, $nick);
}
return ($prefix, $cmd, $msg);
}
sub ss_kick {
local($serverno, $prefix, $cmd, $chan, $who, $msg) = @_;
local($userno) = $'userno[$serverno];
if ($who eq $'nick[$serverno]) {
delete $operlist{$userno, $chan};
} else {
$operlist{$userno, $chan} = &'remove($operlist{$userno, $chan}, $who);
}
return ($prefix, $cmd, $chan, $who, $msg);
}