diff -u comment_notify.orig/comment_notify.install comment_notify/comment_notify.install
--- comment_notify.orig/comment_notify.install	2009-01-03 23:15:41.000000000 +0530
+++ comment_notify/comment_notify.install	2009-01-28 15:04:43.000000000 +0530
@@ -92,4 +92,48 @@
     db_query("UPDATE {permission} SET perm = '%s' WHERE pid = %d", $permissions, $row->pid);
   }
   return $ret;
-}
\ No newline at end of file
+}
+/**
+ * Adding one more field in table comment_notify to store the full path to
+ * commment with all its parents.
+ */
+function comment_notify_update_6002() {
+  $ret = array();
+  db_add_field($ret, 'comment_notify', 'parents', array('type' => 'varchar', 'length' => 255));
+  $num_rows_result = db_fetch_object(db_query("SELECT COUNT(*) AS num FROM {comments} c"));
+
+  if ($num_rows_result-> num != 0) {
+    $level = 1;
+    $ifcondition = "IF (c". $level .".pid <> 0, CONCAT(c". $level .".pid, ','),'')";
+    $table = "c". $level;
+    $join = NULL;
+    $origconcatclause = "";
+    $concatclause = "";
+    // First find the level of comments by recursively querying.
+    do {
+      if ($level != 1) {
+        $prvlevel = $level - 1;
+        $join .= " JOIN {comments} c". $level ." ON c". $prvlevel .".pid=c". $level .".cid";
+      }
+      $concatclause = "CONCAT('0,', ". $ifcondition .")";
+      $sql = "SELECT ". $concatclause ." AS parents FROM {comments} c1  ". $join;
+      $result = db_fetch_array(db_query($sql));
+      if ($result != NULL) {
+        $origsql = $sql;
+        $origconcatclause = $concatclause;
+      }
+      $level++;
+      $table = "c" . $level;
+      $ifcondition = " IF(c". $level .".pid <> 0, CONCAT(c". $level .".pid, ','),''),". $ifcondition;
+    } while ($result != NULL);
+
+    // In the while loop it was joined because we wanted the series 
+    // of joins to finally return null record set but when we update 
+    // we need to generated the complete set of records for the full depth.
+    $sql = str_replace('JOIN', 'LEFT JOIN', $origsql);
+    // Replace the 'SELECT' command of the select query with an 'UPDATE' command.
+    $tblstrarr = explode('FROM', $sql);
+    db_query("UPDATE ". $tblstrarr[1] ." LEFT JOIN {comment_notify} cn ON c1.cid = cn.cid SET cn.parents = ". $origconcatclause);
+  }
+  return $ret;
+}
diff -u comment_notify.orig/comment_notify.module comment_notify/comment_notify.module
--- comment_notify.orig/comment_notify.module	2008-12-29 23:29:09.000000000 +0530
+++ comment_notify/comment_notify.module	2009-01-28 16:16:10.000000000 +0530
@@ -227,6 +227,12 @@
       db_query($sql, $comment['notify'], $comment['cid']);
       break;
     case 'insert':
+      // Get pid from comments table  for current cid, get the parents for this cid.
+      $notifyval = 0;
+      $parentrslt = db_fetch_object(db_query("SELECT pid FROM {comments} WHERE cid = %d", $comment['cid']));
+      $strparents = $parentrslt->pid .',';
+      $prvparnt = db_fetch_object(db_query("SELECT parents FROM  {comment_notify} WHERE cid = %d", $parentrslt->pid));
+      $parents = $prvparnt->parents . $strparents;
       // If they subscribe and don't have a default let them know that it's possible to set one.
       if (empty($user->comment_notify_mailalert) && $comment['notify']) {
         drupal_set_message(t('You can change the default for this field in "Comment follow-up notification settings" on <a href="!uri">your account edit page</a>.', array('!uri' => url('user/'. $user->uid .'/edit'))));
@@ -236,7 +242,7 @@
       $mail = empty($comment['mail']) ? $user->mail : $comment['mail'];
       $notify_hash = drupal_get_token($mail . $comment['cid']);
       // And then save the data.
-      db_query("INSERT INTO {comment_notify} (cid, notify, notify_hash) values (%d, %d, '%s')", $comment['cid'], $comment['notify'], $notify_hash);
+      db_query("INSERT INTO {comment_notify} (cid, notify, notify_hash, parents) VALUES (%d, %d, '%s', '%s')", $comment['cid'], $comment['notify'], $notify_hash, $parents);
       break;
     case 'delete':
       db_query("DELETE FROM {comment_notify} WHERE cid = %d", $comment->cid);
@@ -345,70 +351,73 @@
     $sent_to[] = $author->mail;
   }
 
-  //Get the list of commenters to notify
-  $result = db_query("SELECT DISTINCT c.cid, c.uid, c.name, c.nid, c.mail AS cmail, u.mail AS umail, u.init AS uinit, c.uid, c.name, cn.notify, cn.notify_hash
-    FROM {comments} c INNER JOIN {comment_notify} cn on c.cid = cn.cid LEFT OUTER JOIN {users} u ON c.uid = u.uid
-    WHERE nid = %d AND cn.notify > 0 AND c.status = 0 AND (u.status = 1 OR u.uid = 0)", $nid
-  );
-  // TODO? the original big query had stuff making sure the mail was populated and contained .+@.+ Perhaps check for that here and set notify = 0 if that is the case for this cid
-
-  while ($alert = db_fetch_object($result)) {
-    $umail = empty($alert->umail) ? $alert->uinit : $alert->umail;
-    $mail = empty($alert->cmail) ? $umail : $alert->cmail;
-
-    if ($alert->notify == COMMENT_NOTIFY_COMMENT && $alert->cid != $comment->pid) {
-      break;
+  // Get the parents and mailid of a particular comment.
+  $parentrslt = db_fetch_object(db_query("SELECT parents, IF(LENGTH(c.mail) < 1, IFNULL(u.mail, u.init), c.mail) mail FROM {comment_notify} zc LEFT JOIN {comments} c ON zc.cid = c.cid LEFT JOIN {users} u ON u.uid = c.uid WHERE zc.cid = %d", $cid));
+  if ($parentrslt->parents != NULL) {
+    $arrparents = explode(',', $parentrslt->parents);
+    $parents .= $arrparents[0];
+    for ($i = 1; $i < count($arrparents) - 1; $i++) {
+      $parents .= ',';
+      $parents .= $arrparents[$i];
     }
 
-    if ($mail != $comment_mail && !in_array($mail, $sent_to) && $alert->uid != $comment->uid) {
-      $message = array();
-      if (!empty($alert->uid)) {
-        $recipient_user = user_load(array('uid' => $alert->uid));
-        $language = user_preferred_language($recipient_user);
-      }
-      else {
-        $language = language_default();
-      }
-
-      $message['subject'] = t('!site :: new comment for your post.', array('!site' => variable_get('site_name', 'drupal')));
-      $message['body'] = t(
-        variable_get('comment_notify_default_mailtext', DEFAULT_MAILTEXT),
-        array(
-          '!commname' => $comment->name,
-          '!commtext' => $comment->comment,
-          '!commsubj' => $comment->subject,
-          '!comment_url' => url('node/'. $nid, array('absolute' => TRUE, 'fragment' => 'comment-'. $cid)),
-          '!node_title' =>  $node->title,
-          '!node_teaser' => $node->teaser,
-          '!mission' => variable_get('site_mission', ''),
-          '!node_body' =>  $node->body,
-          '!name' => $alert->name,
-          '!site' => variable_get('site_name', 'drupal'),
-          '!uri' => $base_url,
-          '!uri_brief' => preg_replace('!^https?://!', '', $base_url),
-          '!date' => format_date(time()),
-          '!login_uri' => url('user', array('absolute' => TRUE)),
-          '!edit_uri' => url('user/'. $alert->uid .'/edit', array('absolute' => TRUE)),
-          '!link1' => url('comment_notify/disable/'. $alert->notify_hash, array('absolute' => TRUE))
-        )
-      );
-      drupal_mail('comment_notify', 'comment_notify_mail', $mail, $language, $message);
-      $sent_to[] = $mail;
-
-      if ($alert->uid != 0) {
-        $watchdog_message = 'Notified: <a href="!url">@user_mail</a>';
-      }
-      else {
-        $watchdog_message = 'Notified @user_mail';
+    // Select all comments that are in the parent path for the 
+    // current comment or that have comment subscription set as subscribe to node.
+    $result = db_query("SELECT DISTINCT c.cid, c.uid, c.name, c.nid, c.mail AS cmail, u.mail AS umail, u.init AS uinit, c.uid, c.name, cn.notify,   cn.notify_hash FROM {comments} c INNER JOIN {comment_notify} cn ON c.cid = cn.cid LEFT OUTER JOIN {users} u ON c.uid = u.uid WHERE nid = %d  AND c.status = 0 AND (u.status = 1 OR u.uid = 0) AND (cn.cid IN ('%s') OR cn.notify = 1)", $nid, $parents);
+
+    while ($alert = db_fetch_object($result)) {
+      $umail = empty($alert->umail) ? $alert->uinit : $alert->umail;
+      $mail = empty($alert->cmail) ? $umail : $alert->cmail;
+      if ($alert->cid != $comment->pid && $mail !=$author->mail) {
+        if ($mail != $comment_mail && !in_array($mail, $sent_to) && $alert->uid != $comment->uid) {
+          $message = array();
+          if (!empty($alert->uid)) {
+            $recipient_user = user_load(array('uid' => $alert->uid));
+            $language = user_preferred_language($recipient_user);
+          }
+          else {
+            $language = language_default();
+          }
+          $message['subject'] = t('!site :: new comment for your post.', array('!site' => variable_get('site_name', 'drupal')));
+          $message['body'] = t(
+            variable_get('comment_notify_default_mailtext', DEFAULT_MAILTEXT),
+            array(
+              '!commname' => $comment->name,
+              '!commtext' => $comment->comment,
+              '!commsubj' => $comment->subject,
+              '!comment_url' => url('node/'. $nid, array('absolute' => TRUE, 'fragment' => 'comment-'. $cid)),
+              '!node_title' =>  $node->title,
+              '!node_teaser' => $node->teaser,
+              '!mission' => variable_get('site_mission', ''),
+              '!node_body' =>  $node->body,
+              '!name' => $alert->name,
+              '!site' => variable_get('site_name', 'drupal'),
+              '!uri' => $base_url,
+              '!uri_brief' => preg_replace('!^https?://!', '', $base_url),
+              '!date' => format_date(time()),
+              '!login_uri' => url('user', array('absolute' => TRUE)),
+              '!edit_uri' => url('user/'. $alert->uid .'/edit', array('absolute' => TRUE)),
+              '!link1' => url('comment_notify/disable/'. $alert->notify_hash, array('absolute' => TRUE))
+            )
+          );
+          drupal_mail('comment_notify', 'comment_notify_mail', $mail, $language, $message);
+          $sent_to[] = $mail;
+
+          if ($alert->uid != 0) {
+            $watchdog_message = 'Notified: <a href="!url">@user_mail</a>';
+          }
+          else {
+            $watchdog_message = 'Notified @user_mail';
+          }
+
+          // Add an entry to the watchdog log.
+          watchdog('comment_notify', $watchdog_message, array('!url' => url('user/'. $alert->uid .'/edit'), '@user_mail' => $mail),
+            WATCHDOG_NOTICE, l(t('source comment'), 'node/'. $nid, array('fragment' => 'comment-'. $alert->cid)));
+
+          // revert to previous (site default) locale
+          $language = $initial_language;
+        }
       }
-
-      watchdog('comment_notify', $watchdog_message, array('!url' => url('user/'. $alert->uid .'/edit'), '@user_mail' => $mail),
-        WATCHDOG_NOTICE, l(t('source comment'), 'node/'. $nid, array('fragment' => 'comment-'. $alert->cid)));
-
-      // Add an entry to the watchdog log.
-
-      // revert to previous (site default) locale
-      $language = $initial_language;
     }
   }
 }
