summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/rbot/config-compat.rb25
-rw-r--r--lib/rbot/ircbot.rb1
2 files changed, 26 insertions, 0 deletions
diff --git a/lib/rbot/config-compat.rb b/lib/rbot/config-compat.rb
new file mode 100644
index 00000000..ee2cb613
--- /dev/null
+++ b/lib/rbot/config-compat.rb
@@ -0,0 +1,25 @@
+#-- vim:sw=2:et
+#++
+# :title: Config namespace backwards compatibility
+#
+# The move of everything rbot-related to the Irc::Bot::* namespace from Irc::*
+# would cause off-repo plugins to fail if they register any configuration key,
+# so we have to handle this case.
+#
+# Author:: Giuseppe Bilotta (giuseppe.bilotta@gmail.com)
+# Copyright:: Copyright (c) 2006 Giuseppe Bilotta
+# License:: GPLv2
+
+module Irc
+ Config = Bot::Config
+ module BotConfig
+ def BotConfig.register(*args)
+ warn "deprecated usage: please use Irc::Bot::Config instead of Irc::BotConfig (e.g. Config.register instead of BotConfig.register, Config::<type>Value instead of BotConfig<type>Value"
+ Bot::Config.register(*args)
+ end
+ end
+
+ Bot::Config.constants.each { |c|
+ Irc.module_eval("BotConfig#{c} = Bot::Config::#{c}")
+ }
+end
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb
index e2f3f28e..cab24ddd 100644
--- a/lib/rbot/ircbot.rb
+++ b/lib/rbot/ircbot.rb
@@ -102,6 +102,7 @@ $interrupted = 0
require 'rbot/rbotconfig'
require 'rbot/load-gettext'
require 'rbot/config'
+require 'rbot/config-compat'
# require 'rbot/utils'
require 'rbot/irc'