summaryrefslogtreecommitdiff
path: root/lib/rbot
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbot')
-rw-r--r--lib/rbot/irc.rb9
-rw-r--r--lib/rbot/rfc2812.rb16
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)