diff -Naur temp/comment_service.info comment_service/comment_service.info
--- temp/comment_service.info	1970-01-01 01:00:00.000000000 +0100
+++ comment_service/comment_service.info	2008-04-12 16:33:12.000000000 +0200
@@ -0,0 +1,5 @@
+; $Id$
+name = Comment Service
+description = Provides a comment service.
+package = Services - services
+dependencies = services comment
diff -Naur temp/comment_service.module comment_service/comment_service.module
--- temp/comment_service.module	1970-01-01 01:00:00.000000000 +0100
+++ comment_service/comment_service.module	2008-04-16 23:02:25.000000000 +0200
@@ -0,0 +1,181 @@
+<?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(
+
+    // node.comments.save
+   array(
+      '#method'   => 'comment.save',
+      '#callback' => 'comment_service_save',
+      '#args'     => array(
+        array(
+          '#name'         => 'comment',
+          '#type'         => 'struct',
+          '#optional'     => FALSE,
+          '#description'  => t('A comment object.'))),
+      '#return' => 'int',
+      '#help' => t('This method adds a comment to a node and returns a comment id.  If the comment object contains a numeric "cid", then the comment will be updated. Required fields: nid, comment. Optional fields: cid (comment id), pid (parent comment), subject, mail, homepage')),
+
+    // node.comments.all
+    array(
+      '#method'   => 'comment.load',
+      '#callback' => 'comment_service_node_comments_all',
+      '#args'     => array(
+        array(
+          '#name'         => 'nid',
+          '#type'         => 'int',
+          '#optional'     => false,
+          '#description'  => t('A node id.')),
+        array(
+          '#name'         => 'count',
+          '#type'         => 'int',
+          '#optional'     => TRUE,
+          '#description'  => t('Number of comments to load.')),
+        array(
+          '#name'         => 'start',
+          '#type'         => 'int',
+          '#optional'     => TRUE,
+          '#description'  => t('If count is set to non-zero value, You can pass also non-zero value for start. For example to get comments from 5 to 15, pass count=10 and start=5.')),
+        array(
+          '#name'         => 'fields',
+          '#type'         => 'array',
+          '#optional'     => TRUE,
+          '#description'  => t('A list of fields to return.'))),
+      '#return' => 'array',
+      '#help'   => t('This method returns all or part of the comments on a given node.')),
+
+    // node.comments.countAll
+    array(
+      '#method'   => 'comment.countAll',
+      '#callback' => 'comment_service_node_comments_count_all',
+      '#args'     => array(
+        array('#name' => 'nid',
+          '#type'         => 'int',
+          '#optional'     => false,
+          '#description'  => t('A node id.'))),
+      '#return' => 'int',
+      '#help'   => t('This method returns the number of comments on a given node.')),
+
+    // node.comments.countNew
+    array(
+      '#method'   => 'comment.countNew',
+      '#callback' => 'comment_service_node_comments_count_new',
+      '#args'      => array(
+        array(
+          '#name'         => 'nid',
+          '#type'         => 'int',
+          '#optional'     => false,
+          '#description'  => t('A node id')),
+        array(
+          '#name'         => 'since',
+          '#type'         => 'int',
+          '#optional'     => true,
+          '#description'  => t('Time to count from (defaults to time of last user acces to node).'))),
+      '#return' => 'int',
+      '#help'   => t('This method returns the number of new comments on a given node since a given timestamp.')),
+  );
+}
+
+/**
+ * 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) {
+  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 || comment_num_replies($comment->cid) != 0) && !$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_node_comments_all($nid, $count = 0, $start = 0, $fields = array()) {
+  if (!user_access('access comments')) return services_error(t('Access denied'));
+
+  $limit = ((int)$count > 0 ? ' LIMIT '.(int)$start.', '.(int)$count.' ' : '');
+  if (!user_access('administer comments')) {
+    $result = db_query("SELECT c.*, u.name FROM {comments} c, {users} u WHERE u.uid = c.uid AND nid = %d AND c.status = %d ORDER BY thread DESC".$limit, $nid, COMMENT_PUBLISHED);
+  }
+  else {
+    $result = db_query("SELECT * FROM {comments} c, {users} u WHERE u.uid = c.uid AND nid = %d ORDER BY thread DESC".$limit, $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;
+    }
+
+    // safety check
+    if (!user_access('administer comments')) {
+      unset($temp->hostname);
+      unset($temp->pass);
+      unset($temp->mail);
+    }
+
+    $comments[] = $temp;
+  }
+
+  return $comments;
+}
+
+/**
+ * Returns the number of comments on a given node id.
+ */
+function comment_service_node_comments_count_all($nid) {
+  if (!user_access('access comments')) return services_error(t('Access denied'));
+
+  return comment_num_all($nid);
+}
+
+/**
+ * Returns the number of new comments on a given node id since timestamp.
+ */
+function comment_service_node_comments_count_new($nid, $since = 0) {
+  if (!user_access('access comments')) return services_error(t('Access denied'));
+
+  return comment_num_new($nid, $timestamp);
+}
