]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blob - rbot/channel.rb
initial import of rbot
[user/henk/code/ruby/rbot.git] / 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       # when called like "puts @bots.channels[chan].topic"
43       def to_s
44         @name
45       end
46     end
47
48   end
49
50 end