File: privmsg.mpi

package info (click to toggle)
madoka 4.1.15-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 792 kB
  • ctags: 43
  • sloc: perl: 1,140; makefile: 42
file content (54 lines) | stat: -rw-r--r-- 1,397 bytes parent folder | download
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
46
47
48
49
50
51
52
53
54
# madoka 4.0 sv_privmsg
#
# server/privmsg.mpi
#    Copyright(c)1998- cookie / The madoka project
#

sub sv_privmsg {
  local($from, $pr) = @_;
  local($chan, $l) = ($pr =~ /^([^ ]+) *:?(.*)$/);
  local($l2);
  $l2 = $chan;
  $l2 =~ s/(\W)/\\$1/g;
  if ($chl !~ /$;$l2$;/) {
    foreach (split(/$;/, $chl)) {
      $l2 = $_;
      $l2 =~ s/(\W)/\\$1/g;
      next if $chan !~ /^$l2$/i;
      $chan = $_;
      last;
    }
  }
  local($chanr, $chanv) = &alias_chan($chan);
  local($mes, @ctcpc) = ();
  while ($l =~ /^([^\001]*)\001([^\001]*)\001(.*)/) {
    $mes .= $1;
    $l = $3;
    push(@ctcpc, $2) if &ctcp($chanr, $2);
  }
  $mes .= $l;
  local($mesl) = $mes;
  if ($mesl =~ /\033\$[BI][^\033]*$/ || $mesl =~ /\033[\$\(]?$/) {
    $mesl =~ s/(\$|\033(\()?)$//;
    $mesl .= "\033(B";
  }
  if ($mes) {
    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");
  }
}