james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "davide.bz (JIRA)" <server-...@james.apache.org>
Subject [jira] Commented: (JAMES-641) POP3 list return messages in order as they comes with file pair
Date Thu, 05 Oct 2006 18:40:20 GMT
    [ http://issues.apache.org/jira/browse/JAMES-641?page=comments#action_12440208 ] 
            
davide.bz commented on JAMES-641:
---------------------------------

The suggestion I have maded is wrong. I have debug the code ... a sort is already there without
code modification (but where is documented ??)

Simply find this text in config.xml:

 <repository class="org.apache.james.mailrepository.AvalonMailRepository">
            <protocols>
               <protocol>file</protocol>
            </protocols>
            <types>
               <type>MAIL</type>
            </types>
         </repository>

and add the config-fifo tag:

 <repository class="org.apache.james.mailrepository.AvalonMailRepository">
            <protocols>
               <protocol>file</protocol>
            </protocols>
            <types>
               <type>MAIL</type>
            </types>
            <config FIFO="true"/>
         </repository>

After this mail is sorted with the system.currentTimeMillis
at the moment the mail arrives...

Enjoy!

> POP3 list return messages in order as they comes with file pair
> ---------------------------------------------------------------
>
>                 Key: JAMES-641
>                 URL: http://issues.apache.org/jira/browse/JAMES-641
>             Project: James
>          Issue Type: Improvement
>          Components: James Core
>    Affects Versions: 2.2.0
>         Environment: linux, jdk1.5
>            Reporter: davide.bz
>
> I like to have the list method to return message so that the progressive number correpond
to the receiving order (so all new messaged are on top/bottom).
> With mbox I have already send a patch. But I have noted that mbox does not
> work good with large attachment. So I go back to file pair (default mailrepository)
> But this is not ordered too!!
> I have noted that filenames is an encoded verion of the id of the mail! but the progressive
number in id is not rpad so the string file name does not correspond with progressive number.
> I haved maded by me a path. I does not have testet it in deep but I will send.
> The patched method is the James.java:
> -------------------------------------------------------------------------
>     /**
>      * Return a new mail id.
>      *
>      * @return a new mail id
>      */
>     public String getId() {
>         long localCount = -1;
>         synchronized (James.class) {
>             localCount = count++;
>         }
>         // 2006-09-28 d@vide.bz: rpad progressive will make file name order 
>         // like receiving order!
>         String localCountStr = String.valueOf(localCount);
>         localCountStr = "00000000000000000000" + localCountStr;
>         localCountStr = localCountStr.substring(localCountStr.length() - 20);
>         StringBuffer idBuffer =
>             new StringBuffer(64)
>                     .append("Mail")
>                     .append(System.currentTimeMillis())
>                     .append("-")
>                     .append(localCountStr);
>         return idBuffer.toString();
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
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