diff -x comments.rb -x hobix.rb -x CVS -x webapp.rb -uNr hobix/lib/hobix/facets/trackbacks.rb hobix.ljb/lib/hobix/facets/trackbacks.rb
--- hobix/lib/hobix/facets/trackbacks.rb	Thu Jan  1 01:00:00 1970
+++ hobix.ljb/lib/hobix/facets/trackbacks.rb	Sun Jul 24 08:50:03 2005
@@ -0,0 +1,92 @@
+#
+# = hobix/facets/trackbacks.rb
+#
+# Hobix command-line weblog system, support for trackbacks.
+#
+# Copyright (c) 2003-2004 why the lucky stiff
+#
+# Written & maintained by why the lucky stiff <why@ruby-lang.org>
+#
+# This program is free software, released under a BSD license.
+# See COPYING for details.
+#
+#--
+# $Id$
+#++
+
+require 'hobix/entry'
+
+module Hobix
+module Facets
+
+# The Trackbacks plugin adds support for the TrackBack specification
+# (http://www.sixapart.com/pronet/docs/trackback_spec).
+#
+# Add this require to your hobix.yaml:
+#
+#   requires:
+#   - hobix/trackbacks
+#
+class Trackbacks < BaseFacet
+    FieldMap = {
+      'blog_name' => 'author',
+      'url'       => 'link',
+      'title'     => 'title',
+      'excerpt'   => 'content'
+    }
+
+    def self.trackback_required_fields; ['url']; end
+    def self.trackback_additional_fields; ['title', 'excerpt', 'blog_name']; end
+    def self.entry_field(name); FieldMap[name]; end
+    def self.trackback_class; Hobix::Entry end
+
+    def initialize( weblog, defaults = {} )
+        @weblog = weblog
+    end
+    def get app
+        if app.respond_to? :action_uri
+            action, entry_id = app.action_uri.split( '/', 2 )
+            case action
+            when "trackback"
+                # Create a trackback comment
+                on_entry = @weblog.storage.load_entry( entry_id )
+                trackback = Trackbacks.trackback_class.new do |t|
+                    Trackbacks.trackback_additional_fields.each do |tf|
+                      t.method( "#{ Trackbacks.entry_field(tf) }=" ).call( app._POST[tf].to_s )
+                    end
+                    Trackbacks.trackback_required_fields.each do |tf|
+                      value = app._POST[tf].to_s
+                      return send_response( app, false, 'Missing URL field' ) if value.empty?
+                      t.method( "#{ Trackbacks.entry_field(tf) }=" ).call( value )
+                    end
+                    t.content = %{"#{t.title}":#{t.link}\n\n#{t.content}}
+                    t.created = Time.now
+                end
+                comments = @weblog.storage.load_attached( entry_id, 'comments' ) rescue []
+                comments << trackback
+
+                # Save the attachment, upgen
+                @weblog.storage.save_attached( entry_id, "comments", comments )
+                @weblog.regenerate :update
+
+                # Send response
+                send_response( app, true )
+                return true
+            end
+        end
+    end
+
+    def send_response(app, ok = true, message = nil)
+      app.content_type = 'text/xml'
+      app.puts %{<?xml version="1.0" encoding="UTF-8"?>
+        <response>
+          <error>%d</error>
+          %s
+        </response>
+      } % [ok ? 0 : 1, message ? %{<message>#{message}</message>} : '']
+      true
+    end
+end
+
+end
+end
diff -x comments.rb -x hobix.rb -x CVS -x webapp.rb -uNr hobix/lib/hobix/trackbacks.rb hobix.ljb/lib/hobix/trackbacks.rb
--- hobix/lib/hobix/trackbacks.rb	Thu Jan  1 01:00:00 1970
+++ hobix.ljb/lib/hobix/trackbacks.rb	Sun Jul 24 06:43:29 2005
@@ -0,0 +1,17 @@
+#
+# = hobix/trackbacks.rb
+#
+# Hobix command-line weblog system, API for trackbacks.
+#
+# Copyright (c) 2003-2004 why the lucky stiff
+#
+# Written & maintained by why the lucky stiff <why@ruby-lang.org>
+#
+# This program is free software, released under a BSD license.
+# See COPYING for details.
+#
+#--
+# $Id$
+#++
+
+require 'hobix/facets/trackbacks'
