File: Invite.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 (58 lines) | stat: -rw-r--r-- 1,585 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
# -*- cperl -*-
# -----------------------------------------------------------------------------
# $Id: Invite.pm 11365 2008-05-10 14:58:28Z topia $
# -----------------------------------------------------------------------------
# copyright (C) 2003 Topia <topia@clovery.jp>. all rights reserved.
package Channel::Join::Invite;
use strict;
use warnings;
use base qw(Module);
use Module::Use qw(Auto::Utils);
use Auto::Utils;
use Multicast;
use Mask;

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

  if ($sender->isa('IrcIO::Server')) {
    if ($msg->command eq 'INVITE') {
      my ($callbacks) = [];
      Auto::AliasDB::CallbackUtils::register_extcallbacks($callbacks, $msg, $sender);
      my ($get_ch_name,undef,undef,$reply_anywhere)
	= Auto::Utils::generate_reply_closures($msg, $sender, \@result, undef, $callbacks, 1);
      if (Multicast::channel_p($get_ch_name->())) {
	if (Mask::match_deep_chan([$this->config->mask('all')], $msg->prefix, $get_ch_name->())) {
	  # match.
	  $sender->
	    send_message($this->construct_irc_message(
					 Command => 'JOIN',
					 Params => [$get_ch_name->()]
					));
	  foreach my $reply ($this->config->message('all')) {
	    $reply_anywhere->($reply);
	  }
	}
      }
    }
  }

  return @result;
};


1;

=pod
info: 招待されたらそのチャンネルに入る。
default: off
section: important

# 許可するユーザ/チャンネルのマスク。
mask: * *!*@*
# plum: *!*@*

# 招待されたチャンネルに流すメッセージのフォーマット。
-message: こんばんわ〜。
=cut