Changeset 11354

Show
Ignore:
Timestamp:
05/10/08 22:13:40 (5 years ago)
Author:
topia
Message:

* support password.
* support mask.
* explain default value of format.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/tiarra/trunk/module/Auto/Im.pm

    r11353 r11354  
    4242      if ($msg->command eq 'PRIVMSG') { 
    4343          my $text = $msg->param(1); 
     44          my $full_ch_name = $msg->param(0); 
    4445 
    45           if ($text =~ $this->{regex}) { 
    46               my $full_ch_name = $msg->param(0); 
     46          if ($text =~ $this->{regex} && Mask::match_deep_chan( 
     47              [$this->config->mask('all')],$msg->prefix,$full_ch_name)) { 
     48 
    4749              my $url = "http://im.kayac.com/api/post/" . $this->config->user; 
    4850              my $text = Auto::AliasDB->stdreplace( 
     
    5355                  text => $text, 
    5456                 ); 
    55               my $req; 
     57              my @data = (message => $text); 
    5658              if ($this->config->secret) { 
    57                   $req = POST $url, 
    58                       [ message => $text, 
    59                         sig => Digest::SHA->new(1) 
    60                             ->add($text . $this->config->secret)->hexdigest ]; 
    61               } else { 
    62                   $req = POST $url, 
    63                       [ message => $text ]; 
     59                  push(@data, sig => Digest::SHA->new(1) 
     60                           ->add($text . $this->config->secret)->hexdigest); 
     61              } elsif ($this->config->password) { 
     62                  push(@data, password => $this->config->password); 
    6463              } 
    6564              my $runloop = $this->_runloop; 
    6665              Tools::HTTPClient->new( 
    67                   Request => $req, 
     66                  Request => POST($url, \@data), 
    6867                 )->start( 
    6968                     Callback => sub { 
     
    8786default: off 
    8887 
     88# 反応する人のマスクを指定します。 
     89# 省略すると全員に反応します。 
     90mask: * *!*@* 
     91 
    8992# 反応するキーワードを正規表現で指定します。 
    9093# 複数指定したい時は複数行指定してください。 
     
    9699 
    97100# im.kayac.com に送るメッセージのフォーマットを指定します。 
     101# デフォルト値: [tiarra][#(channel):#(nick.now)] #(text) 
    98102format: [tiarra][#(channel):#(nick.now)] #(text) 
    99103 
     
    102106user: username 
    103107 
     108# im.kayac.comで秘密鍵認証を選択した場合は設定してください。 
     109# 省略すると認証なしになります。 
     110-secret: some secret 
     111 
     112# im.kayac.comでパスワード認証を選択した場合は設定してください。 
     113# 省略すると認証なしになります。 
     114# secret と両方指定した場合は secret が優先されています。 
     115-password: some password 
     116 
    104117=cut