File: Freenode.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 (64 lines) | stat: -rw-r--r-- 1,848 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# -----------------------------------------------------------------------------
# $Id: Freenode.pm 36718 2010-02-11 17:21:29Z topia $
# -----------------------------------------------------------------------------
# Freenode support.
# -----------------------------------------------------------------------------
# copyright (C) 2010 Topia <topia@clovery.jp>. all rights reserved.
package Network::Freenode;
use strict;
use warnings;
use NumericReply;
use base qw(Module);

sub config_reload {
    my ($this, $old_config) = @_;
    return $this;
}

sub message_arrived {
    my ($this,$msg,$sender) = @_;

    if ($sender->isa('IrcIO::Server') &&
	    ($sender->isupport->{NETWORK} || '') eq 'freenode') {
	my $cmd = $msg->command;
	if (($msg->prefix->prefix eq 'ChanServ!ChanServ@services.') &&
		$cmd =~ /^(?:PART|JOIN|MODE|TOPIC)$/) {
	    my $ch_name = $msg->param(0);
	    my $ch = $this->_runloop->channel($ch_name);
	    if (defined $ch) {
		$ch->remark('chanserv-controlled', 1);
	    }
	} elsif ($cmd eq RPL_ENDOFNAMES) {
	    my $ch_name = $msg->param(1);
	    my $ch = $this->_runloop->channel($ch_name);
	    if (defined $ch->names('ChanServ')) {
		$ch->remark('chanserv-controlled', 1);
	    }
	}
    }

    return $msg;
}

1;

=begin tiarra-doc

info: Freenode サポート
default: on
section: important

# 現状では ChanServ の検出以外の機能はありません。
# drop による状況の変化についてもサポートしていません。

# Channel::Rejoin では、このモジュールによってチャンネルが
# ChanServ の管理下にあると検出した時には Rejoin 動作を
# 行わなくなります。

# 設定はありません。
# また、 freenode 以外のネットワークでこのモジュールが
# 有効になっていても不都合はないはずです。

=end tiarra-doc

=cut