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 rd...@apache.org on 2008/08/28 19:45:57 UTC
svn commit: r689912 - in /james/server/trunk: ./
spoolmanager-function/src/main/java/org/apache/james/transport/mailets/sieve/
stage/org.apache.james/jars/
Author: rdonkin
Date: Thu Aug 28 10:45:57 2008
New Revision: 689912
URL: http://svn.apache.org/viewvc?rev=689912&view=rev
Log:
Upgraded to JSieve 0.2FC
Added:
james/server/trunk/stage/org.apache.james/jars/apache-jsieve-0.2.jar (with props)
Removed:
james/server/trunk/stage/org.apache.james/jars/jsieve-0.2-SNAPSHOT.jar
Modified:
james/server/trunk/include.properties
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/mailets/sieve/SieveMailAdapter.java
Modified: james/server/trunk/include.properties
URL: http://svn.apache.org/viewvc/james/server/trunk/include.properties?rev=689912&r1=689911&r2=689912&view=diff
==============================================================================
--- james/server/trunk/include.properties (original)
+++ james/server/trunk/include.properties Thu Aug 28 10:45:57 2008
@@ -250,7 +250,7 @@
javax.management=${path.lib.mx4j}/${jarname.javax.management}
# ----- sieve-----
-jarname.jsieve.jar=jsieve-0.2-SNAPSHOT.jar
+jarname.jsieve.jar=apache-jsieve-0.2.jar
jsieve.jar=${path.lib.james}/${jarname.jsieve.jar}
jarname.commons-digester.jar=commons-digester-1.8.jar
commons-digester.jar=${path.lib.commonsdigester}/${jarname.commons-digester.jar}
Modified: james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/mailets/sieve/SieveMailAdapter.java
URL: http://svn.apache.org/viewvc/james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/mailets/sieve/SieveMailAdapter.java?rev=689912&r1=689911&r2=689912&view=diff
==============================================================================
--- james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/mailets/sieve/SieveMailAdapter.java (original)
+++ james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/transport/mailets/sieve/SieveMailAdapter.java Thu Aug 28 10:45:57 2008
@@ -18,6 +18,7 @@
****************************************************************/
package org.apache.james.transport.mailets.sieve;
+import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -32,7 +33,13 @@
import javax.mail.Header;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
-import org.apache.jsieve.SieveException;
+
+import org.apache.james.mime4j.field.address.AddressList;
+import org.apache.james.mime4j.field.address.Mailbox;
+import org.apache.james.mime4j.field.address.MailboxList;
+import org.apache.james.mime4j.field.address.parser.ParseException;
+import org.apache.jsieve.exception.InternetAddressException;
+import org.apache.jsieve.exception.SieveException;
import org.apache.jsieve.mail.Action;
import org.apache.jsieve.mail.MailAdapter;
import org.apache.jsieve.mail.MailUtils;
@@ -371,4 +378,72 @@
+ (null == getEnvelopeTo() ? "null" : getEnvelopeTo())
+ " Message ID: " + (null == messageID ? "null" : messageID);
}
+
+ public Object getContent() throws SieveMailException {
+ try {
+ return getMessage().getContent();
+ } catch (MessagingException e) {
+ throw new SieveMailException(e);
+ } catch (IOException e) {
+ throw new SieveMailException(e);
+ }
+ }
+ public String getContentType() throws SieveMailException {
+ try {
+ return getMessage().getContentType();
+ } catch (MessagingException e) {
+ throw new SieveMailException(e);
+ }
+ }
+
+ public Address[] parseAddresses(String arg) throws SieveMailException, InternetAddressException {
+ try {
+ final MailboxList list = AddressList.parse(arg).flatten();
+ final int size = list.size();
+ final Address[] results = new Address[size];
+ for (int i=0;i<size;i++) {
+ final Mailbox mailbox = list.get(i);
+ results[i] = new AddressImpl(mailbox.getLocalPart(), mailbox.getDomain());
+ }
+ return null;
+ } catch (ParseException e) {
+ throw new InternetAddressException(e);
+ }
+ }
+
+ /**
+ * Simple immutable address implementation.
+ * TODO: replace this with JSieve version
+ */
+ private static final class AddressImpl implements MailAdapter.Address {
+
+ private final String localPart;
+ private final String domain;
+
+ /**
+ * Constructs an address.
+ * @param localPart the local part of the address
+ * @param domain the domain part of the address
+ */
+ public AddressImpl(final String localPart, final String domain) {
+ super();
+ this.localPart = localPart;
+ this.domain = domain;
+ }
+
+ /**
+ * Gets the domain of the address.
+ * @return domain
+ */
+ public String getDomain() {
+ return domain;
+ }
+
+ /**
+ * Gets the local part of the address.
+ */
+ public String getLocalPart() {
+ return localPart;
+ }
+ }
}
Added: james/server/trunk/stage/org.apache.james/jars/apache-jsieve-0.2.jar
URL: http://svn.apache.org/viewvc/james/server/trunk/stage/org.apache.james/jars/apache-jsieve-0.2.jar?rev=689912&view=auto
==============================================================================
Binary file - no diff available.
Propchange: james/server/trunk/stage/org.apache.james/jars/apache-jsieve-0.2.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org