diff options
author | Jay Thomas <degradinglight@gmail.com> | 2013-04-25 21:15:58 -0400 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2013-04-26 08:24:54 +0200 |
commit | a1cb62bab38e6a5545356d885040bc744c2e5605 (patch) | |
tree | efecc78ebb8ebde313a04f8f2bab1ad075a33b97 /data/rbot/plugins | |
parent | a71bf77b72e7a0a7dd7d23953f4dde31eb47ac46 (diff) |
note: upgrade old registry keys on initialize
Diffstat (limited to 'data/rbot/plugins')
-rw-r--r-- | data/rbot/plugins/note.rb | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/data/rbot/plugins/note.rb b/data/rbot/plugins/note.rb index 0c1683a6..227beaa7 100644 --- a/data/rbot/plugins/note.rb +++ b/data/rbot/plugins/note.rb @@ -9,10 +9,26 @@ # License:: MIT license class NotePlugin < Plugin + Note = Struct.new('Note', :time, :from, :private, :text) - def help(plugin, topic="") - "note <nick> <string> => stores a note (<string>) for <nick>" + def initialize + super + return if @registry.nil? or @registry.length < 1 + debug 'Checking registry for old-formatted notes...' + n = 0 + @registry.dup.each_key do |key| + unless key == key.downcase + @registry[key.downcase] = @registry[key] + @registry[key.downcase] + @registry.delete key + n += 1 + end + end + debug "#{n} entries converted and merged." + end + + def help(plugin, topic='') + 'note <nick> <string> => stores a note (<string>) for <nick>' end def message(m) @@ -33,7 +49,7 @@ class NotePlugin < Plugin end if !priv.empty? - @bot.say m.sourcenick, "you have notes! " + priv.join(' ') + @bot.say m.sourcenick, 'you have notes! ' + priv.join(' ') end @registry.delete nick rescue Exception => e |