       valid message ID, so bail, and let NNTP and SMTP generate them. */
      return 0;
  
-   GenerateGlobalRandomBytes((unsigned char *) &salt, sizeof(salt));
+-  GenerateGlobalRandomBytes((unsigned char *) &salt, sizeof(salt));
 -  return PR_smprintf("<%lX.%lX@%s>",
 -           (unsigned long) now, (unsigned long) salt, host);
-+
 +  bool custom_message_id = false;
 +  char *message_id = nsnull;
 +
 +  nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
-+
 +  prefs->GetBoolPref("mailnews.custom_message_id", &custom_message_id);
 +  prefs->GetCharPref("mailnews.header.custom_message_id", &message_id);
 +
 +  if (!custom_message_id)
-+  { 
++  {
++    GenerateGlobalRandomBytes((unsigned char *) &salt, sizeof(salt));
 +    return PR_smprintf("<%lX.%lX@%s>",
-+              (unsigned long) now, (unsigned long) salt, host);
-+  } 
-+  else 
++             (unsigned long) now, (unsigned long) salt, host);
++  }
++  else
 +  {
-+    return PR_smprintf("<%s.%lX@%s>",
-+              message_id, (unsigned long) salt, host);
++    return PR_smprintf("<%s@%s>",
++             message_id, host);
 +  }
 +
  }

diff --git a/mailnews/compose/src/nsMsgCompUtils.cpp b/mailnews/compose/src/nsMsgCompUtils.cpp
--- a/mailnews/compose/src/nsMsgCompUtils.cpp
+++ b/mailnews/compose/src/nsMsgCompUtils.cpp
@@ -1116,18 +1116,36 @@ msg_generate_message_id (nsIMsgIdentity 
   }
 
   if (!isValidHost(host))

# HG changeset patch
# Parent 433268decbc634fd8855bdc114a9356dfec431dd
# User Sukhbir Singh <sukhbir.in@gmail.com>
Added support for setting a custom message-ID

