File: Ignore.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 (42 lines) | stat: -rw-r--r-- 1,397 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
39
40
41
42
# -----------------------------------------------------------------------------
# $Id: Ignore.pm 11365 2008-05-10 14:58:28Z topia $
# -----------------------------------------------------------------------------
package User::Ignore;
use strict;
use warnings;
use base qw(Module);
use Mask;

sub message_arrived {
    my ($this,$msg,$sender) = @_;
    
    # 鯖からクライアントへ向かうメッセージか?
    if ($sender->isa('IrcIO::Server')) {
	# 対象となるコマンドか?
	if (Mask::match(
		$this->config->command,
		$msg->command)) {
	    # 全てのmaskをカンマで繋げてマッチングを行なう。
	    if (Mask::match(
		    join(',',$this->config->mask('all')),
		    $msg->prefix || '')) {
		# 最終的にマッチしたので、このメッセージは捨てる。
		return undef;
	    }
	}
    }
    return $msg;
}

1;
=pod
info: 指定された人間からのPRIVMSGやNOTICEを破棄してクライアントへ送らないようにするモジュール。
default: off

# 対象となるコマンドのマスク。省略時には"privmsg,notice"が設定されている。
# ただしprivmsgとnotice以外を破棄してしまうと、(Tiarraは平気でも)クライアントが混乱する。
command: privmsg,notice

# maskは複数定義可能。定義された順番でマッチングが行なわれます。
mask: example!*@*.example.net
=cut