diff -Nurp services/services/comment_service/comment_service.info services_new/services/comment_service/comment_service.info
--- services/services/comment_service/comment_service.info	1969-12-31 16:00:00.000000000 -0800
+++ services_new/services/comment_service/comment_service.info	2008-03-29 20:16:06.000000000 -0700
@@ -0,0 +1,5 @@
+// $Id$
+name = Comment Service
+description = Provides a comment service.
+package = Services - services
+dependencies = services comment
diff -Nurp services/services/comment_service/comment_service.module services_new/services/comment_service/comment_service.module
--- services/services/comment_service/comment_service.module	1969-12-31 16:00:00.000000000 -0800
+++ services_new/services/comment_service/comment_service.module	2008-03-29 20:40:04.000000000 -0700
@@ -0,0 +1,205 @@
+<?php
+// $Id$
+
+/**
+ * Implementation of hook_help().
+ */
+function comment_service_help($section) {
+  switch ($section) {
+    case 'admin/help#services_comment':
+      return t('<p>Provides comment methods to services applications. Requires services.module.</p>');
+    case 'admin/modules#description':
+      return t('Provides comment methods to services applications. Requires services.module.');
+  }
+}
+
+/**
+ * Implementation of hook_service().
+ */
+function comment_service_service() {
+  return array(
+
+    // comment.saveComment method definition
+    array(
+      '#method' => 'comment.saveComment',
+      '#callback' => 'comment_service_save_comment',
+      '#args' =>      array(
+        array(  '#name' => 'comment',
+          '#type' => 'array',
+          '#optional' => FALSE,
+          '#description' => 'An array representing a comment'
+        )
+      ),
+      '#return' => 'int',
+      '#help' => 'This method adds a comment to a node and returns a comment id.  If a nonzero cid is specified in the comment array, then the comment with that cid is edited. Required fields: nid, comment. Optional fields: cid (comment id), pid (parent comment), subject, mail, homepage'
+    ),
+
+    // comment.getNodeComments method definition
+    array(
+      '#method' => 'comment.getNodeComments',
+      '#callback' => 'comment_service_get_node_comments',
+      '#args' =>      array(
+        array(  '#name' => 'nid',
+          '#type' => 'int',
+          '#optional' => false,
+          '#description' => 'the node id'
+        ),
+        array(  '#name' => 'fields',
+          '#type' => 'array',
+          '#optional' => TRUE,
+          '#description' => 'A list of fields to return.'
+        )
+      ),
+      '#return' => 'array',
+      '#help' => 'This method returns all of the comments on a given node.'
+    ),
+
+    // comment.getNodeCommentCount method definition
+    array(
+      '#method' => 'comment.getNodeCommentCount',
+      '#callback' => 'comment_service_get_node_comment_count',
+      '#args' =>      array(
+        array(  '#name' => 'nid',
+          '#type' => 'int',
+          '#optional' => false,
+          '#description' => 'the node id'
+        )
+      ),
+      '#return' => 'int',
+      '#help' => 'This method returns the number of comments on a given node.'
+    ),
+
+    // comment.getNodeNewCommentCount method definition
+    array(
+      '#method' => 'comment.getNodeNewCommentCount',
+      '#callback' => 'comment_service_get_node_new_comment_count',
+      '#args' =>      array(
+        array(  '#name' => 'nid',
+          '#type' => 'int',
+          '#optional' => false,
+          '#description' => 'the node id'
+        ),
+        array(  '#name' => 'timestamp',
+          '#type' => 'int',
+          '#optional' => true,
+          '#description' => 'time to count from (defaults to time of last user acces to node)'
+        )
+      ),
+      '#return' => 'int',
+      '#help' => 'This method returns the number of new comments on a given node since a given timestamp.'
+    ),
+
+    // comment.getMostCommentedNodes method definition
+    array(
+      '#method' => 'comment.getMostCommentedNodes',
+      '#callback' => 'comment_service_get_most_commented_nodes',
+      '#args' => array(
+        array(  '#name' => 'limit',
+          '#type' => 'int',
+          '#optional' => true,
+          '#description' => 'A limit on the number of nodes to return.  Default is 10 if not specified'
+        )
+      ),
+      '#return' => 'array',
+      '#help' => 'This method returns statistics on the nodes with the most comments.'
+    )
+
+  );
+}
+
+/**
+ * Adds a new comment to a node and returns the cid.
+ * If a cid is specified in $comment->cid then that comment is edited.
+ */
+function comment_service_save_comment($comment) {
+  global $user;
+
+  if (isset($comment['cid']) && ($comment['cid'] != 0)) {
+    // user is trying to edit a comment
+    $initial_comment = _comment_load($comment['cid']);
+    $admin = user_access("administer comments");
+
+    if ($initial_comment->uid == 0 && !$admin) {
+      return services_error(t("Anonymous comments can't be edited"));
+    }
+
+    if ($initial_comment->uid != $user->uid && !$admin) {
+      return services_error(t("User does not have permission to edit this comment"));
+    }
+  }
+
+  $comment['uid'] = $user->uid;
+  $comment['name'] = $user->name;
+  $comment['timestamp'] = time();
+
+  return comment_save($comment);
+}
+
+/**
+ * Returns the comments of a specified node.
+ */
+function comment_service_get_node_comments($nid, $fields = array()) {
+  if (!is_numeric($nid)) {
+    return services_error(t("Invalid nid"));
+  }
+
+  $result = db_query("SELECT * FROM {comments} c, {users} u WHERE u.uid = c.uid AND nid = %d ORDER BY thread DESC", $nid);
+  $comments = array();
+
+  while ($comment = db_fetch_object($result)) {
+    $temp = NULL;
+
+    // loop through and get only requested fields
+    if (count($fields) > 0) {
+      foreach ($fields as $field) {
+        $temp->{$field} = $comment->{$field};
+      }
+    } 
+    else {
+      $temp = $comment;
+    }
+    $comments[] = $temp;
+  }
+
+  return $comments;
+}
+
+/**
+ * Returns the number of comments on a given node id.
+ */
+function comment_service_get_node_comment_count($nid) {
+  if (!is_numeric($nid)) {
+    return services_error(t("Invalid nid"));
+  }
+
+  return comment_num_all($nid);
+}
+
+/**
+ * Returns the number of new comments on a given node id since timestamp.
+ */
+function comment_service_get_node_new_comment_count($nid, $timestamp = 0) {
+  if (!is_numeric($nid) || !is_numeric($timestamp)) {
+    return services_error(t("Invalid input"));
+  }
+
+  return comment_num_new($nid, $timestamp);
+}
+
+/**
+ * Returns information about the most commented nodes.
+ */
+function comment_service_get_most_commented_nodes($limit = 10) {
+  if (!is_numeric($limit)) {
+    return services_error(t("Invalid limit"));
+  }
+  $rows = array();
+
+  $result = db_query_range("SELECT * FROM {node_comment_statistics} ORDER BY comment_count DESC", 0, $limit);
+
+  while ($row = db_fetch_object($result)) {
+    $rows[] = $row;
+  }
+
+  return $rows;
+}
