Author: norman
Date: Wed Nov 10 10:35:04 2010
New Revision: 1033409
URL: http://svn.apache.org/viewvc?rev=1033409&view=rev
Log:
We should not check the host ... thats done before on other mailets
Modified:
james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/SieveMailet.java
Modified:
james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/SieveMailet.java
URL:
http://svn.apache.org/viewvc/james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/SieveMailet.java?rev=1033409&r1=1033408&r2=1033409&view=diff
==============================================================================
---
james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/SieveMailet.java
(original)
+++
james/server/trunk/mailets/src/main/java/org/apache/james/transport/mailets/SieveMailet.java
Wed Nov 10 10:35:04 2010
@@ -107,59 +107,53 @@ public class SieveMailet extends SieveMa
final int startOfHost = endOfUser + 1;
final int endOfHost = url.indexOf('/', startOfHost);
final String host = url.substring(startOfHost, endOfHost);
- // if (!"localhost".equals(host)) {
- if (host.equals("localhost") == false) {
- // TODO: possible support for clustering?
- throw new MessagingException("Only local mailboxes are
supported");
+ final String urlPath;
+ final int length = url.length();
+ if (endOfHost + 1 == length) {
+ urlPath = "INBOX";
} else {
- final String urlPath;
- final int length = url.length();
- if (endOfHost + 1 == length) {
- urlPath = "INBOX";
- } else {
- urlPath = url.substring(endOfHost, length);
- }
+ urlPath = url.substring(endOfHost, length);
+ }
- // check if we should use the full emailaddress as
- // username
- if (mailServer.supportVirtualHosting()) {
- user = user + "@" + host;
- }
+ // check if we should use the full emailaddress as
+ // username
+ if (mailServer.supportVirtualHosting()) {
+ user = user + "@" + host;
+ }
- final MailboxSession session =
mailboxManager.createSystemSession(user, new MailetLog());
+ final MailboxSession session =
mailboxManager.createSystemSession(user, new MailetLog());
- // start processing request
- mailboxManager.startProcessingRequest(session);
+ // start processing request
+ mailboxManager.startProcessingRequest(session);
- // This allows Sieve scripts to use a standard
delimiter
- // regardless of mailbox implementation
- String destination = urlPath.replace('/',
MailboxConstants.DEFAULT_DELIMITER);
+ // This allows Sieve scripts to use a standard delimiter
+ // regardless of mailbox implementation
+ String destination = urlPath.replace('/',
MailboxConstants.DEFAULT_DELIMITER);
- if (destination == null || "".equals(destination)) {
- destination = "INBOX";
+ if (destination == null || "".equals(destination)) {
+ destination = "INBOX";
+ }
+ if
(destination.startsWith(MailboxConstants.DEFAULT_DELIMITER_STRING))
+ destination = destination.substring(1);
+ final MailboxPath path = new
MailboxPath(MailboxConstants.USER_NAMESPACE, user, destination);
+ try {
+ if ("INBOX".equalsIgnoreCase(destination) &&
!(mailboxManager.mailboxExists(path, session))) {
+ mailboxManager.createMailbox(path, session);
}
- if
(destination.startsWith(MailboxConstants.DEFAULT_DELIMITER_STRING))
- destination = destination.substring(1);
- final MailboxPath path = new
MailboxPath(MailboxConstants.USER_NAMESPACE, user, destination);
- try {
- if ("INBOX".equalsIgnoreCase(destination) &&
!(mailboxManager.mailboxExists(path, session))) {
- mailboxManager.createMailbox(path, session);
- }
- final MessageManager mailbox =
mailboxManager.getMailbox(path, session);
-
- if (mailbox == null) {
- final String error = "Mailbox for user " +
user + " was not found on this server.";
- throw new MessagingException(error);
- }
-
- mailbox.appendMessage(new
MimeMessageInputStream(mail), new Date(), session, true, null);
- } finally {
- session.close();
- mailboxManager.logout(session, true);
-
- // stop processing request
- mailboxManager.endProcessingRequest(session);
+ final MessageManager mailbox =
mailboxManager.getMailbox(path, session);
+ if (mailbox == null) {
+ final String error = "Mailbox for user " + user +
" was not found on this server.";
+ throw new MessagingException(error);
}
+
+ mailbox.appendMessage(new
MimeMessageInputStream(mail), new Date(), session, true, null);
+ } finally {
+ session.close();
+ mailboxManager.logout(session, true);
+
+ // stop processing request
+ mailboxManager.endProcessingRequest(session);
+
}
}
} else {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]