Index: comment_driven.module
===================================================================
--- comment_driven.module	(revision 2503)
+++ comment_driven.module	(working copy)
@@ -540,3 +540,11 @@
   module_load_include('inc', 'comment_driven', 'comment_driven.admin');
   return _comment_driven_driven_global_settings_form();
 }
+
+/**
+ * Helper function to insert a comment driven log message
+ */
+function comment_driven_insert_log($cid, $old_vid, $new_vid, $changes, $diff_render) {
+  $query = "INSERT INTO {comment_driven_log}(cid, old_vid, new_vid, changes, diff_render, timestamp) VALUES(%d, %d, %d, '%s', '%s', %d)";
+  db_query($query, $cid, $old_vid, $new_vid, serialize($changes), serialize($diff_render), time());
+}
Index: comment_driven_nodeapi/comment_driven_nodeapi.info
===================================================================
--- comment_driven_nodeapi/comment_driven_nodeapi.info	(revision 0)
+++ comment_driven_nodeapi/comment_driven_nodeapi.info	(revision 0)
@@ -0,0 +1,11 @@
+; $Id$
+
+name = Comment driven NodeAPI
+description = Adds support for comments not inserted via FAPI
+
+package = Driven
+; @d6
+core = 6.x
+
+dependencies[] = comment_driven
+dependencies[] = driven_inspect
Index: comment_driven_nodeapi/comment_driven_nodeapi.module
===================================================================
--- comment_driven_nodeapi/comment_driven_nodeapi.module	(revision 0)
+++ comment_driven_nodeapi/comment_driven_nodeapi.module	(revision 0)
@@ -0,0 +1,28 @@
+<?php
+// $Id $
+
+/**
+ * Implements hook_nodeapi().
+ *
+ * On presave, load the previous version of the node from the db and see what's changed.
+ *
+ * On update (after the node has actually been saved to the db and we have the new vid), actually insert the comment_driven log.
+ */
+function comment_driven_nodeapi_nodeapi(&$node, $op, $a3 = NULL, $a4  = NULL) {
+  if (isset($node->associated_cid)) {
+    switch ($op) {
+      case 'presave':
+        $node_before = node_load($node->nid);
+        $driven_props = driven_properties_available($node->type);
+        $node->comment_driven_changes = driven_inspect_diff_nodes($node_before, $node, $driven_props);
+        break;
+      case 'update':
+        if (isset($node->comment_driven_changes)) {
+          $diff_render = driven_diff_render($node->type, $node->comment_driven_changes);
+          $old_vid = $node->old_vid ? $node->old_vid : $node->vid;
+          comment_driven_insert_log($node->associated_cid, $old_vid, $node->vid, $node->comment_driven_changes, $diff_render);
+        }
+        break;
+      }
+  }
+}
