james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vince...@apache.org
Subject cvs commit: james-server/src/java/org/apache/james/transport/mailets AbstractRedirect.java Redirect.java Resend.java
Date Mon, 07 Jul 2003 10:04:38 GMT
vincenzo    2003/07/07 03:04:38

  Modified:    src/java/org/apache/james/transport/mailets
                        AbstractRedirect.java Redirect.java Resend.java
  Log:
  Minor fix to "full name" support for compatibility with "old" redirect, and javadoc enhancement.
  
  Revision  Changes    Path
  1.19      +18 -10    james-server/src/java/org/apache/james/transport/mailets/AbstractRedirect.java
  
  Index: AbstractRedirect.java
  ===================================================================
  RCS file: /home/cvs/james-server/src/java/org/apache/james/transport/mailets/AbstractRedirect.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- AbstractRedirect.java	7 Jul 2003 06:16:21 -0000	1.18
  +++ AbstractRedirect.java	7 Jul 2003 10:04:37 -0000	1.19
  @@ -456,7 +456,7 @@
               for (int i = 0; i < iaarray.length; i++) {
                   String addressString = iaarray[i].getAddress();
                   MailAddress specialAddress = getSpecialAddress(addressString,
  -                new String[] {"postmaster", "sender", "reversePath", "unaltered", "recipients"});
  +                new String[] {"postmaster", "sender", "from", "reversePath", "unaltered",
"recipients", "to", "null"});
                   if (specialAddress != null) {
                       newRecipients.add(specialAddress);
                   } else {
  @@ -535,7 +535,7 @@
               for(int i = 0; i < iaarray.length; ++i) {
                   String addressString = iaarray[i].getAddress();
                   MailAddress specialAddress = getSpecialAddress(addressString,
  -                                                new String[] {"postmaster", "sender", "from",
"reversePath", "unaltered", "to", "null"});
  +                                                new String[] {"postmaster", "sender", "from",
"reversePath", "unaltered", "recipients", "to", "null"});
                   if (specialAddress != null) {
                       iaarray[i] = specialAddress.toInternetAddress();
                   }
  @@ -1695,10 +1695,13 @@
       
       /**
        * Returns a new Collection built over <I>list</I> replacing special addresses
  -     * with real ones.
  +     * with real <CODE>MailAddress</CODE>-es.
        * Manages <CODE>SpecialAddress.SENDER</CODE>, <CODE>SpecialAddress.REVERSE_PATH</CODE>,
  -     * <CODE>SpecialAddress.RECIPIENTS</CODE>, 
  +     * <CODE>SpecialAddress.FROM</CODE>, <CODE>SpecialAddress.RECIPIENTS</CODE>,
<CODE>SpecialAddress.TO</CODE>, 
        * <CODE>SpecialAddress.NULL</CODE> and <CODE>SpecialAddress.UNALTERED</CODE>.
  +     * <CODE>SpecialAddress.FROM</CODE> is made equivalent to <CODE>SpecialAddress.SENDER</CODE>;
  +     * <CODE>SpecialAddress.TO</CODE> is made equivalent to <CODE>SpecialAddress.RECIPIENTS</CODE>.
  +     * <CODE>SpecialAddress.NULL</CODE> and <CODE>SpecialAddress.UNALTERED</CODE>
are ignored.
        * Any other address is not replaced.
        */
       protected Collection replaceMailAddresses(Mail mail, Collection list) {
  @@ -1708,7 +1711,7 @@
               MailAddress mailAddress = (MailAddress) iterator.next();
               if (!mailAddress.getHost().equalsIgnoreCase("address.marker")) {
                   newList.add(mailAddress);
  -            } else if (mailAddress == SpecialAddress.SENDER) {
  +            } else if (mailAddress == SpecialAddress.SENDER || mailAddress == SpecialAddress.FROM)
{
                   MailAddress sender = mail.getSender();
                   if (sender != null) {
                       newList.add(sender);
  @@ -1718,10 +1721,12 @@
                   if (reversePath != null) {
                       newList.add(reversePath);
                   }
  -            } else if (mailAddress == SpecialAddress.RECIPIENTS) {
  +            } else if (mailAddress == SpecialAddress.RECIPIENTS || mailAddress == SpecialAddress.TO)
{
                   newList.addAll(mail.getRecipients());
               } else if (mailAddress == SpecialAddress.UNALTERED) {
                   continue;
  +            } else if (mailAddress == SpecialAddress.NULL) {
  +                continue;
               } else {
                   newList.add(mailAddress);
               }
  @@ -1731,10 +1736,12 @@
   
       /**
        * Returns a new Collection built over <I>list</I> replacing special addresses
  -     * with real ones.
  +     * with real <CODE>InternetAddress</CODE>-es.
        * Manages <CODE>SpecialAddress.SENDER</CODE>, <CODE>SpecialAddress.REVERSE_PATH</CODE>,
  -     * <CODE>SpecialAddress.FROM</CODE>, <CODE>SpecialAddress.TO</CODE>,

  +     * <CODE>SpecialAddress.FROM</CODE>, <CODE>SpecialAddress.RECIPIENTS</CODE>,
<CODE>SpecialAddress.TO</CODE>, 
        * <CODE>SpecialAddress.NULL</CODE> and <CODE>SpecialAddress.UNALTERED</CODE>.
  +     * <CODE>SpecialAddress.RECIPIENTS</CODE> is made equivalent to <CODE>SpecialAddress.TO</CODE>
  +     * <CODE>SpecialAddress.UNALTERED</CODE> is ignored.
        * Any other address is not replaced.
        */
       protected Collection replaceInternetAddresses(Mail mail, Collection list) throws MessagingException
{
  @@ -1766,7 +1773,8 @@
                   } catch (AddressException ae) {
                       log("Unable to parse the \"FROM\" header in the original message; ignoring.");
                   }
  -            } else if (internetAddress.equals(SpecialAddress.TO.toInternetAddress())) {
  +            } else if (internetAddress.equals(SpecialAddress.TO.toInternetAddress())
  +                       || internetAddress.equals(SpecialAddress.RECIPIENTS.toInternetAddress()))
{
                   String[] toHeaders = mail.getMessage().getHeader(RFC2822Headers.TO);
                   if (toHeaders != null) {
                       for (int i = 0; i < toHeaders.length; i++) {
  
  
  
  1.35      +13 -6     james-server/src/java/org/apache/james/transport/mailets/Redirect.java
  
  Index: Redirect.java
  ===================================================================
  RCS file: /home/cvs/james-server/src/java/org/apache/james/transport/mailets/Redirect.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- Redirect.java	7 Jul 2003 06:16:21 -0000	1.34
  +++ Redirect.java	7 Jul 2003 10:04:37 -0000	1.35
  @@ -106,12 +106,16 @@
    * <TR valign=top>
    * <TD width="20%">&lt;recipients&gt;</TD>
    * <TD width="80%">
  - * A comma delimited list of email addresses for recipients of
  + * A comma delimited list of addresses for recipients of
    * this message; it will use the &quot;to&quot; list if not specified, and &quot;unaltered&quot;
    * if none of the lists is specified.<BR>
    * These addresses will only appear in the To: header if no &quot;to&quot; list
is
    * supplied.<BR>
  - * It can include constants &quot;sender&quot;, &quot;from&quot;, &quot;postmaster&quot;,
&quot;reversePath&quot;, &quot;recipients&quot; and &quot;unaltered&quot;.
  + * Such addresses can contain &quot;full names&quot;, like
  + * <I>Mr. John D. Smith &lt;john.smith@xyz.com&gt;</I>.<BR>
  + * The list can include constants &quot;sender&quot;, &quot;from&quot;,
&quot;postmaster&quot;, &quot;reversePath&quot;, &quot;recipients&quot;,
&quot;to&quot;, &quot;null&quot; and &quot;unaltered&quot;;
  + * &quot;from&quot; is made equivalent to &quot;sender&quot;, and &quot;to&quot;
is made equivalent to &quot;recipients&quot;;
  + * &quot;null&quot; is ignored.
    * </TD>
    * </TR>
    * <TR valign=top>
  @@ -122,7 +126,10 @@
    * list.<BR>
    * The recipients list will be used if this list is not supplied;
    * if none of the lists is specified it will be &quot;unaltered&quot;.<BR>
  - * It can include constants &quot;sender&quot;, &quot;postmaster&quot;,
&quot;reversePath&quot;, &quot;recipients&quot;, &quot;null&quot;
and &quot;unaltered&quot;;
  + * Such addresses can contain &quot;full names&quot;, like
  + * <I>Mr. John D. Smith &lt;john.smith@xyz.com&gt;</I>.<BR>
  + * The list can include constants &quot;sender&quot;, &quot;from&quot;,
&quot;postmaster&quot;, &quot;reversePath&quot;, &quot;recipients&quot;,
&quot;to&quot;, &quot;null&quot; and &quot;unaltered&quot;;
  + * &quot;recipients&quot; is made equivalent to &quot;to&quot;;
    * if &quot;null&quot; is specified alone it will remove this header.
    * </TD>
    * </TR>
  @@ -390,7 +397,7 @@
               for (int i = 0; i < iaarray.length; i++) {
                   String addressString = iaarray[i].getAddress();
                   MailAddress specialAddress = getSpecialAddress(addressString,
  -                new String[] {"postmaster", "sender", "reversePath", "unaltered", "recipients"});
  +                new String[] {"postmaster", "sender", "from", "reversePath", "unaltered",
"recipients", "to", "null"});
                   if (specialAddress != null) {
                       newRecipients.add(specialAddress);
                   } else {
  @@ -432,7 +439,7 @@
               for(int i = 0; i < iaarray.length; ++i) {
                   String addressString = iaarray[i].getAddress();
                   MailAddress specialAddress = getSpecialAddress(addressString,
  -                                                new String[] {"postmaster", "sender", "from",
"reversePath", "unaltered", "to", "null"});
  +                                                new String[] {"postmaster", "sender", "from",
"reversePath", "unaltered", "recipients", "to", "null"});
                   if (specialAddress != null) {
                       iaarray[i] = specialAddress.toInternetAddress();
                   }
  
  
  
  1.5       +13 -7     james-server/src/java/org/apache/james/transport/mailets/Resend.java
  
  Index: Resend.java
  ===================================================================
  RCS file: /home/cvs/james-server/src/java/org/apache/james/transport/mailets/Resend.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Resend.java	7 Jul 2003 06:16:21 -0000	1.4
  +++ Resend.java	7 Jul 2003 10:04:38 -0000	1.5
  @@ -104,18 +104,24 @@
    * <TR valign=top>
    * <TD width="20%">&lt;recipients&gt;</TD>
    * <TD width="80%">
  - * A comma delimited list of email addresses for recipients of
  - * this message;.<BR>
  - * It can include constants &quot;sender&quot;, &quot;postmaster&quot;,
&quot;reversePath&quot;, &quot;recipients&quot; and &quot;unaltered&quot;.<BR>
  + * A comma delimited list of addresses for recipients of this message.<BR>
  + * Such addresses can contain &quot;full names&quot;, like
  + * <I>Mr. John D. Smith &lt;john.smith@xyz.com&gt;</I>.<BR>
  + * The list can include constants &quot;sender&quot;, &quot;from&quot;,
&quot;postmaster&quot;, &quot;reversePath&quot;, &quot;recipients&quot;,
&quot;to&quot;, &quot;null&quot; and &quot;unaltered&quot;;
  + * &quot;from&quot; is made equivalent to &quot;sender&quot;, and &quot;to&quot;
is made equivalent to &quot;recipients&quot;;
  + * &quot;null&quot; is ignored.
    * Default: &quot;unaltered&quot;.
    * </TD>
    * </TR>
    * <TR valign=top>
    * <TD width="20%">&lt;to&gt;</TD>
    * <TD width="80%">
  - * A comma delimited list of addresses to appear in the To: header;.<BR>
  - * It can include constants &quot;sender&quot;, &quot;from&quot;, &quot;postmaster&quot;,
&quot;reversePath&quot;, &quot;to&quot;, &quot;null&quot; and &quot;unaltered&quot;;
  - * if &quot;null&quot; is specified alone it will remove this header.<BR>
  + * A comma delimited list of addresses to appear in the To: header.<BR>
  + * Such addresses can contain &quot;full names&quot;, like
  + * <I>Mr. John D. Smith &lt;john.smith@xyz.com&gt;</I>.<BR>
  + * The list can include constants &quot;sender&quot;, &quot;from&quot;,
&quot;postmaster&quot;, &quot;reversePath&quot;, &quot;recipients&quot;,
&quot;to&quot;, &quot;null&quot; and &quot;unaltered&quot;;
  + * &quot;recipients&quot; is made equivalent to &quot;to&quot;;
  + * if &quot;null&quot; is specified alone it will remove this header.
    * Default: &quot;unaltered&quot;.
    * </TD>
    * </TR>
  
  
  

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


Mime
View raw message