<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -8,7 +8,8 @@ require &quot;#{BOT_ROOT}/lib/event&quot;
 require &quot;#{BOT_ROOT}/lib/plugin&quot;
 
 # This requires my fork of tinder for the time being
-require &quot;#{BOT_ROOT}/../tinder/lib/tinder&quot;
+# http://github.com/timriley/tinder/tree
+require 'tinder'
 
 module CampfireBot
   class Bot
@@ -19,7 +20,7 @@ module CampfireBot
     attr_reader :campfire, :room, :config
   
     def initialize
-      @config   = YAML::load(File.read(File.join(File.dirname(__FILE__), 'config.yml')))[BOT_ENVIRONMENT]
+      @config   = YAML::load(File.read(&quot;#{BOT_ROOT}/config.yml&quot;))[BOT_ENVIRONMENT]
     end
   
     def connect
@@ -43,8 +44,8 @@ module CampfireBot
           # EventHanlder.handle_time(optional_arg = Time.now)
         
           # Run time-oriented events
-          PluginBase.registered_intervals.each        { |handler| handler.run }
-          PluginBase.registered_times.each_with_index { |handler, index| PluginBase.registered_times.delete_at(index) if handler.run }
+          Plugin.registered_intervals.each        { |handler| handler.run }
+          Plugin.registered_times.each_with_index { |handler, index| Plugin.registered_times.delete_at(index) if handler.run }
         
           sleep interval
         end
@@ -54,16 +55,21 @@ module CampfireBot
     private
   
     def load_plugins
-      Dir[&quot;#{File.dirname(__FILE__)}/plugins/*.rb&quot;].each{|x| load x }
+      Dir[&quot;#{BOT_ROOT}/plugins/*.rb&quot;].each{|x| load x }
+      
+      # And instantiate them
+      Plugin.registered_plugins.each_pair do |name, klass|
+        Plugin.registered_plugins[name] = klass.new
+      end
     end
   
     def handle_message(msg)
       puts
       puts msg.inspect
     
-      PluginBase.registered_commands.each { |handler| handler.run(msg) }
-      PluginBase.registered_speakers.each { |handler| handler.run(msg) }
-      PluginBase.registered_messages.each { |handler| handler.run(msg) }
+      Plugin.registered_commands.each { |handler| handler.run(msg) }
+      Plugin.registered_speakers.each { |handler| handler.run(msg) }
+      Plugin.registered_messages.each { |handler| handler.run(msg) }
     end
   end
 end</diff>
      <filename>lib/bot.rb</filename>
    </modified>
    <modified>
      <diff>@@ -17,7 +17,7 @@ module CampfireBot
     
       def run(msg, force = false)
         if force || match?(msg)
-          PluginBase.registered_plugins[@plugin].send(@method, filter_message(msg))
+          Plugin.registered_plugins[@plugin].send(@method, filter_message(msg))
         else
           false
         end
@@ -80,7 +80,7 @@ module CampfireBot
   
       def run(force = false)
         if match?
-          PluginBase.registered_plugins[@plugin].send(@method)
+          Plugin.registered_plugins[@plugin].send(@method)
           @last_run = Time.now
         else
           false
@@ -102,7 +102,7 @@ module CampfireBot
   
       def run(force = false)
         if match?
-          PluginBase.registered_plugins[@plugin].send(@method)
+          Plugin.registered_plugins[@plugin].send(@method)
           @run = true
         else
           false</diff>
      <filename>lib/event.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,84 +1,74 @@
-module CampfireBot
-  module Plugin
-  
-    module PluginSugar
-      def def_field(*names)
-        class_eval do 
-          names.each do |name|
-            define_method(name) do |*args| 
-              case args.size
-                when 0: instance_variable_get(&quot;@#{name}&quot;)
-                else    instance_variable_set(&quot;@#{name}&quot;, *args)
-              end
-            end
-          end
-        end
+module CampfireBot  
+  class Plugin
+    @registered_plugins   = {}
+    
+    @registered_commands  = []
+    @registered_messages  = []
+    @registered_speakers  = []
+    @registered_intervals = []
+    @registered_times     = []
+    
+    class &lt;&lt; self
+      attr_reader :registered_plugins,
+                  :registered_commands,
+                  :registered_messages,
+                  :registered_speakers,
+                  :registered_intervals,
+                  :registered_times
+
+      # Registering plugins
+
+      def inherited(child)
+        Plugin.registered_plugins[child.to_s] = child
       end
-    end
 
-    class Base
-      @registered_plugins   = {}
-      
-      class &lt;&lt; self
-        extend PluginSugar
-        def_field :author, :version
-    
-        attr_reader :registered_plugins
+      # Event handlers
 
-        # Registering plugins
-  
-        def inherited(child)
-          PluginBase.registered_plugins[child.to_s] = child.new
+      def on_command(command, *methods)
+        methods.each do |method|
+          Plugin.registered_commands &lt;&lt; Event::Command.new(command, self.to_s, method)
         end
+      end
 
-        # Event handlers
-  
-        def on_command(command, *methods)
-          methods.each do |method|
-            registered_handlers &lt;&lt; CampfireBot::Event::Command.new(command, self.to_s, method)
-          end
-        end
-  
-        def on_message(regexp, *methods)
-          methods.each do |method|
-            registered_handlers &lt;&lt; CampfireBot::Event::Message.new(regexp, self.to_s, method)
-          end
+      def on_message(regexp, *methods)
+        methods.each do |method|
+          Plugin.registered_messages &lt;&lt; Event::Message.new(regexp, self.to_s, method)
         end
-  
-        def on_speaker(speaker, *methods)
-          methods.each do |method|
-            registered_handlers &lt;&lt; CampfireBot::Event::Speaker.new(speaker, self.to_s, method)
-          end
+      end
+
+      def on_speaker(speaker, *methods)
+        methods.each do |method|
+          Plugin.registered_speakers &lt;&lt; Event::Speaker.new(speaker, self.to_s, method)
         end
-  
-        def at_interval(interval, *methods)
-          methods.each do |method|
-            registered_handlers &lt;&lt; CampfireBot::Event::Interval.new(interval, self.to_s, method)
-          end
+      end
+
+      def at_interval(interval, *methods)
+        methods.each do |method|
+          Plugin.registered_intervals &lt;&lt; Event::Interval.new(interval, self.to_s, method)
         end
+      end
 
-        def at_time(timestamp, *methods)
-          methods.each do |method|
-            registered_handlers &lt;&lt; CampfireBot::Event::Time.new(timestamp, self.to_s, method)
-          end
+      def at_time(timestamp, *methods)
+        methods.each do |method|
+          Plugin.registered_times &lt;&lt; Event::Time.new(timestamp, self.to_s, method)
         end
       end
+    end
 
-      protected
+    protected
 
-      # Shortcuts to access the room
-  
-      def speak(words)
-        CampfireBot::Bot.instance.room.speak(words)
-      end
-  
-      def paste(words)
-        CampfireBot::Bot.instance.room.paste(words)
-      end
-  
-      def upload(file_path)
-        CampfireBot::Bot.instance.room.upload(file_path)
-      end
+    # Shortcuts to access the room
+
+    def speak(words)
+      CampfireBot::Bot.instance.room.speak(words)
+    end
+
+    def paste(words)
+      CampfireBot::Bot.instance.room.paste(words)
+    end
+
+    def upload(file_path)
+      CampfireBot::Bot.instance.room.upload(file_path)
     end
   end
 end
\ No newline at end of file</diff>
      <filename>lib/plugin.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 require 'open-uri'
 require 'hpricot'
 
-class Austin &lt; PluginBase
+class Austin &lt; CampfireBot::Plugin
   BASE_URL = 'http://www.imdb.com/character/ch0002425/quotes'
   
   on_command 'austin', :austin</diff>
      <filename>plugins/austin.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 require 'open-uri'
 require 'hpricot'
 
-class BeijingTally &lt; CampfireBot::Plugin::Base
+class BeijingTally &lt; CampfireBot::Plugin
   
   on_command 'tally', :tally
   </diff>
      <filename>plugins/beijing_tally.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,7 +11,7 @@ Tempfile.class_eval do
   end
 end
 
-class Calvin &lt; CampfireBot::Plugin::Base
+class Calvin &lt; CampfireBot::Plugin
   BASE_URL    = 'http://www.marcellosendos.ch/comics/ch/'
   START_DATE  = Date.parse('1984-08-14')
   END_DATE    = Date.parse('1995-12-31') # A sad day</diff>
      <filename>plugins/calvin.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 require 'open-uri'
 require 'hpricot'
 
-class Chuck &lt; CampfireBot::Plugin::Base
+class Chuck &lt; CampfireBot::Plugin
   on_command 'chuck', :chuck
   
   def chuck(msg)</diff>
      <filename>plugins/chuck.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,7 +11,7 @@ Tempfile.class_eval do
   end
 end
 
-class Dilbert &lt; CampfireBot::Plugin::Base
+class Dilbert &lt; CampfireBot::Plugin
   BASE_URL   = 'http://dilbert.com/'
   START_DATE = Date.parse('1996-01-01')
   </diff>
      <filename>plugins/dilbert.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
-class Fun &lt; CampfireBot::Plugin::Base
+class Fun &lt; CampfireBot::Plugin
   on_command    'say',              :say
-  on_message    Regexp.new(&quot;^#{Bot.instance.config['nickname']},\\s+(should|can|will|shall) (i|he|she|we|they) do it\\?&quot;, Regexp::IGNORECASE), :do_or_do_not
+  on_message    Regexp.new(&quot;^#{CampfireBot::Bot.instance.config['nickname']},\\s+(should|can|will|shall) (i|he|she|we|they) do it\\?&quot;, Regexp::IGNORECASE), :do_or_do_not
   on_message    /^(good morning|morning|m0ink).$/i, :greet
   # on_speaker    'Tim R.',           :agree_with_tim
   # on_message    /undo it/i,         :do_it</diff>
      <filename>plugins/fun.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 require 'open-uri'
 require 'hpricot'
 
-class Quote &lt; CampfireBot::Plugin::Base
+class Quote &lt; CampfireBot::Plugin
   on_command 'quote', :quote
   
   def quote(msg)</diff>
      <filename>plugins/quote.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 require 'open-uri'
 require 'hpricot'
 
-class Schneier &lt; PluginBase
+class Schneier &lt; CampfireBot::Plugin
   BASE_URL   = 'http://geekz.co.uk/schneierfacts/'
   
   on_command 'schneier', :schneier</diff>
      <filename>plugins/schneier.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 require 'yahoo-weather'
 
-class Weather &lt; CampfireBot::Plugin::Base
+class Weather &lt; CampfireBot::Plugin
   on_command 'weather', :weather
   
   def weather(msg)</diff>
      <filename>plugins/weather.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,7 +11,7 @@ Tempfile.class_eval do
   end
 end
 
-class Xkcd &lt; CampfireBot::Plugin::Base
+class Xkcd &lt; CampfireBot::Plugin
   BASE_URL = 'http://xkcd.com/'
   
   on_command 'xkcd', :xkcd</diff>
      <filename>plugins/xkcd.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,9 +1,10 @@
 #!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../lib/bot'
 
 # Run this script with the environment as the only argument. eg. ./script/bot development
 BOT_ENVIRONMENT = ARGV.first
-BOT_ROOT        = File.dirname(__FILE__)
+BOT_ROOT        = File.join(File.dirname(__FILE__), '..')
+
+require File.join(BOT_ROOT, 'lib', 'bot')
 
 bot.connect
 bot.run
\ No newline at end of file</diff>
      <filename>script/bot</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1071a20f1028292ffce00180bb55ee8250ed5891</id>
    </parent>
  </parents>
  <author>
    <name>Tim Riley</name>
    <email>tim@openmonkey.com</email>
  </author>
  <url>http://github.com/timriley/campfire-bot/commit/c66dc88de53eeac256d86b45d29f08f5b45e1cbe</url>
  <id>c66dc88de53eeac256d86b45d29f08f5b45e1cbe</id>
  <committed-date>2008-10-27T05:25:15-07:00</committed-date>
  <authored-date>2008-10-27T05:25:15-07:00</authored-date>
  <message>make the restructure work</message>
  <tree>cbab5f26c7d1db0d1e38d473a89f6c4a90e31a5a</tree>
  <committer>
    <name>Tim Riley</name>
    <email>tim@openmonkey.com</email>
  </committer>
</commit>
