You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by no...@apache.org on 2009/11/29 16:06:05 UTC

svn commit: r885236 - /james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/SieveMailboxMailet.java

Author: norman
Date: Sun Nov 29 15:06:05 2009
New Revision: 885236

URL: http://svn.apache.org/viewvc?rev=885236&view=rev
Log:
add protected method to be able to override for james server

Modified:
    james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/SieveMailboxMailet.java

Modified: james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/SieveMailboxMailet.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/SieveMailboxMailet.java?rev=885236&r1=885235&r2=885236&view=diff
==============================================================================
--- james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/SieveMailboxMailet.java (original)
+++ james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/SieveMailboxMailet.java Sun Nov 29 15:06:05 2009
@@ -177,6 +177,7 @@
         this.quiet = quiet;
     }
     
+   
     /**
      * Is informational logging turned on? 
      * @return true when minimal logging is off,
@@ -317,7 +318,6 @@
     @SuppressWarnings("deprecation")
     public void storeMail(MailAddress sender, MailAddress recipient,
             Mail mail) throws MessagingException {
-        String username;
         if (recipient == null) {
             throw new IllegalArgumentException(
                     "Recipient for mail to be spooled cannot be null.");
@@ -326,16 +326,15 @@
             throw new IllegalArgumentException(
                     "Mail message to be spooled cannot be null.");
         }
-        // recipient.toString was used here (JD)
-        username = recipient.getUser();
         
-        sieveMessage(username, mail);
+        sieveMessage(recipient, mail);
  
     }
     
-    void sieveMessage(String username, Mail aMail) throws MessagingException {
+    void sieveMessage(MailAddress recpient, Mail aMail) throws MessagingException {
+    	String username = getUsername(recpient);
         // Evaluate the script against the mail
-        String relativeUri = "//" + username + "@" + "localhost/sieve"; 
+        String relativeUri = "//" + username +"/sieve"; 
         try
         {
             final InputStream ins = locator.get(relativeUri);
@@ -366,7 +365,7 @@
     }
     
     void storeMessageInbox(String username, Mail mail) throws MessagingException {
-        String url = "mailbox://" + username + "@localhost/";
+        String url = "mailbox://" + username + "/";
         poster.post(url, mail.getMessage());
     }
 
@@ -389,4 +388,14 @@
         
         actionDispatcher = new ActionDispatcher();
     }
+    
+    /**
+     * Return the username to use for sieve processing for the given MailAddress
+     * 
+     * @param m
+     * @return username
+     */
+    protected String getUsername(MailAddress m) {
+    	return m.getLocalPart() + "@localhost";
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org