Index: modules/comment/comment.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.test,v
retrieving revision 1.92
diff -u -p -r1.92 comment.test
--- modules/comment/comment.test	8 Nov 2010 21:36:45 -0000	1.92
+++ modules/comment/comment.test	21 Nov 2010 22:03:45 -0000
@@ -1286,7 +1286,6 @@ class CommentTokenReplaceTestCase extend
     $tests = array();
     $tests['[comment:cid]'] = $comment->cid;
     $tests['[comment:hostname]'] = check_plain($comment->hostname);
-    $tests['[comment:name]'] = filter_xss($comment->name);
     $tests['[comment:mail]'] = check_plain($this->admin_user->mail);
     $tests['[comment:homepage]'] = check_url($comment->homepage);
     $tests['[comment:title]'] = filter_xss($comment->subject);
@@ -1299,8 +1298,9 @@ class CommentTokenReplaceTestCase extend
     $tests['[comment:parent:title]'] = check_plain($parent_comment->subject);
     $tests['[comment:node:nid]'] = $comment->nid;
     $tests['[comment:node:title]'] = check_plain($node->title);
+    $tests['[comment:author]'] = check_plain(format_username($this->admin_user));
     $tests['[comment:author:uid]'] = $comment->uid;
-    $tests['[comment:author:name]'] = check_plain($this->admin_user->name);
+    $tests['[comment:author:name]'] = check_plain(format_username($this->admin_user));
 
     // Test to make sure that we generated something for each token.
     $this->assertFalse(in_array(0, array_map('strlen', $tests)), t('No empty tokens generated.'));
@@ -1312,14 +1312,14 @@ class CommentTokenReplaceTestCase extend
 
     // Generate and test unsanitized tokens.
     $tests['[comment:hostname]'] = $comment->hostname;
-    $tests['[comment:name]'] = $comment->name;
     $tests['[comment:mail]'] = $this->admin_user->mail;
     $tests['[comment:homepage]'] = $comment->homepage;
     $tests['[comment:title]'] = $comment->subject;
     $tests['[comment:body]'] = $comment->comment_body[LANGUAGE_NONE][0]['value'];
     $tests['[comment:parent:title]'] = $parent_comment->subject;
     $tests['[comment:node:title]'] = $node->title;
-    $tests['[comment:author:name]'] = $this->admin_user->name;
+    $tests['[comment:author]'] = format_username($this->admin_user);
+    $tests['[comment:author:name]'] = format_username($this->admin_user);
 
     foreach ($tests as $input => $expected) {
       $output = token_replace($input, array('comment' => $comment), array('language' => $language, 'sanitize' => FALSE));
Index: modules/comment/comment.tokens.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.tokens.inc,v
retrieving revision 1.13
diff -u -p -r1.13 comment.tokens.inc
--- modules/comment/comment.tokens.inc	7 Jul 2010 17:00:42 -0000	1.13
+++ modules/comment/comment.tokens.inc	21 Nov 2010 22:03:45 -0000
@@ -35,10 +35,6 @@ function comment_token_info() {
     'name' => t("IP Address"),
     'description' => t("The IP address of the computer the comment was posted from."),
   );
-  $comment['name'] = array(
-    'name' => t("Name"),
-    'description' => t("The name left by the comment author."),
-  );
   $comment['mail'] = array(
     'name' => t("Email address"),
     'description' => t("The email address left by the comment author."),
@@ -87,7 +83,7 @@ function comment_token_info() {
   );
   $comment['author'] = array(
     'name' => t("Author"),
-    'description' => t("The author of the comment, if they were logged in."),
+    'description' => t("The author of the comment."),
     'type' => 'user',
   );
 
@@ -131,19 +127,21 @@ function comment_tokens($type, $tokens, 
           $replacements[$original] = $sanitize ? check_plain($comment->hostname) : $comment->hostname;
           break;
 
-        case 'name':
-          $name = ($comment->uid == 0) ? variable_get('anonymous', t('Anonymous')) : $comment->name;
-          $replacements[$original] = $sanitize ? filter_xss($name) : $name;
+        case 'author':
+          $name = $comment->name;
+          if (!empty($comment->uid) || !drupal_strlen($comment->name)) {
+            $account = user_load($comment->uid);
+            $name = format_username($account);
+          }
+          $replacements[$original] = $sanitize ? check_plain($name) : $name;
           break;
 
         case 'mail':
-          if ($comment->uid != 0) {
+          $mail = $comment->mail;
+          if (!empty($comment->uid)) {
             $account = user_load($comment->uid);
             $mail = $account->mail;
           }
-          else {
-            $mail = $comment->mail;
-          }
           $replacements[$original] = $sanitize ? check_plain($mail) : $mail;
           break;
 
@@ -173,10 +171,6 @@ function comment_tokens($type, $tokens, 
           break;
 
         // Default values for the chained tokens handled below.
-        case 'author':
-          $replacements[$original] = $sanitize ? filter_xss($comment->name) : $comment->name;
-          break;
-
         case 'parent':
           if (!empty($comment->pid)) {
             $parent = comment_load($comment->pid);
