Changeset 6479

Show
Ignore:
Timestamp:
02/10/08 14:40:14 (5 years ago)
Author:
drry
Message:

lang/ruby/chokan/branches/citrus/plugins/simple_reply.rb
lang/ruby/chokan/branches/citrus/plugins/system.rb
lang/ruby/chokan/branches/citrus/lib/citrus/core.rb
lang/ruby/chokan/branches/citrus/config.yaml.sample: YAML で設定値に文字列と正規表現のどちらも書けるようにしました。ほか。

Location:
lang/ruby/chokan/branches/citrus
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • lang/ruby/chokan/branches/citrus/config.yaml.sample

    r6395 r6479  
    55  user: chokan 
    66  nick: chokan 
    7   real: chokan bot via tiarra 
     7  real: chokan bot via Tiarra 
    88  error: "#chokan" 
    99  plugin_dir: plugins 
     
    1414  System: 
    1515    operator: "foo!bar@localhost" 
     16    #operator: !ruby/regexp /^foo\w*?!bar@baz\d+\.example\.com$/i 
    1617 
    1718  HTTP: 
     
    2829        reply: "pong" 
    2930 
    30   Foobar: 
    31     disabled: 
    32       - "#foobar" 
     31  Foo: 
     32    disabled: &disabled_group 
     33      - "#PublicHoge" 
     34 
     35  Bar: 
     36    disabled: *disabled_group 
     37 
     38  Baz: 
     39    enabled: &enabled_group 
     40      - "#PrivateFuga" 
     41      - !ruby/regexp /^#P(?:rivate|ublic)Piyo@.+$/i 
    3342 
    3443  Jitensya: 
    35     enabled: 
    36       - "#foobar" 
     44    enabled: *enabled_group 
     45 
     46... 
  • lang/ruby/chokan/branches/citrus/lib/citrus/core.rb

    r6455 r6479  
    147147                                        case 
    148148                                        when enabled 
    149                                                 next unless enabled.include?(channel) 
     149                                                next unless enabled.find {|c| c === channel } 
    150150                                        when disabled 
    151                                                 next if disabled.include?(channel) 
     151                                                next if disabled.find {|c| c === channel } 
    152152                                        end 
    153153                                end 
  • lang/ruby/chokan/branches/citrus/plugins/simple_reply.rb

    r6416 r6479  
    33        def on_privmsg(prefix, channel, message) 
    44                @config["replies"].each do |r| 
    5                         if  r["words"].include?(message) && 
    6                            (!r["channel"] || r["channel"].include?(channel)) 
     5                        if r["words"].include?(message) && 
     6                           (!r["channels"] || r["channels"].include?(channel)) 
    77 
    88                                notice channel, r["reply"] 
     
    2323                                "replies" => [ 
    2424                                        { 
    25                                                 "words"   => ["foo", "bar"], 
    26                                                 "channel" => "#test", 
    27                                                 "reply"   => "Nice boat.", 
     25                                                "words"    => ["foo", "bar"], 
     26                                                "channels" => "#test", 
     27                                                "reply"    => "Nice boat.", 
    2828                                        } 
    2929                                ] 
  • lang/ruby/chokan/branches/citrus/plugins/system.rb

    r6416 r6479  
    22class System < Citrus::Plugin 
    33        def on_privmsg(prefix, channel, message) 
    4                 return unless Regexp.new(@config['operator']) =~ prefix 
     4                return unless @config['operator'] === prefix 
    55                case message 
    66                when /^reload(?:\s+([a-z]+))?$/i