Repository: james-project
Updated Branches:
  refs/heads/master 096c6c763 -> 38b3d7a59


JAMES-2557 MailHook should use a MaybeSender


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/215f99d0
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/215f99d0
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/215f99d0

Branch: refs/heads/master
Commit: 215f99d0ebcb4c65fa81d9f0fdf43cdd75457cdb
Parents: 096c6c7
Author: Benoit Tellier <btell...@linagora.com>
Authored: Tue Oct 30 10:49:01 2018 +0700
Committer: Benoit Tellier <btell...@linagora.com>
Committed: Thu Nov 1 10:55:43 2018 +0700

----------------------------------------------------------------------
 .../james/protocols/smtp/hook/MailHook.java     | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/215f99d0/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/hook/MailHook.java
----------------------------------------------------------------------
diff --git 
a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/hook/MailHook.java
 
b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/hook/MailHook.java
index ec1649f..a1c48a8 100644
--- 
a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/hook/MailHook.java
+++ 
b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/hook/MailHook.java
@@ -20,6 +20,7 @@
 package org.apache.james.protocols.smtp.hook;
 
 import org.apache.james.core.MailAddress;
+import org.apache.james.core.MaybeSender;
 import org.apache.james.protocols.smtp.SMTPSession;
 
 /**
@@ -30,10 +31,27 @@ public interface MailHook extends Hook {
 
     /**
      * Return the HookResult after run the hook
+     *
+     * @Deprecated use {@link #doMail(SMTPSession, MaybeSender)} instead
      * 
      * @param session the SMTPSession
      * @param sender the sender MailAddress
      * @return HockResult
      */
-    HookResult doMail(SMTPSession session, MailAddress sender);
+    @Deprecated
+    default HookResult doMail(SMTPSession session, MailAddress sender) {
+        return doMail(session, MaybeSender.of(sender));
+    }
+
+    /**
+     * Return the HookResult after run the hook
+     *
+     * This strongly typed version of do mail is safer to use.
+     *
+     * @since James 3.2.0
+     */
+    @SuppressWarnings("deprecated")
+    default HookResult doMail(SMTPSession session, MaybeSender sender) {
+        return doMail(session, 
sender.asOptional().orElse(MailAddress.nullSender()));
+    }
 }


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

Reply via email to