This allows us to support servers that (ab)use the CASEMAPPING
to indicate the set of allowed characters for nicks (e.g. Inspire
IRCd).
# encoding. The plugin takes care of translation to/from utf-8 on server IO,
# if necessary (translation charsets are configurable).
# encoding. The plugin takes care of translation to/from utf-8 on server IO,
# if necessary (translation charsets are configurable).
+# TODO autoconfigure using server-provided allowed charset when these are
+# available, see also comment in irc.rb
+
require 'iconv'
class UnicodePlugin < CoreBotModule
require 'iconv'
class UnicodePlugin < CoreBotModule
# This method returns the Irc::Casemap whose name is the receiver
#
def to_irc_casemap
# This method returns the Irc::Casemap whose name is the receiver
#
def to_irc_casemap
- Irc::Casemap.get(self) rescue raise TypeError, "Unkown Irc::Casemap #{self.inspect}"
+ begin
+ Irc::Casemap.get(self)
+ rescue
+ # raise TypeError, "Unkown Irc::Casemap #{self.inspect}"
+ error "Unkown Irc::Casemap #{self.inspect} requested, defaulting to rfc1459"
+ Irc::Casemap.get('rfc1459')
+ end
end
# This method returns a string which is the downcased version of the
end
# This method returns a string which is the downcased version of the
if val == 'charset'
reparse << "CASEMAPPING=(charset)"
else
if val == 'charset'
reparse << "CASEMAPPING=(charset)"
else
+ # TODO some servers offer non-standard CASEMAPPINGs in the form
+ # locale.charset[-options], which indicate an extended set of
+ # allowed characters (mostly for nicks). This might be supported
+ # with hooks for the unicode core module
@supports[key] = val.to_irc_casemap
end
}
@supports[key] = val.to_irc_casemap
end
}