Index: modules/commentrss/commentrss.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/commentrss/commentrss.info,v
retrieving revision 1.2
diff -U3 -r1.2 commentrss.info
--- modules/commentrss/commentrss.info	18 Jun 2007 22:53:34 -0000	1.2
+++ modules/commentrss/commentrss.info	4 Jul 2007 00:16:22 -0000
@@ -1,3 +1,10 @@
-; $Id: commentrss.info,v 1.2 2007/06/18 22:53:34 dww Exp $
+; $Id: commentrss.info,v 1.1.2.1 2007/06/18 23:06:34 dww Exp $
 name = Comment RSS
 description = Provides RSS feeds for comments
+dependencies = comment
+
+; Information added by drupal.org packaging script on 2007-06-19
+version = "5.x-1.x-dev"
+project = "commentrss"
+datestamp = "1182211595"
+
Index: modules/commentrss/commentrss.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/commentrss/commentrss.module,v
retrieving revision 1.12
diff -U3 -r1.12 commentrss.module
--- modules/commentrss/commentrss.module	18 Dec 2006 11:42:56 -0000	1.12
+++ modules/commentrss/commentrss.module	4 Jul 2007 00:16:22 -0000
@@ -77,22 +77,22 @@
 // For the master link in the RSS feed to work, you need vocabulary_list.module!
 function commentrss_feed_vocab() {
   global $base_url;
-  
+
   $vid = arg(2);
   if (is_numeric($vid)) {
-    
+
     $items = commentrss_format_items('DISTINCT(n.nid)', 'INNER JOIN {term_node} r ON n.nid = r.nid INNER JOIN {term_data} d ON r.tid = d.tid', 'd.vid = %d AND', $vid);
     $vocab = taxonomy_get_vocabulary($vid);
-    
+
     // We can link to a specific page if vocabulary listing is present
     $link = (module_exist('vocabulary_list') ? url("taxonomy/vocabulary/$vid", NULL, NULL, TRUE) : $base_url);
-    
+
     $channel = array(
       'title'       => check_plain(variable_get('site_name', 'drupal') .' - '. $vocab->name) .' - '. t('Comments'),
       'link'        => $link,
       'description' => t('Comments for "@title"', array("@title" => $vocab->name)),
     );
-    
+
     commentrss_format_feed($items, $channel);
     return TRUE;
   }
@@ -103,16 +103,16 @@
 function commentrss_feed_term() {
   $tid = arg(2);
   if (is_numeric($tid)) {
-    
+
     $items = commentrss_format_items('DISTINCT(n.nid)', 'INNER JOIN {term_node} r ON n.nid = r.nid', 'r.tid = %d AND', $tid);
     $term = taxonomy_get_term($tid);
-    
+
     $channel = array(
       'title'       => check_plain(variable_get('site_name', 'drupal') .' - '. $term->name) .' - '. t('Comments'),
       'link'        => url("taxonomy/term/$tid", NULL, NULL, TRUE),
       'description' => t('Comments for "@title"', array("@title" => $term->name)),
     );
-    
+
     commentrss_format_feed($items, $channel);
     return TRUE;
   }
@@ -170,13 +170,13 @@
     }
     $items .= format_rss_item($item->title, $link, $item_text, $extra);
     // COPIED from node_feed() end
-    
+
     $channel = array(
       'title'       => check_plain(variable_get('site_name', 'drupal') .' - '. $item->title) .' - '. t('Comments'),
       'link'        => $link,
       'description' => t('Comments for "@title"', array("@title" => $item->title)),
     );
-    
+
     commentrss_format_feed($items, $channel, $namespaces);
     return TRUE;
   }
@@ -187,9 +187,9 @@
 function commentrss_feed_nodetype() {
   $type = arg(2);
   if (preg_match("!^[a-z0-9-]+$!", $type)) {
-    
+
     $items = commentrss_format_items('n.nid', '', "n.type = '%s' AND", $type);
-    
+
     $typename = node_get_types('name', $type);
     $channel = array(
       'title'       => check_plain(variable_get('site_name', 'drupal') .' - '. $typename) .' - '. t('Comments'),
@@ -197,7 +197,7 @@
       //'link'        => url("nodesbytype/$type", NULL, NULL, TRUE),
       'description' => t('Comments for "@type"', array("@type" => $typename)),
     );
-    
+
     commentrss_format_feed($items, $channel);
     return TRUE;
   }
@@ -208,7 +208,7 @@
 // This is a customized version of the core node_feed()
 function commentrss_format_feed($items, $channel = array(), $namespaces = array()) {
   global $base_url, $locale;
-  
+
   $channel_defaults = array(
     'version'     => '2.0',
     'title'       => check_plain(variable_get('site_name', 'drupal')) . ' - ' . t('Comments'),
@@ -218,7 +218,7 @@
   );
   $channel = array_merge($channel_defaults, $channel);
   $namespaces = array_merge(array('xmlns:dc="http://purl.org/dc/elements/1.1/"'), $namespaces);
-  
+
   $output = '<?xml version="1.0" encoding="utf-8"?>' . "\n";
   $output .= '<rss version="'. $channel["version"] . '" xml:base="'. $base_url .'" ' . implode(' ', $namespaces) . ">\n";
   $output .= format_rss_channel($channel['title'], $channel['link'], $channel['description'], $items, $channel['language']);
@@ -257,3 +257,23 @@
   }
   return $items;
 }
+
+/**
+ * Implementation of hook_nodeapi().
+ */
+function commentrss_nodeapi(&$node, $op, $arg = 0) {
+  if ($op == 'rss item') {
+    if ($node->comment != COMMENT_NODE_DISABLED) {
+      // Add a "wfw:commentRss" attribute to node feeds. The "wfw"
+      // namespace is added to each element since there is currently no
+      // easy way to add the namespace to the document from a module.
+      return array(array(
+        'key' => 'wfw:commentRss',
+        'attributes' => array('xmlns:wfw' => 'http://wellformedweb.org/CommentAPI/'),
+        'value' => url('crss/node/'. $node->nid .'/feed', NULL, NULL, TRUE)));
+    }
+    else {
+      return array();
+    }
+  }
+}
