diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-08-09 23:26:03 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-08-09 23:26:03 +0200 |
commit | 2f2644f03203b36fd6aa105e62f4cd15070e1cbe (patch) | |
tree | 55d6328390f08cf4a4a03ee4b91809f916df0c9f /lib | |
parent | 58b43c90ef7435713213015848eaf0486fab0b8f (diff) |
+ support channel URL and creation time
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rbot/irc.rb | 9 | ||||
-rw-r--r-- | lib/rbot/rfc2812.rb | 16 |
2 files changed, 25 insertions, 0 deletions
diff --git a/lib/rbot/irc.rb b/lib/rbot/irc.rb index 1e1c56b0..23bd9e0d 100644 --- a/lib/rbot/irc.rb +++ b/lib/rbot/irc.rb @@ -1299,12 +1299,15 @@ module Irc include ServerOrCasemap attr_reader :name, :topic, :mode, :users alias :to_s :name + attr_accessor :creation_time, :url def inspect str = self.__to_s__[0..-2] str << " on server #{server}" if server str << " @name=#{@name.inspect} @topic=#{@topic.text.inspect}" str << " @users=[#{user_nicks.sort.join(', ')}]" + str << " (created on #{creation_time})" if creation_time + str << " (URL #{url})" if url str << ">" end @@ -1368,6 +1371,12 @@ module Irc # Flags @mode = ModeHash.new + + # creation time, only on some networks + @creation_time = nil + + # URL, only on some networks + @url = nil end # Removes a user from the channel diff --git a/lib/rbot/rfc2812.rb b/lib/rbot/rfc2812.rb index 378036de..ac448883 100644 --- a/lib/rbot/rfc2812.rb +++ b/lib/rbot/rfc2812.rb @@ -144,6 +144,12 @@ module Irc # "<channel> <mode> <mode params>" RPL_CHANNELMODEIS=324 + # "<channel> <unixtime>" + RPL_CREATIONTIME=329 + + # "<channel> <url>" + RPL_CHANNEL_URL=328 + # "<channel> :No topic is set" RPL_NOTOPIC=331 @@ -1279,6 +1285,16 @@ module Irc when RPL_CHANNELMODEIS parse_mode(serverstring, argv[1..-1], data) handle(:mode, data) + when RPL_CREATIONTIME + data[:channel] = argv[1] + data[:time] = Time.at(argv[2].to_i) + @server.get_channel(data[:channel]).creation_time=data[:time] + handle(:creationtime, data) + when RPL_CHANNEL_URL + data[:channel] = argv[1] + data[:url] = argv[2] + @server.get_channel(data[:channel]).url=data[:url].dup + handle(:channel_url, data) else warning "Unknown message #{serverstring.inspect}" handle(:unknown, data) |