Module: Hector::Commands::Topic
- Included in:
- Session
- Defined in:
- lib/hector/commands/topic.rb
Instance Method Summary collapse
Instance Method Details
#on_topic ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/hector/commands/topic.rb', line 4 def on_topic channel = Channel.find(request.args.first) if request.args.length > 1 topic = request.text channel.change_topic(self, topic) channel.broadcast(:topic, channel.name, :source => source, :text => topic) else respond_to_topic(channel) end end |
#respond_to_topic(channel) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/hector/commands/topic.rb', line 16 def respond_to_topic(channel) if topic = channel.topic respond_with("332", nickname, channel.name, :source => Hector.server_name, :text => topic[:body]) respond_with("333", nickname, channel.name, topic[:nickname], topic[:time].to_i, :source => Hector.server_name) else respond_with("331", nickname, channel.name, :source => Hector.server_name, :text => "No topic is set.") end end |