Index: mailcomment.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/mailcomment/mailcomment.module,v
retrieving revision 1.1.2.18
diff -u -r1.1.2.18 mailcomment.module
--- mailcomment.module	17 Feb 2010 23:28:55 -0000	1.1.2.18
+++ mailcomment.module	9 Sep 2010 05:04:14 -0000
@@ -564,19 +564,15 @@
  *   String signature or FALSE if not found.
  */
 function _mailcomment_get_signature($body) {
-  if (preg_match("/([0-9]+\.){4}+[a-z0-9]+@([a-z0-9])([-a-z0-9_])+([a-z0-9])(\.([a-z0-9])([-a-z0-9_-])([a-z0-9])+)*/i", $body, $matches)) {
-    //  Check to make sure the match has our mailcomment domain
-    $domain = variable_get('mailcomment_server_string', 'example.com');
-    if (strpos($matches[0], $domain)) {
-      $signature = $matches[0];
-      // We have a match for the messageid and the mailcomment domain string so we are good
-      return $signature;
-    }
-  }
-  else {
-    // No matches found so assume we have no messageid and node->threading is not set
-    return FALSE;
+  // Grab the server string and make it regex-friendly
+  $server = str_replace('.', '\.', variable_get('mailcomment_server_string', 'example.com'));
+  // Check for a signature match
+  if (preg_match("/([0-9]+\.){4}[a-z0-9]+@" . $server . "/is", $body, $matches)) {
+    // We have a match for the messageid and the mailcomment domain string so we are good
+    return $matches[0];
   }
+  // No matches found so assume we have no messageid and node->threading is not set
+  return FALSE;
 }
 
 /**

