summaryrefslogtreecommitdiff
path: root/lib/rbot
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-09-12 22:31:18 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-09-12 22:31:18 +0000
commit045ced17bc590548d816bb9b7a252ae34898db5d (patch)
tree0aebd5c48fdbfdb6910a61d3d617a2be92ef78a6 /lib/rbot
parent6f5528a63b44e610a3d25d7fe583399163d7d2da (diff)
namespaces: provide backwards compatibility methods for BotConfig.register and related classes
Diffstat (limited to 'lib/rbot')
-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'