File: client.mpi

package info (click to toggle)
madoka 4.2.3-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 960 kB
  • ctags: 45
  • sloc: perl: 1,006; makefile: 45; sh: 4
file content (57 lines) | stat: -rw-r--r-- 1,671 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
55
56
57
# madoka 4.2 rc_client
#
# rc/client.mpi
#    Copyright(c)1998- cookie / The madoka project
#

my($var, $arg) = split(/=\s*/, $rc_line, 2);

if ($var eq 'port') {
  &down("[ERROR] port in [client]\n") if $arg =~ /[^\d]/;
  $cl_port = $arg;
} elsif ($var eq 'flood') {
  if ($arg eq 'on' || $arg eq '+') {
    &redo('flood.mpi');
  } elsif ($arg eq 'off' || $arg eq '-') {
    &list_del($plugin_list, 'flood');
    &list_del($per_sec, 'flood');
  }
} elsif ($var eq 'bindaddr') {
  $arg =~ s/\s//g;
  &down("[ERROR] bindaddr in [client]\n")
      unless $arg =~ /^\d+\.\d+\.\d+\.\d+$/ || $arg =~ /^[\da-f:]$/;
  $cl_bindaddr = $arg;
} elsif ($var eq 'tail') {
  &down("[ERROR] tail in [client]\n") if $arg =~ /[^\d]/;
  $taillog = $arg;
} elsif ($var eq 'kanji') {
  if ($arg eq 'on' || $arg eq '+') {
    &redo('kanji.mpi');
  } elsif ($arg eq 'off' || $arg eq '-') {
    &list_del($plugin_list, 'kanji');
  }  
} elsif ($var eq 'pid') {
  if ($arg eq 'on' || $arg eq '+') {
    vec($us_state, 2, 1) = 1;
    if (open(PID, ">madoka.pid")) {
      print PID "$$";
      close(PID);
    }
  } elsif ($arg eq 'off' || $arg eq '-') {
    vec($us_state, 2, 1) = 0;
    unlink('madoka.pid');
  }
} elsif ($var eq 'kanjilock') {
  &down ("[ERROR] kanjilock in [client]: no such code  $arg\n")
      if $arg ne 'jis' && $arg ne 'euc' && $arg ne 'sjis';
  $kanji_lock_code = $arg;
} elsif ($var eq 'host') {
  $hostcount++;
  @cl_hosts = () if scalar(@cl_hosts) > $hostcount -1;
  if ($arg =~ /\//) {
    my($l1, $l2) = ($`, $');
    push (@cl_hosts, $arg) if $l1 =~ /^[\w\d\-\.:]+$/ && $l2 =~ /^[\d\.]+$/;
  } else {
    push (@cl_hosts, $arg) if $arg =~ /^[\w\d\-\.:]+$/;
  }
}