]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blob - lib/rbot/channel.rb
Inform users about plugins that failed to load; preserve the (supposedly) most intere...
[user/henk/code/ruby/rbot.git] / lib / rbot / channel.rb
1 module Irc
2
3   # class to store IRC channel data (users, topic, per-channel configurations)
4   class IRCChannel
5     # name of channel
6     attr_reader :name
7
8     # current channel topic
9     attr_reader :topic
10
11     # hash containing users currently in the channel
12     attr_accessor :users
13
14     # if true, bot won't talk in this channel
15     attr_accessor :quiet
16
17     # name:: channel name
18     # create a new IRCChannel
19     def initialize(name)
20       @name = name
21       @users = Hash.new
22       @quiet = false
23       @topic = Topic.new
24     end
25
26     # eg @bot.channels[chan].topic = topic
27     def topic=(name)
28       @topic.name = name
29     end
30
31     # class to store IRC channel topic information
32     class Topic
33       # topic name
34       attr_accessor :name
35
36       # timestamp
37       attr_accessor :timestamp
38
39       # topic set by
40       attr_accessor :by
41
42       def initialize
43         @name = ""
44       end
45
46       # when called like "puts @bots.channels[chan].topic"
47       def to_s
48         @name
49       end
50     end
51
52   end
53
54 end