summaryrefslogtreecommitdiff
path: root/lib/rbot/irc.rb
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2010-03-29 18:35:14 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2010-03-29 18:41:07 +0200
commitf00ee3ba88882bddeb21850ed1bd97b5416ea280 (patch)
treeb718ac8ee62f5d63487cbc3055e50575c0d549b4 /lib/rbot/irc.rb
parent79d95448a9dd48c8273255be90945acfe53043d4 (diff)
IRC: support 'CASEMAPPING=charset' from some idiotic servers
Diffstat (limited to 'lib/rbot/irc.rb')
-rw-r--r--lib/rbot/irc.rb18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/rbot/irc.rb b/lib/rbot/irc.rb
index ebfbaed3..07ec6c37 100644
--- a/lib/rbot/irc.rb
+++ b/lib/rbot/irc.rb
@@ -1668,7 +1668,7 @@ module Irc
def parse_isupport(line)
debug "Parsing ISUPPORT #{line.inspect}"
ar = line.split(' ')
- reparse = ""
+ reparse = []
ar.each { |en|
prekey, val = en.split('=', 2)
if prekey =~ /^-(.*)/
@@ -1680,7 +1680,11 @@ module Irc
case key
when :casemapping
noval_warn(key, val) {
- @supports[key] = val.to_irc_casemap
+ if val == 'charset'
+ reparse << "CASEMAPPING=(charset)"
+ else
+ @supports[key] = val.to_irc_casemap
+ end
}
when :chanlimit, :idchan, :maxlist, :targmax
noval_warn(key, val) {
@@ -1718,7 +1722,7 @@ module Irc
@supports[key] = val
when :maxchannels
noval_warn(key, val) {
- reparse += "CHANLIMIT=(chantypes):#{val} "
+ reparse << "CHANLIMIT=(chantypes):#{val} "
}
when :maxtargets
noval_warn(key, val) {
@@ -1759,8 +1763,12 @@ module Irc
@supports[key] = val.nil? ? true : val
end
}
- reparse.gsub!("(chantypes)",@supports[:chantypes])
- parse_isupport(reparse) unless reparse.empty?
+ unless reparse.empty?
+ reparse_str = reparse.join(" ")
+ reparse_str.gsub!("(chantypes)",@supports[:chantypes])
+ reparse_str.gsub!("(charset)",@supports[:charset] || 'rfc1459')
+ parse_isupport(reparse_str)
+ end
end
# Returns the casemap of the server.