diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-24 08:08:37 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-24 08:08:37 +0000 |
commit | b276236fed7673ec427b64dd57f6cb05d0784ebf (patch) | |
tree | 3f9800eef75a22a4a6b306fc9baa02662d88916c /lib | |
parent | d82b04ba5d10cff7f9b601fc6d4b2b01795016f7 (diff) |
core/userdata: store transient data too, keyed by (first-and-only) netmask
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rbot/core/userdata.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/rbot/core/userdata.rb b/lib/rbot/core/userdata.rb index 8a056820..34ed48ad 100644 --- a/lib/rbot/core/userdata.rb +++ b/lib/rbot/core/userdata.rb @@ -52,6 +52,7 @@ class UserDataModule < CoreBotModule def initialize super @ircuser = @registry.sub_registry('ircuser') + @transient = @registry.sub_registry('transient') @botuser = @registry.sub_registry('botuser') end @@ -61,12 +62,14 @@ class UserDataModule < CoreBotModule ih = @ircuser[iu.nick] || {} - if bu.transient? or bu.default? + if bu.default? return ih + elsif bu.transient? + bh = @transient[bu.netmasks.first.fullform] || {} else bh = @botuser[bu.username] || {} - return ih.merge! bh end + return ih.merge! bh end def get_data(user, key=nil) @@ -81,9 +84,14 @@ class UserDataModule < CoreBotModule bu = iu.botuser @ircuser[iu.nick] = h - unless bu.transient? or bu.default? + return h if bu.default? + + if bu.transient? + @transient[bu.netmasks.first.fullform] = h + else @botuser[bu.username] = h end + return h end def set_data(user, key, value=nil, &block) |