diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2010-06-15 12:27:33 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2010-06-15 13:00:17 +0200 |
commit | 9ab64fe6dfd71647bbfcf87e4839cc15d30436db (patch) | |
tree | 73fbcaf6adad6a09957a5ce17abbbeccde18de93 | |
parent | 3c863bf62e0e5bdc739d04caeb50803533a5c13c (diff) |
New IRC Framework: don't raise on unknown casemap
This allows us to support servers that (ab)use the CASEMAPPING
to indicate the set of allowed characters for nicks (e.g. Inspire
IRCd).
-rw-r--r-- | lib/rbot/core/unicode.rb | 3 | ||||
-rw-r--r-- | lib/rbot/irc.rb | 12 |
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/rbot/core/unicode.rb b/lib/rbot/core/unicode.rb index 9d42ec24..ece8e644 100644 --- a/lib/rbot/core/unicode.rb +++ b/lib/rbot/core/unicode.rb @@ -10,6 +10,9 @@ # 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 diff --git a/lib/rbot/irc.rb b/lib/rbot/irc.rb index 07ec6c37..326e25ef 100644 --- a/lib/rbot/irc.rb +++ b/lib/rbot/irc.rb @@ -273,7 +273,13 @@ class String # 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 @@ -1683,6 +1689,10 @@ module Irc 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 } |