1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
# madoka 4.2 sv_privmsg
#
# server/privmsg.mpi
# Copyright(c)1998- cookie / The madoka project
#
sub sv_privmsg {
my($from, $pr) = @_;
my($chan, $l) = ($pr =~ /^([^ ]+) *:?(.*)$/);
my($chanr, $chanv) = &alias_chan($chan);
my($mes, @ctcpc) = ();
if ($l =~ /^([^\001]*)\001([^\001]*)\001(.*)/) {
$mes .= $1;
$l = $3;
push(@ctcpc, $2) if &ctcp($chanr, $2);
while ($l =~ /^([^\001]*)\001([^\001]*)\001(.*)/) {
$l = $1 . $3;
}
}
$mes .= $l;
my $mesl = $mes;
if ($mesl =~ /\033\$[BI][^\033]*$/ || $mesl =~ /\033[\$\(]?$/) {
$mesl =~ s/(\$|\033(\()?)$//;
$mesl .= "\033(B";
}
if ($mes ne '') {
if ($chanr =~ /^[$chl_header]/ && &list_exist($chl, $chanr)) {
if (&list_exist($ls_mem{$chanr}, $from, "\+$from", "\@$from")) {
&mes("<$chanv:$from> $mesl\n", $chanr);
} else {
&mes("($chanv:$from) $mesl\n", $chanr);
}
} else {
&mes("=$from= $mesl\n", 'P');
}
$cl_chan = $cl_chan{$chanr};
&send('cch', ":$from!$where PRIVMSG $chanr :$mes\n");
&plugin('PRIVMSG', $chanr, $from, $mes);
return;
}
foreach (@ctcpc) {
$cl_chan = $cl_chan{$chanr};
&send('cch', ":$from!$where PRIVMSG $chanr :\001$_\001\n");
}
}
|