home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.madoka.org
/
2014.12.ftp.madoka.org.tar
/
ftp.madoka.org
/
pub
/
plum
/
1.x
/
plum10b8.lzh
/
plum10b8
/
ctcp.plm
< prev
next >
Wrap
Text File
|
1997-06-25
|
4KB
|
137 lines
package ctcp;
$_ = 'ctcp';
sub cs_privmsg {
local($clientno, $prefix, $cmd, $chan, $msg) = @_;
local($tmp, $rest, $ctcp, $list);
$tmp = '';
$rest = $msg;
while ($rest =~ /^(.*)\cA([^\cA]*)\cA(.*)$/) {
$tmp .= $1;
$ctcp = $2;
$rest = $3;
if (!&'exist($list || $;, $ctcp)) {
$tmp .= &xc_scan($clientno, $prefix, $ctcp);
}
$list = &'add($list || $;, $ctcp);
}
$tmp .= $rest || '';
return () unless $tmp;
return ($prefix, $cmd, $chan, $tmp);
}
sub cp_privmsg {
local($clientno, $prefix, $cmd, $chan, $msg) = @_;
local($tmp, $rest, $ctcp, $list);
$tmp = '';
$rest = $msg;
while ($rest =~ /^(.*)\cA([^\cA]*)\cA(.*)$/) {
$tmp .= $1;
$ctcp = $2;
$rest = $3;
if (!&'exist($list || $;, $ctcp)) {
$tmp .= &xc_print($clientno, $prefix, $ctcp);
}
$list = &'add($list || $;, $ctcp);
}
$tmp .= $rest || '';
return () unless $tmp;
return ($prefix, $cmd, $chan, $tmp);
}
sub ss_privmsg {
local($serverno, $prefix, $cmd, $chan, $msg) = @_;
local($tmp, $rest, $ctcp, $list);
$tmp = '';
$rest = $msg;
while ($rest =~ /^(.*)\cA([^\cA]*)\cA(.*)$/) {
$tmp .= $1;
$ctcp = $2;
$rest = $3;
if (!&'exist($list || $;, $ctcp)) {
$tmp .= &xs_scan($serverno, $prefix, $ctcp);
}
$list = &'add($list || $;, $ctcp);
}
$tmp .= $rest || '';
return () unless $tmp;
return ($prefix, $cmd, $chan, $tmp);
}
sub sp_privmsg {
local($serverno, $prefix, $cmd, $chan, $msg) = @_;
local($tmp, $rest, $ctcp, $list);
$tmp = '';
$rest = $msg;
while ($rest =~ /^(.*)\cA([^\cA]*)\cA(.*)$/) {
$tmp .= $1;
$ctcp = $2;
$rest = $3;
if (!&'exist($list || $;, $ctcp)) {
$tmp .= &xs_print($serverno, $prefix, $ctcp);
}
$list = &'add($list || $;, $ctcp);
}
$tmp .= $rest || '';
return () unless $tmp;
return ($prefix, $cmd, $chan, $tmp);
}
sub xc_scan {
local($clientno, $prefix, $ctcp) = @_;
local($null, $cmd, @params) = &'parse($ctcp);
local($sub);
foreach $module (&'array($'modulelist[$'userno[$clientno]] || $;)) {
$sub = "${module}'xcs_\L$cmd\E";
next unless defined(&$sub);
($prefix, $cmd, @params) = &$sub($clientno, $prefix, $cmd, @params);
last unless $cmd;
}
return '' unless $cmd;
return "\cA" . join(' ', $cmd, @params) . "\cA";
}
sub xc_print {
local($clientno, $prefix, $ctcp) = @_;
local($null, $cmd, @params) = &'parse($ctcp);
local($sub);
foreach $module (&'array($'modulelist[$'userno[$clientno]] || $;)) {
$sub = "${module}'xcp_\L$cmd\E";
next unless defined(&$sub);
($prefix, $cmd, @params) = &$sub($clientno, $prefix, $cmd, @params);
last unless $cmd;
}
return '' unless $cmd;
return "\cA" . join(' ', $cmd, @params) . "\cA";
}
sub xs_scan {
local($serverno, $prefix, $ctcp) = @_;
local($null, $cmd, @params) = &'parse($ctcp);
local($sub);
foreach $module (&'array($'modulelist[$'userno[$serverno]] || $;)) {
$sub = "${module}'xss_\L$cmd\E";
next unless defined(&$sub);
($prefix, $cmd, @params) = &$sub($serverno, $prefix, $cmd, @params);
last unless $cmd;
}
return '' unless $cmd;
return "\cA" . join(' ', $cmd, @params) . "\cA";
}
sub xs_print {
local($serverno, $prefix, $ctcp) = @_;
local($null, $cmd, @params) = &'parse($ctcp);
local($sub);
foreach $module (&'array($'modulelist[$'userno[$serverno]] || $;)) {
$sub = "${module}'xsp_\L$cmd\E";
next unless defined(&$sub);
($prefix, $cmd, @params) = &$sub($serverno, $prefix, $cmd, @params);
last unless $cmd;
}
return '' unless $cmd;
return "\cA" . join(' ', $cmd, @params) . "\cA";
}