<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>schema/migrations/001_add_mappings_destination_migration.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -8,7 +8,7 @@ Scans incoming emails for mapped recipients and sends an HTTP POST somewhere.
   @user.save
 
   # set a mapping to accept email for support@example.com
-  @mapping = @user.mappings.build(:email_user =&gt; 'support', :email_domain =&gt; 'example.com', :post_url =&gt; '...')
+  @mapping = @user.mappings.build(:email_user =&gt; 'support', :email_domain =&gt; 'example.com', :destination =&gt; '...')
   @mapping.save
   
   # you can also create wildcards for users:</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -10,7 +10,8 @@ class Mapping
   property :user_id,      Integer, :nullable =&gt; false, :index =&gt; true
   property :email_user,   String, :size =&gt; 255, :length =&gt; 1..255, :index =&gt; :email, :format =&gt; /^[\w\.\_\%\+\-]*\*?$/
   property :email_domain, String, :size =&gt; 255, :lenght =&gt; 1..255, :index =&gt; :email, :format =&gt; /^[\w\-\_\.]+$/, :default =&gt; lambda { default_domain }
-  property :post_url,     String, :size =&gt; 255, :length =&gt; 1..255, :unique_index =&gt; true, :unique =&gt; true, :format =&gt; /^https?:\/\/([\w\-\_\.]+)+(\/[\w\-\ \.\/\?\%\&amp;\=\[\]]*)?$/
+  property :destination,  String, :size =&gt; 255, :length =&gt; 1..255, :unique_index =&gt; true, :unique =&gt; true, :format =&gt; /^https?:\/\/([\w\-\_\.]+)+(\/[\w\-\ \.\/\?\%\&amp;\=\[\]]*)?$/
+  property :transport,    String, :size =&gt; 255, :set =&gt; %w(http_post jabber), :default =&gt; 'http_post'
 
   validates_is_unique :email_user, :scope =&gt; :email_domain
 
@@ -31,7 +32,7 @@ class Mapping
   end
 
   def process(message)
-    HttpPost.process(message, self)
+    Transport.process(message, self)
     log_message(message)
   end
 </diff>
      <filename>app/models/mapping.rb</filename>
    </modified>
    <modified>
      <diff>@@ -12,7 +12,7 @@ class Mapping
     end
 
     def request
-      @request ||= Curl::Easy.new(@mapping.post_url)
+      @request ||= Curl::Easy.new(@mapping.destination)
     end
 
     def post_fields</diff>
      <filename>app/models/mapping/http_post.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,7 +6,7 @@ class Mapping
 
     def process
       return unless Transport.processing
-      connection.deliver(@mapping.post_url, content)
+      connection.deliver(@mapping.destination, content)
     end
 
     def connection</diff>
      <filename>app/models/mapping/jabber.rb</filename>
    </modified>
    <modified>
      <diff>@@ -8,7 +8,10 @@ class Mapping
     attr_reader :message, :mapping
 
     def self.process(message, mapping)
-      new(message, mapping).process
+      case mapping.transport
+        when 'http_post' then HttpPost.process(message, mapping)
+        when 'jabber'    then Jabber.process(message, mapping)
+      end
     end
 
     def initialize(message, mapping)
@@ -18,5 +21,14 @@ class Mapping
 
     def process
     end
+
+    def self.inherited(child)
+      super
+      class &lt;&lt; child
+        def process(message, mapping)
+          new(message, mapping).process
+        end
+      end
+    end
   end
 end
\ No newline at end of file</diff>
      <filename>app/models/mapping/transport.rb</filename>
    </modified>
    <modified>
      <diff>@@ -13,7 +13,7 @@
   &lt;td&gt;
     &lt;%=h mapping.email_user %&gt;@astrotrain.com
   &lt;/td&gt;
-  &lt;td&gt;&lt;%=h mapping.post_url %&gt;&lt;/td&gt;
+  &lt;td&gt;&lt;%=h mapping.destination %&gt;&lt;/td&gt;
   &lt;td&gt;blah&lt;/td&gt;
 &lt;% end -%&gt;
 &lt;/table&gt;</diff>
      <filename>app/views/mappings/index.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -2,6 +2,6 @@
 
 &lt;%= form_for @mapping, :action =&gt; url(:mappings) do %&gt;
   &lt;p&gt;&lt;%= text_field :email_user, :label =&gt; &quot;Email&quot; %&gt;@&lt;%= text_field :email_domain %&gt;&lt;/p&gt;
-  &lt;p&gt;&lt;%= text_field :post_url, :label =&gt; &quot;Destination&quot; %&gt;&lt;/p&gt;
+  &lt;p&gt;&lt;%= text_field :destination, :label =&gt; &quot;Destination&quot; %&gt;&lt;/p&gt;
   &lt;p&gt;&lt;%= submit &quot;Create&quot; %&gt;&lt;/p&gt;
 &lt;% end =%&gt;
\ No newline at end of file</diff>
      <filename>app/views/mappings/new.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -20,7 +20,4 @@ end
  
 Merb::BootLoader.after_app_loads do
   require 'xmpp4r-simple'
-  require 'mapping/transport'
-  require 'mapping/http_post'
-  require 'mapping/jabber'
 end</diff>
      <filename>config/init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -65,8 +65,8 @@ describe Mapping do
     end
 
     %w(http://example.com https://example.com http://example.com/ http://example.com/foo http://example.com/foo/bar.html http://example.com/foo?blah[baz]=1).each do |valid|
-      it &quot;allows #post_url == #{valid.inspect}&quot; do
-        valid_mapping(:post_url =&gt; valid).should be_valid
+      it &quot;allows #destination == #{valid.inspect}&quot; do
+        valid_mapping(:destination =&gt; valid).should be_valid
       end
     end
 
@@ -84,7 +84,7 @@ describe Mapping do
 
   protected
     def valid_mapping(options = {})
-      Mapping.new({:user_id =&gt; 1, :post_url =&gt; 'http://foo.com', :email_user =&gt; 'sample'}.update(options))
+      Mapping.new({:user_id =&gt; 1, :destination =&gt; 'http://foo.com', :email_user =&gt; 'sample', :transport =&gt; 'http_post'}.update(options))
     end
   end
 end
\ No newline at end of file</diff>
      <filename>spec/models/mapping_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,7 +4,7 @@ describe Mapping::HttpPost do
   before :all do
     @post    = 'http://example.com'
     @message = Message.parse(mail(:basic))
-    @trans   = Mapping::HttpPost.new(@message, Mapping.new(:post_url =&gt; @post))
+    @trans   = Mapping::HttpPost.new(@message, Mapping.new(:destination =&gt; @post))
   end
 
   it &quot;sets #post_fields&quot; do
@@ -31,7 +31,7 @@ describe Mapping::Jabber do
   before :all do
     @dest    = 'foo@bar.com'
     @message = Message.parse(mail(:basic))
-    @trans   = Mapping::Jabber.new(@message, Mapping.new(:post_url =&gt; @dest))
+    @trans   = Mapping::Jabber.new(@message, Mapping.new(:destination =&gt; @dest))
   end
 
   it &quot;sets #content&quot; do</diff>
      <filename>spec/models/transport_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>c8b2e12049201af47ed010c994bb5ba15a695268</id>
    </parent>
  </parents>
  <author>
    <name>rick</name>
    <email>technoweenie@gmail.com</email>
  </author>
  <url>http://github.com/jnunemaker/astrotrain/commit/1bed1ed0a6254af39425f2abe4d48e566a22ab74</url>
  <id>1bed1ed0a6254af39425f2abe4d48e566a22ab74</id>
  <committed-date>2008-10-19T15:38:27-07:00</committed-date>
  <authored-date>2008-10-19T15:37:38-07:00</authored-date>
  <message>rename Mapping#post_url =&gt; Mapping#destination.  use the migration if you can, or DataMapper.auto_upgrade! if migrations are busted for you too</message>
  <tree>a4ef7500fb704225c5fe92db5152b541cb841ffa</tree>
  <committer>
    <name>rick</name>
    <email>technoweenie@gmail.com</email>
  </committer>
</commit>
