File: topic.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 (53 lines) | stat: -rw-r--r-- 1,444 bytes parent folder | download | duplicates (2)
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
# madoka 4.2 sv_topic
#
# server/topic.mpi
#    Copyright(c)1998- cookie / The madoka project
#

sub sv_topic {
  my($chan, $topic) = split(/ /, $_[1], 2);
  my($chanr, $chanv) = &alias_chan($chan);
  my($j, $l);
  $topic =~ s/^://;
  my $topicl = $topic;
  if ($topicl =~ /\033\$[BI][^\033]*$/ || $topicl =~ /\033[\$\(]?$/) {
    $topicl =~ s/(\$|\033(\()?)$//;
    $topicl .= "\033(B";
  }
  &mes("Topic of channel $chanv by $from: $topicl\n", $chanr);
  $topic{$chanr} = $at_topic{$chanr} = $topic;
  if ($log_topic) {
    my $file;
    if ($log_topic =~ /^\//) {
      $file = $log_topic;
    } else {
      $file = "$log_dir$log_topic";
    }
    while ($file =~ /(\%[YyMDh])/) {
      $j = $1;
      if ($j eq '%Y') {
	$l = sprintf("%04d", $year);
      } elsif ($j eq '%y') {
	$l = sprintf("%02d", $year);
      } elsif ($j eq '%M') {
	$l = sprintf("%02d", $mon);
      } elsif ($j eq '%D') {
	$l = sprintf("%02d", $mday);
      } elsif ($j eq '%h') {
	$l = sprintf("%02d", $hour);
      }
      $file =~ s/$j/$l/;
    }
    if (open(TOPICLOG, ">>$file")) {
      chmod($log_mode, $file);
      &current_time;
      my($date) = sprintf("%04d/%02d/%02d %02d:%02d:%02d",
			  $year, $mon, $mday, $hour, $min, $sec);
      print TOPICLOG "$date $chanv by $from: $topicl\n";
      close(TOPICLOG);
    }
  }
  $cl_chan = $cl_chan{$chanr};
  &send('cch', ":$from!$where TOPIC $chanr :$topic\n");
  &plugin('TOPIC', $chanr, $from, $topicl);
}