File: topic.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 (37 lines) | stat: -rw-r--r-- 1,090 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
# madoka 4.0 sv_topic
#
# server/topic.mpi
#    Copyright(c)1998- cookie / The madoka project
#

sub sv_topic {
  local($chan, $topic) = split(/ /, $_[1], 2);
  local($chanr, $chanv) = &alias_chan($chan);
  $topic =~ s/^://;
  local($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) {
    local($file);
    if ($log_topic =~ /^\//) {
      $file = $log_topic;
    } else {
      $file = "$log_dir$log_topic";
    }
    if (open(TOPICLOG, ">>$file")) {
      chmod($log_mode, $file);
      &current_time;
      local($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);
}