Index: modules/blogapi.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/blogapi.module,v
retrieving revision 1.65
diff -u -r1.65 blogapi.module
--- modules/blogapi.module	9 Nov 2005 19:03:35 -0000	1.65
+++ modules/blogapi.module	15 Nov 2005 17:39:41 -0000
@@ -214,6 +214,8 @@
     $edit['body'] = $content;
   }
 
+  blogapi_invoke_blogapi($edit, 'new', $content);
+
   if (!valid_input_data($edit['title'], $edit['body'])) {
     return blogapi_error(t('Terminated request because of suspicious input data.'));
   }
@@ -273,6 +275,8 @@
     $node->body = $content;
   }
 
+  blogapi_invoke_blogapi($node, 'edit', $content);
+
   if (!valid_input_data($node->title, $node->body)) {
     return blogapi_error(t('Terminated request because of suspicious input data.'));
   }
@@ -740,3 +744,29 @@
   return $types;
 }
 
+/**
+ * Invoke a hook_blogapi() operation in all modules.
+ *
+ * @param &$node
+ *   A node object.
+ * @param $op
+ *   A string containing the name of the blogapi operation.
+ * @param $a3
+ *   Arguments to pass on to the hook, after the $node and $op arguments.
+ * @return
+ *   The returned value of the invoked hooks.
+ */
+function blogapi_invoke_blogapi(&$node, $op, $a3 = NULL) {
+  $return = array();
+  foreach (module_implements('blogapi') as $name) {
+    $function = $name .'_blogapi';
+    $result = $function($node, $op, $a3);
+    if (is_array($result)) {
+      $return = array_merge($return, $result);
+    }
+    else if (isset($result)) {
+      $return[] = $result;
+    }
+  }
+  return $return;
+}
