File: Error.pm

package info (click to toggle)
tiarra 20100212-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,732 kB
  • ctags: 1,712
  • sloc: perl: 32,032; lisp: 193; sh: 109; makefile: 10
file content (38 lines) | stat: -rw-r--r-- 1,335 bytes parent folder | download | duplicates (4)
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
# -----------------------------------------------------------------------------
# $Id: Error.pm 11365 2008-05-10 14:58:28Z topia $
# -----------------------------------------------------------------------------
# copyright (C) 2004 Topia <topia@clovery.jp>. all rights reserved.
package System::Error;
use strict;
use warnings;
use base qw(Module);

sub message_io_hook {
    my ($this,$message,$io,$type) = @_;

    if ($io->isa('IrcIO::Client') &&
	    $type eq 'out' &&
		$message->command eq 'ERROR' &&
		    !$message->remark('send-error-as-is-to-client')) {
	$message->param(1, $message->serialize);
	$message->param(0, RunLoop->shared_loop->current_nick);
	$message->command('NOTICE');
    }

    return $message;
}

1;

=pod
info: サーバーからのERRORメッセージをNOTICEに埋め込む
default: on

# これをoffにするとクライアントにERRORメッセージがそのまま送られます。
# クライアントとの間ではERRORメッセージは主に切断警告に使われており、
# そのまま流してしまうとクライアントが混乱する可能性があります。
#   設定項目はありません。

# このモジュールを回避してERRORメッセージをクライアントに送りたい場合は、
# remarkのsend-error-as-is-to-clientを指定してください。
=cut