]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
+ support channel URL and creation time
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sat, 9 Aug 2008 21:26:03 +0000 (23:26 +0200)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sat, 9 Aug 2008 21:26:03 +0000 (23:26 +0200)
lib/rbot/irc.rb
lib/rbot/rfc2812.rb

index 1e1c56b075d5de55f12e01c073676228206a8ad6..23bd9e0da2b922df16ea8b3fdb5104da321fab1e 100644 (file)
@@ -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
index 378036de36be4db44cbea1ed3a61c01c49fae820..ac44888330d6b10726fa11be5a2eba04ff464d15 100644 (file)
@@ -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)