diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-04 01:50:40 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-04 01:50:40 +0000 |
commit | c2f8deb3bbf44b4bb2996a883c3b7eaef7e52c63 (patch) | |
tree | f12e8347197421fa6764f2c64f9f7c1d2da7d9ba /lib/rbot/botuser.rb | |
parent | 8e0ee28c87a38ddc266b2d63b6b1c34cb99875dd (diff) |
New Auth Framework: dream about auto-notifying hashes, and use #replace() when loading data
Diffstat (limited to 'lib/rbot/botuser.rb')
-rw-r--r-- | lib/rbot/botuser.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/rbot/botuser.rb b/lib/rbot/botuser.rb index c3c37a50..76785be8 100644 --- a/lib/rbot/botuser.rb +++ b/lib/rbot/botuser.rb @@ -10,6 +10,22 @@ require 'singleton'
require 'set'
+# This would be a good idea if it was failproof, but the truth
+# is that other methods can indirectly modify the hash. *sigh*
+#
+# class AuthNotifyingHash < Hash
+# %w(clear default= delete delete_if replace invert
+# merge! update rehash reject! replace shift []= store).each { |m|
+# class_eval {
+# define_method(m) { |*a|
+# r = super(*a)
+# Irc::Auth.authmanager.set_changed
+# r
+# }
+# }
+# }
+# end
+#
module Irc
@@ -274,6 +290,7 @@ module Irc @perm = {}
+ # @data = AuthNotifyingHash.new
@data = {}
end
@@ -345,7 +362,7 @@ module Irc @perm = h[:perm] if h.has_key?(:perm)
@login_by_mask = h[:login_by_mask] if h.has_key?(:login_by_mask)
@autologin = h[:autologin] if h.has_key?(:autologin)
- @data = h[:data] if h.has_key?(:data)
+ @data.replace(h[:data]) if h.has_key?(:data)
end
# This method sets the password if the proposed new password
|