|
All,
Attached is a patch that is intended to reduce the use of “magic strings” in the James source code (it is the first of several such patches).
This patch adds all header names explicitly specified in RFC 2822 as static constants in the MailHeaders class. The header names explicitly specified throughout the code are replaced with references to these static constants. This should simplify mail header manipulation in the code and protect against the odd typo.
In the process of making this change a minor bug was discovered. MailImpl.java used the header name “Message-Id” as opposed to “Message-ID”, which is the value specified in RFC 2822 for the message id header. This patch resolves this problem.
If there are no objections I’ll submit this patch.
--Peter |
Index: jakarta-james/src/java/org/apache/james/James.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/James.java,v
retrieving revision 1.30
diff -u -r1.30 James.java
--- jakarta-james/src/java/org/apache/james/James.java 11 Sep 2002 08:31:07 -0000
1.30
+++ jakarta-james/src/java/org/apache/james/James.java 11 Sep 2002 08:32:48 -0000
@@ -625,9 +625,9 @@
//Create the reply message
MimeMessage reply = (MimeMessage) orig.reply(false);
//If there is a Return-Path header,
- if (orig.getHeader("Return-Path") != null) {
+ if (orig.getHeader(MailHeaders.RETURN_PATH) != null) {
//Return the message to that address, not to the Reply-To address
- reply.setRecipient(MimeMessage.RecipientType.TO, new
InternetAddress(orig.getHeader("Return-Path")[0]));
+ reply.setRecipient(MimeMessage.RecipientType.TO, new
+InternetAddress(orig.getHeader(MailHeaders.RETURN_PATH)[0]));
}
//Create the list of recipients in our MailAddress format
Collection recipients = new HashSet();
@@ -643,17 +643,17 @@
//Add message as the first mime body part
MimeBodyPart part = new MimeBodyPart();
part.setContent(message, "text/plain");
- part.setHeader("Content-Type", "text/plain");
+ part.setHeader(MailHeaders.CONTENT_TYPE, "text/plain");
multipart.addBodyPart(part);
//Add the original message as the second mime body part
part = new MimeBodyPart();
part.setContent(orig.getContent(), orig.getContentType());
- part.setHeader("Content-Type", orig.getContentType());
+ part.setHeader(MailHeaders.CONTENT_TYPE, orig.getContentType());
multipart.addBodyPart(part);
- reply.setHeader("Date", rfc822DateFormat.format(new Date()));
+ reply.setHeader(MailHeaders.DATE, rfc822DateFormat.format(new Date()));
reply.setContent(multipart);
- reply.setHeader("Content-Type", multipart.getContentType());
+ reply.setHeader(MailHeaders.CONTENT_TYPE, multipart.getContentType());
} catch (IOException ioe) {
throw new MessagingException("Unable to create multipart body", ioe);
}
Index: jakarta-james/src/java/org/apache/james/core/MailHeaders.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/core/MailHeaders.java,v
retrieving revision 1.3
diff -u -r1.3 MailHeaders.java
--- jakarta-james/src/java/org/apache/james/core/MailHeaders.java 17 Aug 2002
18:16:24 -0000 1.3
+++ jakarta-james/src/java/org/apache/james/core/MailHeaders.java 11 Sep 2002
+08:23:17 -0000
@@ -20,6 +20,152 @@
*/
public class MailHeaders extends InternetHeaders implements Serializable, Cloneable {
+ // See Section 3.6.1 of RFC 2822
+
+ /**
+ * The name of the RFC 2822 header that stores the mail date.
+ */
+ public final static String DATE = "Date";
+
+ // See Section 3.6.2 of RFC 2822
+
+ /**
+ * The name of the RFC 2822 header that stores the mail author(s).
+ */
+ public final static String FROM = "From";
+
+ /**
+ * The name of the RFC 2822 header that stores the actual mail transmission agent,
+ * if this differs from the author of the message.
+ */
+ public final static String SENDER = "Sender";
+
+ /**
+ * The name of the RFC 2822 header that stores the reply-to address.
+ */
+ public final static String REPLY_TO = "Reply-To";
+
+ // See Section 3.6.3 of RFC 2822
+
+ /**
+ * The name of the RFC 2822 header that stores the primary mail recipients.
+ */
+ public final static String TO = "To";
+
+ /**
+ * The name of the RFC 2822 header that stores the carbon copied mail recipients.
+ */
+ public final static String CC = "Cc";
+
+ /**
+ * The name of the RFC 2822 header that stores the blind carbon copied mail
+recipients.
+ */
+ public final static String BCC = "Bcc";
+
+ // See Section 3.6.4 of RFC 2822
+
+ /**
+ * The name of the RFC 2822 header that stores the message id.
+ */
+ public final static String MESSAGE_ID = "Message-ID";
+
+ /**
+ * A common variation on the name of the RFC 2822 header that
+ * stores the message id. This is needed for certain filters and
+ * processing of incoming mail.
+ */
+ public final static String MESSAGE_ID_VARIATION = "Message-Id";
+
+ /**
+ * The name of the RFC 2822 header that stores the message id of the message
+ * that to which this email is a reply.
+ */
+ public final static String IN_REPLY_TO = "In-Reply-To";
+
+ /**
+ * The name of the RFC 2822 header that is used to identify the thread to
+ * which this message refers.
+ */
+ public final static String REFERENCES = "References";
+
+ // See Section 3.6.5 of RFC 2822
+
+ /**
+ * The name of the RFC 2822 header that stores the subject.
+ */
+ public final static String SUBJECT = "Subject";
+
+ /**
+ * The name of the RFC 2822 header that stores human-readable comments.
+ */
+ public final static String COMMENTS = "Comments";
+
+ /**
+ * The name of the RFC 2822 header that stores human-readable keywords.
+ */
+ public final static String KEYWORDS = "Keywords";
+
+ // See Section 3.6.6 of RFC 2822
+
+ /**
+ * The name of the RFC 2822 header that stores the date the message was resent.
+ */
+ public final static String RESENT_DATE = "Resent-Date";
+
+ /**
+ * The name of the RFC 2822 header that stores the originator of the resent
+message.
+ */
+ public final static String RESENT_FROM = "Resent-From";
+
+ /**
+ * The name of the RFC 2822 header that stores the transmission agent
+ * of the resent message.
+ */
+ public final static String RESENT_SENDER = "Resent-Sender";
+
+ /**
+ * The name of the RFC 2822 header that stores the recipients
+ * of the resent message.
+ */
+ public final static String RESENT_TO = "Resent-To";
+
+ /**
+ * The name of the RFC 2822 header that stores the carbon copied recipients
+ * of the resent message.
+ */
+ public final static String RESENT_CC = "Resent-Cc";
+
+ /**
+ * The name of the RFC 2822 header that stores the blind carbon copied recipients
+ * of the resent message.
+ */
+ public final static String RESENT_BCC = "Resent-Bcc";
+
+ /**
+ * The name of the RFC 2822 header that stores the message id
+ * of the resent message.
+ */
+ public final static String RESENT_MESSAGE_ID = "Resent-Message-ID";
+
+ // See Section 3.6.7 of RFC 2822
+
+ /**
+ * The name of the RFC 2822 headers that store the tracing data for the return
+path.
+ */
+ public final static String RETURN_PATH = "Return-Path";
+
+ /**
+ * The name of the RFC 2822 headers that store additional tracing data.
+ */
+ public final static String RECEIVED = "Received";
+
+ // MIME headers
+
+ /**
+ * The name of the MIME header that stores the content type.
+ */
+ public final static String CONTENT_TYPE = "Content-Type";
+
/**
* No argument constructor
*
@@ -96,6 +242,6 @@
* @return true if the headers are present, false otherwise
*/
public boolean isValid() {
- return (isSet("Date") && isSet("To") && isSet("From"));
+ return (isSet(MailHeaders.DATE) && isSet(MailHeaders.TO) &&
+isSet(MailHeaders.FROM));
}
}
Index: jakarta-james/src/java/org/apache/james/core/MailImpl.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/core/MailImpl.java,v
retrieving revision 1.13
diff -u -r1.13 MailImpl.java
--- jakarta-james/src/java/org/apache/james/core/MailImpl.java 17 Aug 2002 18:16:24
-0000 1.13
+++ jakarta-james/src/java/org/apache/james/core/MailImpl.java 11 Sep 2002 08:23:18
+-0000
@@ -399,7 +399,7 @@
reply.setRecipients(Message.RecipientType.TO, addr);
reply.setFrom(new
InternetAddress(getRecipients().iterator().next().toString()));
reply.setText(bounceText);
- reply.setHeader("Message-Id", "replyTo-" + getName());
+ reply.setHeader(MailHeaders.MESSAGE_ID, "replyTo-" + getName());
return new MailImpl("replyTo-" + getName(), new
MailAddress(getRecipients().iterator().next().toString()), recipients, reply);
}
Index: jakarta-james/src/java/org/apache/james/core/MimeMessageWrapper.java
===================================================================
RCS file:
/home/cvs/jakarta-james/src/java/org/apache/james/core/MimeMessageWrapper.java,v
retrieving revision 1.13
diff -u -r1.13 MimeMessageWrapper.java
--- jakarta-james/src/java/org/apache/james/core/MimeMessageWrapper.java 19 Aug
2002 18:57:07 -0000 1.13
+++ jakarta-james/src/java/org/apache/james/core/MimeMessageWrapper.java 11 Sep
+2002 08:23:20 -0000
@@ -269,9 +269,9 @@
if (headers == null) {
loadHeaders();
}
- Address from[] = getAddressHeader("From");
+ Address from[] = getAddressHeader(MailHeaders.FROM);
if(from == null) {
- from = getAddressHeader("Sender");
+ from = getAddressHeader(MailHeaders.SENDER);
}
return from;
}
@@ -332,7 +332,7 @@
if (headers == null) {
loadHeaders();
}
- Address replyTo[] = getAddressHeader("Reply-To");
+ Address replyTo[] = getAddressHeader(MailHeaders.REPLY_TO);
if(replyTo == null) {
replyTo = getFrom();
}
@@ -343,7 +343,7 @@
if (headers == null) {
loadHeaders();
}
- String subject = getHeader("Subject", null);
+ String subject = getHeader(MailHeaders.SUBJECT, null);
if (subject == null) {
return null;
}
@@ -358,7 +358,7 @@
if (headers == null) {
loadHeaders();
}
- String header = getHeader("Date", null);
+ String header = getHeader(MailHeaders.DATE, null);
if(header != null) {
try {
return mailDateFormat.parse(header);
@@ -443,7 +443,7 @@
if (headers == null) {
loadHeaders();
}
- String value = getHeader("Content-Type", null);
+ String value = getHeader(MailHeaders.CONTENT_TYPE, null);
if (value == null) {
return "text/plain";
} else {
Index: jakarta-james/src/java/org/apache/james/smtpserver/SMTPHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-james/src/java/org/apache/james/smtpserver/SMTPHandler.java,v
retrieving revision 1.24
diff -u -r1.24 SMTPHandler.java
--- jakarta-james/src/java/org/apache/james/smtpserver/SMTPHandler.java 11 Sep 2002
07:30:41 -0000 1.24
+++ jakarta-james/src/java/org/apache/james/smtpserver/SMTPHandler.java 11 Sep 2002
+08:23:25 -0000
@@ -950,15 +950,15 @@
MailHeaders headers = new MailHeaders(msgIn);
// if headers do not contains minimum REQUIRED headers fields,
// add them
- if (!headers.isSet("Date")) {
- headers.setHeader("Date", rfc822DateFormat.format(new Date()));
+ if (!headers.isSet(MailHeaders.DATE)) {
+ headers.setHeader(MailHeaders.DATE, rfc822DateFormat.format(new
+Date()));
}
- if (!headers.isSet("From") && state.get(SENDER) != null) {
- headers.setHeader("From", state.get(SENDER).toString());
+ if (!headers.isSet(MailHeaders.FROM) && state.get(SENDER) != null) {
+ headers.setHeader(MailHeaders.FROM, state.get(SENDER).toString());
}
//Determine the Return-Path
- String returnPath = headers.getHeader("Return-Path", "\r\n");
- headers.removeHeader("Return-Path");
+ String returnPath = headers.getHeader(MailHeaders.RETURN_PATH,
+"\r\n");
+ headers.removeHeader(MailHeaders.RETURN_PATH);
if (returnPath == null) {
if (state.get(SENDER) == null) {
returnPath = "<>";
@@ -976,11 +976,11 @@
Enumeration headerLines = headers.getAllHeaderLines();
headers = new MailHeaders();
//Put the Return-Path first
- headers.addHeaderLine("Return-Path" + ": " + returnPath);
+ headers.addHeaderLine(MailHeaders.RETURN_PATH + ": " + returnPath);
//Put our Received header next
StringBuffer headerLineBuffer =
new StringBuffer(128)
- .append("Received" + ": from ")
+ .append(MailHeaders.RECEIVED + ": from ")
.append(state.get(REMOTE_NAME))
.append(" ([")
.append(state.get(REMOTE_IP))
Index: jakarta-james/src/java/org/apache/james/transport/mailets/GenericListserv.java
===================================================================
RCS file:
/home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/GenericListserv.java,v
retrieving revision 1.9
diff -u -r1.9 GenericListserv.java
--- jakarta-james/src/java/org/apache/james/transport/mailets/GenericListserv.java
23 Aug 2002 07:48:31 -0000 1.9
+++ jakarta-james/src/java/org/apache/james/transport/mailets/GenericListserv.java
+ 11 Sep 2002 08:23:25 -0000
@@ -7,6 +7,7 @@
*/
package org.apache.james.transport.mailets;
+import org.apache.james.core.MailHeaders;
import org.apache.mailet.GenericMailet;
import org.apache.mailet.Mail;
import org.apache.mailet.MailAddress;
@@ -98,7 +99,7 @@
//Create a copy of this message to send out
MimeMessage message = new MimeMessage(mail.getMessage());
//We need to remove this header from the copy we're sending around
- message.removeHeader("Return-Path");
+ message.removeHeader(MailHeaders.RETURN_PATH);
//Figure out the listserv address.
MailAddress listservAddr = getListservAddress();
@@ -161,7 +162,7 @@
//If replies should go to this list, we need to set the header
if (isReplyToList()) {
- message.setHeader("Reply-To", listservAddr.toString());
+ message.setHeader(MailHeaders.REPLY_TO, listservAddr.toString());
}
//We're going to set this special header to avoid bounces
// getting sent back out to the list
Index: jakarta-james/src/java/org/apache/james/transport/mailets/NotifyPostmaster.java
===================================================================
RCS file:
/home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/NotifyPostmaster.java,v
retrieving revision 1.7
diff -u -r1.7 NotifyPostmaster.java
--- jakarta-james/src/java/org/apache/james/transport/mailets/NotifyPostmaster.java
23 Aug 2002 08:00:29 -0000 1.7
+++ jakarta-james/src/java/org/apache/james/transport/mailets/NotifyPostmaster.java
+ 11 Sep 2002 08:23:26 -0000
@@ -7,6 +7,7 @@
*/
package org.apache.james.transport.mailets;
+import org.apache.james.core.MailHeaders;
import org.apache.james.util.RFC822DateFormat;
import org.apache.mailet.GenericMailet;
import org.apache.mailet.Mail;
@@ -175,25 +176,25 @@
//Add message as the first mime body part
MimeBodyPart part = new MimeBodyPart();
part.setContent(sout.toString(), "text/plain");
- part.setHeader("Content-Type", "text/plain");
+ part.setHeader(MailHeaders.CONTENT_TYPE, "text/plain");
multipart.addBodyPart(part);
//Add the original message as the second mime body part
part = new MimeBodyPart();
part.setContent(message.getContent(), message.getContentType());
- part.setHeader("Content-Type", message.getContentType());
+ part.setHeader(MailHeaders.CONTENT_TYPE, message.getContentType());
multipart.addBodyPart(part);
//if set, attach the full stack trace
if (attachStackTrace && mail.getErrorMessage() != null) {
part = new MimeBodyPart();
part.setContent(mail.getErrorMessage(), "text/plain");
- part.setHeader("Content-Type", "text/plain");
+ part.setHeader(MailHeaders.CONTENT_TYPE, "text/plain");
multipart.addBodyPart(part);
}
reply.setContent(multipart);
- reply.setHeader("Content-Type", multipart.getContentType());
+ reply.setHeader(MailHeaders.CONTENT_TYPE, multipart.getContentType());
} catch (IOException ioe) {
throw new MailetException("Unable to create multipart body");
}
@@ -203,8 +204,8 @@
recipients.add(getMailetContext().getPostmaster());
//Set additional headers
- if (reply.getHeader("Date")==null){
- reply.setHeader("Date", rfc822DateFormat.format(new Date()));
+ if (reply.getHeader(MailHeaders.DATE)==null){
+ reply.setHeader(MailHeaders.DATE, rfc822DateFormat.format(new Date()));
}
String subject = message.getSubject();
if (subject == null) {
@@ -215,7 +216,7 @@
} else {
reply.setSubject("Re:" + subject);
}
- reply.setHeader("In-Reply-To", message.getMessageID());
+ reply.setHeader(MailHeaders.IN_REPLY_TO, message.getMessageID());
//Send it off...
getMailetContext().sendMail(notifier, recipients, reply);
Index: jakarta-james/src/java/org/apache/james/transport/mailets/NotifySender.java
===================================================================
RCS file:
/home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/NotifySender.java,v
retrieving revision 1.8
diff -u -r1.8 NotifySender.java
--- jakarta-james/src/java/org/apache/james/transport/mailets/NotifySender.java 23 Aug
2002 08:00:29 -0000 1.8
+++ jakarta-james/src/java/org/apache/james/transport/mailets/NotifySender.java 11 Sep
+2002 08:23:26 -0000
@@ -7,6 +7,7 @@
*/
package org.apache.james.transport.mailets;
+import org.apache.james.core.MailHeaders;
import org.apache.james.util.RFC822DateFormat;
import org.apache.mailet.GenericMailet;
import org.apache.mailet.Mail;
@@ -160,25 +161,25 @@
//Add message as the first mime body part
MimeBodyPart part = new MimeBodyPart();
part.setContent(sout.toString(), "text/plain");
- part.setHeader("Content-Type", "text/plain");
+ part.setHeader(MailHeaders.CONTENT_TYPE, "text/plain");
multipart.addBodyPart(part);
//Add the original message as the second mime body part
part = new MimeBodyPart();
part.setContent(message.getContent(), message.getContentType());
- part.setHeader("Content-Type", message.getContentType());
+ part.setHeader(MailHeaders.CONTENT_TYPE, message.getContentType());
multipart.addBodyPart(part);
//if set, attach the full stack trace
if (attachStackTrace && mail.getErrorMessage() != null) {
part = new MimeBodyPart();
part.setContent(mail.getErrorMessage(), "text/plain");
- part.setHeader("Content-Type", "text/plain");
+ part.setHeader(MailHeaders.CONTENT_TYPE, "text/plain");
multipart.addBodyPart(part);
}
reply.setContent(multipart);
- reply.setHeader("Content-Type", multipart.getContentType());
+ reply.setHeader(MailHeaders.CONTENT_TYPE, multipart.getContentType());
} catch (IOException ioe) {
throw new MailetException("Unable to create multipart body");
}
@@ -188,8 +189,8 @@
recipients.add(mail.getSender());
//Set additional headers
- if (reply.getHeader("Date")==null){
- reply.setHeader("Date", rfc822DateFormat.format(new Date()));
+ if (reply.getHeader(MailHeaders.DATE)==null){
+ reply.setHeader(MailHeaders.DATE, rfc822DateFormat.format(new Date()));
}
String subject = message.getSubject();
if (subject == null) {
@@ -200,7 +201,7 @@
} else {
reply.setSubject("Re:" + subject);
}
- reply.setHeader("In-Reply-To", message.getMessageID());
+ reply.setHeader(MailHeaders.IN_REPLY_TO, message.getMessageID());
//Send it off...
getMailetContext().sendMail(notifier, recipients, reply);
Index: jakarta-james/src/java/org/apache/james/transport/mailets/Redirect.java
===================================================================
RCS file:
/home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/Redirect.java,v
retrieving revision 1.13
diff -u -r1.13 Redirect.java
--- jakarta-james/src/java/org/apache/james/transport/mailets/Redirect.java 10 Sep
2002 20:47:56 -0000 1.13
+++ jakarta-james/src/java/org/apache/james/transport/mailets/Redirect.java 11 Sep
+2002 08:23:28 -0000
@@ -28,6 +28,7 @@
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
+import org.apache.james.core.MailHeaders;
import org.apache.james.util.RFC822DateFormat;
import org.apache.mailet.GenericMailet;
@@ -529,7 +530,7 @@
multipart.addBodyPart(part);
}
reply.setContent(multipart);
- reply.setHeader("Content-Type", multipart.getContentType());
+ reply.setHeader(MailHeaders.CONTENT_TYPE, multipart.getContentType());
} else {
// if we need the original, create a copy of this message to redirect
reply = getPassThrough() ? new MimeMessage(message) : message;
@@ -537,8 +538,8 @@
}
//Set additional headers
reply.setSubject(getSubjectPrefix() + message.getSubject());
- if(reply.getHeader("Date") == null) {
- reply.setHeader("Date", rfc822DateFormat.format(new Date()));
+ if(reply.getHeader(MailHeaders.DATE) == null) {
+ reply.setHeader(MailHeaders.DATE, rfc822DateFormat.format(new Date()));
}
reply.setRecipients(Message.RecipientType.TO, apparentlyTo);
@@ -549,7 +550,7 @@
reply.setReplyTo(iart);
}
if(sender == null) {
- reply.setHeader("From", message.getHeader("From", ","));
+ reply.setHeader(MailHeaders.FROM, message.getHeader(MailHeaders.FROM,
+","));
sender = new
MailAddress(((InternetAddress)message.getFrom()[0]).getAddress());
} else {
reply.setFrom(sender.toInternetAddress());
Index: jakarta-james/src/java/org/apache/james/transport/matchers/NESSpamCheck.java
===================================================================
RCS file:
/home/cvs/jakarta-james/src/java/org/apache/james/transport/matchers/NESSpamCheck.java,v
retrieving revision 1.2
diff -u -r1.2 NESSpamCheck.java
--- jakarta-james/src/java/org/apache/james/transport/matchers/NESSpamCheck.java
18 Jan 2002 02:48:38 -0000 1.2
+++ jakarta-james/src/java/org/apache/james/transport/matchers/NESSpamCheck.java
+ 11 Sep 2002 08:23:28 -0000
@@ -7,6 +7,7 @@
*/
package org.apache.james.transport.matchers;
+import org.apache.james.core.MailHeaders;
import org.apache.mailet.GenericMatcher;
import org.apache.mailet.Mail;
import org.apache.oro.text.regex.MalformedPatternException;
@@ -27,18 +28,18 @@
public class NESSpamCheck extends GenericMatcher {
protected Perl5Matcher matcher;
- protected Object patterns[][] = {{"Received", "GAA.*-0600.*EST"},
- {"Received", "XAA.*-0700.*EDT"},
- {"Received", "xxxxxxxxxxxxxxxxxxxxx"},
- {"Received", "untrace?able"},
- {"Received", "from (baby|bewellnet|kllklk) "},
- {"To", "Friend@public\\.com"},
- {"To", "user@the[-_]internet"},
- {"Date", "/[0-9]+/.+[AP]M.+Time"},
- {"Subject", "^\\(?ADV?[:;)]"},
- {"Message-ID", "<>"},
- {"Message-Id", "<>"},
- {"Message-Id", "<(419\\.43|989\\.28)"},
+ protected Object patterns[][] = {{MailHeaders.RECEIVED, "GAA.*-0600.*EST"},
+ {MailHeaders.RECEIVED, "XAA.*-0700.*EDT"},
+ {MailHeaders.RECEIVED, "xxxxxxxxxxxxxxxxxxxxx"},
+ {MailHeaders.RECEIVED, "untrace?able"},
+ {MailHeaders.RECEIVED, "from (baby|bewellnet|kllklk) "},
+ {MailHeaders.TO, "Friend@public\\.com"},
+ {MailHeaders.TO, "user@the[-_]internet"},
+ {MailHeaders.DATE, "/[0-9]+/.+[AP]M.+Time"},
+ {MailHeaders.SUBJECT, "^\\(?ADV?[:;)]"},
+ {MailHeaders.MESSAGE_ID, "<>"},
+ {MailHeaders.MESSAGE_ID_VARIATION, "<>"},
+ {MailHeaders.MESSAGE_ID_VARIATION, "<(419\\.43|989\\.28)"},
{"X-MimeOLE", "MimeOLE V[^0-9]"},
//Added 20-Jun-1999. Appears to be broken spamware.
{"MIME-Version", "1.0From"},
@@ -58,8 +59,8 @@
{"X-See-Also", "0[A-Z0-9]+$"},
//Updated 28-Apr-1999. Check for "Sender", "Resent-From", or "Resent-By"
// before "X-UIDL". If found, then exit.
- {"Sender", ".+"},
- {"Resent-From", ".+"},
+ {MailHeaders.SENDER, ".+"},
+ {MailHeaders.RESENT_FROM, ".+"},
{"Resent-By", ".+"},
//Updated 19-May-1999. Check for "X-Mozilla-Status" before "X-UIDL".
{"X-Mozilla-Status", ".+"},
@@ -79,7 +80,7 @@
//Added 25-Oct-1999. Check for X-Confirm-Reading-To.
{"X-Confirm-Reading-To", ".+"},
//Check for invalid Pegasus headers
- {"Comments", "Authenticated sender"},
+ {MailHeaders.COMMENTS, "Authenticated sender"},
{"X-PMFLAGS", ".*"},
{"X-Pmflags", ".*"},
{"X-pmrqc", ".*"},
Index: jakarta-james/src/java/org/apache/james/transport/matchers/RelayLimit.java
===================================================================
RCS file:
/home/cvs/jakarta-james/src/java/org/apache/james/transport/matchers/RelayLimit.java,v
retrieving revision 1.2
diff -u -r1.2 RelayLimit.java
--- jakarta-james/src/java/org/apache/james/transport/matchers/RelayLimit.java 18 Jan
2002 02:48:38 -0000 1.2
+++ jakarta-james/src/java/org/apache/james/transport/matchers/RelayLimit.java 11 Sep
+2002 08:23:28 -0000
@@ -7,6 +7,7 @@
*/
package org.apache.james.transport.matchers;
+import org.apache.james.core.MailHeaders;
import org.apache.mailet.GenericMatcher;
import org.apache.mailet.Mail;
@@ -33,7 +34,7 @@
int count = 0;
for (Enumeration e = mm.getAllHeaders(); e.hasMoreElements();) {
Header hdr = (Header)e.nextElement();
- if (hdr.getName().equals("Received")) {
+ if (hdr.getName().equals(MailHeaders.RECEIVED)) {
count++;
}
}-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
