### Eclipse Workspace Patch 1.0
#P drupal-cvs
Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.541
diff -u -r1.541 comment.module
--- modules/comment/comment.module	30 Apr 2007 17:03:24 -0000	1.541
+++ modules/comment/comment.module	11 May 2007 00:56:58 -0000
@@ -1453,6 +1453,10 @@
   global $user;
 
   $op = isset($_POST['op']) ? $_POST['op'] : '';
+  
+  if (!$user->uid && variable_get('comment_anonymous', COMMENT_ANONYMOUS_MAYNOT_CONTACT) != COMMENT_ANONYMOUS_MAYNOT_CONTACT) {
+    drupal_add_js(drupal_get_path('module', 'comment').'/comment.js');
+  }
 
   if ($user->uid) {
     if (!empty($edit['cid']) && user_access('administer comments')) {
@@ -1710,6 +1714,11 @@
 }
 
 function comment_form_submit($form_id, $form_values) {
+  foreach (array('name','homepage','mail') as $field) {
+    if (!setcookie('comment_info_'.$field, $form_values[$field], time()+31536000)) {  //set cookie for 365 days
+      watchdog('content', 'Comment: failed to save cookie on node %node', array('%node' => $form_values['nid']), WATCHDOG_ERROR);
+    }
+  }
   $form_values = _comment_form_submit($form_values);
   if ($cid = comment_save($form_values)) {
     return array('node/'. $form_values['nid'], NULL, "comment-$cid");
Index: modules/comment/comment.js
===================================================================
RCS file: modules/comment/comment.js
diff -N modules/comment/comment.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/comment/comment.js	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,29 @@
+// $Id: $
+if (Drupal.jsEnabled) {
+  $(document).ready(function() {
+    $("#comment-form input[@name=name]").val(Drupal.comment.getCookie('comment_info_name'));
+    $("#comment-form input[@name=mail]").val(Drupal.comment.getCookie('comment_info_mail'));
+    $("#comment-form input[@name=homepage]").val(Drupal.comment.getCookie('comment_info_homepage'));
+  });
+};
+
+Drupal.comment = {};
+
+Drupal.comment.getCookie = function(name) {
+  var search = name + '=';
+  var returnvalue = '';
+  
+  if (document.cookie.length > 0) {
+    offset = document.cookie.indexOf(search);
+    if (offset != -1) {
+      offset += search.length;
+      var end = document.cookie.indexOf(';', offset);
+      if (end == -1) {
+        end = document.cookie.length;
+      }
+      returnvalue = unescape(document.cookie.substring(offset, end));
+    }
+  }
+
+  return returnvalue;
+}
