? nodecomment_actions.patch
Index: nodecomment.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nodecomment/nodecomment.module,v
retrieving revision 1.3.2.15.2.17.2.41
diff -u -p -r1.3.2.15.2.17.2.41 nodecomment.module
--- nodecomment.module	28 Jan 2010 17:29:16 -0000	1.3.2.15.2.17.2.41
+++ nodecomment.module	10 Feb 2010 03:00:27 -0000
@@ -566,6 +566,9 @@ function nodecomment_nodeapi(&$node, $op
       // if this is a comment, save it as a comment
       if (isset($node->comment_target_nid)) {
         nodecomment_save($node);
+        // invoke the nodecomment trigger 
+        // in order to call the associated actions.
+        module_invoke_all('nodecomment', 'insert', $node);
       }
       break;
 
@@ -1245,3 +1248,48 @@ function theme_nodecomment_topic_review(
 
   return $output;
 }
+/**
+ * Implementation of hook_hook_info().
+ */
+function nodecomment_hook_info() {
+  return array(
+  'nodecomment' => array(
+    'insert' => array(
+        'runs when' => t('After saving a new node comment'),
+      ),
+    ),
+  );
+}
+/**
+ * Implementation of hook_nodecomment()
+ * 
+ * This hook is a trigger used for calling the associated actions.
+ */
+ function nodecomment_nodecomment($op, $node) {
+  $aids = _trigger_get_hook_aids('nodecomment', $op);
+  $context = array(
+    'hook' => 'nodecomment',
+    'op' => $op,
+    'node' => $node,
+  );
+  actions_do(array_keys($aids), $node, $context);
+}
+
+/**
+ * Implementation of hook_info_alter()
+ * 
+ * Since node comments are nodes, actions of type node and system can be 
+ * applied.
+ */
+function nodecomment_action_info_alter(&$info) {
+    foreach ($info as $type => $data) {
+      if (stripos($type, "node_") === 0 || stripos($type, "system_") === 0) {
+        if (isset($info[$type]['hooks']['application'])) {
+          array_merge($info[$type]['hooks']['nodecomment'], array('insert',));
+        }
+       else {
+         $info[$type]['hooks']['nodecomment'] = array('insert',);
+       }
+     }
+   }
+ }
\ No newline at end of file
