summaryrefslogtreecommitdiff
path: root/lib/rbot
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2006-08-05 11:33:29 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2006-08-05 11:33:29 +0000
commit85644884610899b634af4bec1e46692f0d41806f (patch)
tree108bca3a1eef4af370a7682aa49c744b4aa68e27 /lib/rbot
parent9430b8ea5a8f36fed90879261fc4ffcdcdc65218 (diff)
Fix server casemap handling
Diffstat (limited to 'lib/rbot')
-rw-r--r--lib/rbot/irc.rb38
1 files changed, 23 insertions, 15 deletions
diff --git a/lib/rbot/irc.rb b/lib/rbot/irc.rb
index 6ef84eb0..21c72264 100644
--- a/lib/rbot/irc.rb
+++ b/lib/rbot/irc.rb
@@ -176,14 +176,18 @@ module Irc
# @server (if possible) or at the @casemap otherwise
#
def casemap
- @server.casemap rescue @casemap
+ return @server.casemap if defined?(@server) and @server
+ return @casemap
end
# Returns a hash with the current @server and @casemap as values of
# :server and :casemap
#
def server_and_casemap
- {:server => @server, :casemap => @casemap}
+ h = {}
+ h[:server] = @server if defined?(@server) and @server
+ h[:casemap] = @casemap if defined?(@casemap) and @casemap
+ return h
end
# We allow up/downcasing with a different casemap
@@ -531,7 +535,7 @@ module Irc
#
def inspect
str = "<#{self.class}:#{'0x%x' % self.object_id}:"
- str << " @server=#{@server}" if @server
+ str << " @server=#{@server}" if defined?(@server) and @server
str << " @nick=#{@nick.inspect} @user=#{@user.inspect}"
str << " @host=#{@host.inspect} casemap=#{casemap.inspect}"
str << ">"
@@ -1176,7 +1180,7 @@ module Irc
#
def reset_capabilities
@supports = {
- :casemapping => 'rfc1459',
+ :casemapping => 'rfc1459'.to_irc_casemap,
:chanlimit => {},
:chanmodes => {
:typea => nil, # Type A: address lists
@@ -1269,9 +1273,9 @@ module Irc
key = prekey.downcase.to_sym
end
case key
- when :casemapping, :network
+ when :casemapping
noval_warn(key, val) {
- @supports[key] = val
+ @supports[key] = val.to_irc_casemap
}
when :chanlimit, :idchan, :maxlist, :targmax
noval_warn(key, val) {
@@ -1281,15 +1285,6 @@ module Irc
@supports[key][k] = v.to_i
}
}
- when :maxchannels
- noval_warn(key, val) {
- reparse += "CHANLIMIT=(chantypes):#{val} "
- }
- when :maxtargets
- noval_warn(key, val) {
- @supports[key]['PRIVMSG'] = val.to_i
- @supports[key]['NOTICE'] = val.to_i
- }
when :chanmodes
noval_warn(key, val) {
groups = val.split(',')
@@ -1312,6 +1307,19 @@ module Irc
when :invex
val ||= 'I'
@supports[key] = val
+ when :maxchannels
+ noval_warn(key, val) {
+ reparse += "CHANLIMIT=(chantypes):#{val} "
+ }
+ when :maxtargets
+ noval_warn(key, val) {
+ @supports[key]['PRIVMSG'] = val.to_i
+ @supports[key]['NOTICE'] = val.to_i
+ }
+ when :network
+ noval_warn(key, val) {
+ @supports[key] = val
+ }
when :nicklen
noval_warn(key, val) {
@supports[key] = val.to_i