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 "Jörg Thomas (ConSol Jira)" <se...@james.apache.org> on 2019/11/19 15:27:00 UTC

[jira] [Comment Edited] (JAMES-2985) Mails deleted via POP3 DELE command are not actually deleted

    [ https://issues.apache.org/jira/browse/JAMES-2985?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16977557#comment-16977557 ] 

Jörg Thomas (ConSol) edited comment on JAMES-2985 at 11/19/19 3:26 PM:
-----------------------------------------------------------------------

My i-don't-know-what-i'm-doing-patch:

 

{{{{diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java}}}}
{{ {{index f7fde59..10eb779 100644}}}}
{{ {{--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java}}}}
{{ {{+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java}}}}
{{ {{@@ -25,11 +25,13 @@ import java.util.Map;}}}}
{{ \{{ import java.util.Optional;}}}}{{{{import javax.mail.Flags;}}}}
{{ {{+import javax.mail.Flags.Flag;}}}}
{{ \{{ import javax.persistence.EntityManagerFactory;}}}}
{{ \{{ import javax.persistence.PersistenceException;}}}}
{{ \{{ import javax.persistence.Query;}}}}{{{{import org.apache.james.mailbox.MailboxSession;}}}}
{{ {{+import org.apache.james.mailbox.MessageManager;}}}}
{{ \{{ import org.apache.james.mailbox.MessageUid;}}}}
{{ \{{ import org.apache.james.mailbox.exception.MailboxException;}}}}
{{ \{{ import org.apache.james.mailbox.jpa.JPAId;}}}}
{{ {{@@ -214,6 +216,10 @@ public class JPAMessageMapper extends JPATransactionalMapper implements MessageM}}}}
{{ \{{ Map<MessageUid, MessageMetaData> data = new HashMap<>();}}}}
{{ \{{ List<MessageRange> ranges = MessageRange.toRanges(uids);}}}}{{{{+ for (MessageRange range : ranges) {}}}}
{{ {{+ updateFlags(mailbox, new FlagsUpdateCalculator(new Flags(Flag.DELETED), MessageManager.FlagsUpdateMode.ADD), range);}}}}
{{ \{{+ }}}}}
{{ {{+}}}}
{{ \{{ ranges.forEach(range -> {}}}}
{{ \{{ List<MailboxMessage> messages = findDeletedMessages(range, mailboxId);}}}}
{{ \{{ data.putAll(createMetaData(messages));}}}}

 


was (Author: jtconsol):
My i-don't-know-what-i'm-doing-patch:

 

{{diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java}}
{{index f7fde59..10eb779 100644}}
{{--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java}}
{{+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java}}
{{@@ -25,11 +25,13 @@ import java.util.Map;}}
{{ import java.util.Optional;}}

{{import javax.mail.Flags;}}
{{+import javax.mail.Flags.Flag;}}
{{ import javax.persistence.EntityManagerFactory;}}
{{ import javax.persistence.PersistenceException;}}
{{ import javax.persistence.Query;}}

{{import org.apache.james.mailbox.MailboxSession;}}
{{+import org.apache.james.mailbox.MessageManager;}}
{{ import org.apache.james.mailbox.MessageUid;}}
{{ import org.apache.james.mailbox.exception.MailboxException;}}
{{ import org.apache.james.mailbox.jpa.JPAId;}}
{{@@ -214,6 +216,10 @@ public class JPAMessageMapper extends JPATransactionalMapper implements MessageM}}
{{ Map<MessageUid, MessageMetaData> data = new HashMap<>();}}
{{ List<MessageRange> ranges = MessageRange.toRanges(uids);}}

{{+ for (MessageRange range : ranges) {}}
{{+ updateFlags(mailbox, new FlagsUpdateCalculator(new Flags(Flag.DELETED), MessageManager.FlagsUpdateMode.ADD), range);}}
{{+ }}}
{{+}}
{{ ranges.forEach(range -> {}}
{{ List<MailboxMessage> messages = findDeletedMessages(range, mailboxId);}}
{{ data.putAll(createMetaData(messages));}}

> Mails deleted via POP3 DELE command are not actually deleted
> ------------------------------------------------------------
>
>                 Key: JAMES-2985
>                 URL: https://issues.apache.org/jira/browse/JAMES-2985
>             Project: James Server
>          Issue Type: Bug
>          Components: POP3Server
>    Affects Versions: master
>            Reporter: Jörg Thomas (ConSol)
>            Priority: Critical
>             Fix For: 3.5.0
>
>
> As per the title - mails can't be deleted via POP3 DELE.
> Steps to reproduce:
>  - build the project (spring app in this case, but I don't think that matters)
>  ** {{git clone [https://github.com/apache/james-project]}}
>  ** {{cd james-project}}
>  ** {{docker build -t james/project dockerfiles/compilation/java-8}}
>  ** {{docker run -v $HOME/.m2:/root/.m2 -v $PWD:/origin -v $PWD/dockerfiles/run/spring/destination:/spring/destination -t james/project -s HEAD}}
>  ** {{cd dockerfiles/run/spring/destination/}}
>  ** {{unzip james-server-app-3.5.0-SNAPSHOT-app.zip}}
>  ** {{cd james-server-app-3.5.0-SNAPSHOT/bin}}
>  ** {{./run.sh}}
>  - add a user
>  ** {{./james-cli.sh test@localhost test123}}
>  - send a mail to that user
>  ** {{nc -C localhost 25}}
>  ** ...
>  - login via POP3 and fetch the mail
>  ** {{nc -C localhost 110}}
>  ** {{USER test@localhost}}
>  ** {{PASS test123}}
>  ** {{LIST}}
>  *** (should list only one mail, the one you sent before)
>  ** {{RETR 1}}
>  *** (should display said mail's contents)
>  ** {{DELE 1}}
>  *** (should display `+OK Message deleted`)
>  ** {{LIST}}
>  *** (should display `+OK 0 0`)
>  ** {{QUIT}}
>  - login via POP3 again
>  ** {{LIST}}
>  *** (oops, the mail is still there, just like before)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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