You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2020/12/16 06:52:10 UTC
[james-project] 03/08: JAMES-3431 Ehlo hooks should allow to
advertise implemented ESMTP extensions
This is an automated email from the ASF dual-hosted git repository.
btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit cfae8d285173d4542fa790cb775200233b0b062d
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Thu Dec 10 11:47:09 2020 +0700
JAMES-3431 Ehlo hooks should allow to advertise implemented ESMTP extensions
---
.../apache/james/protocols/smtp/core/esmtp/EhloCmdHandler.java | 8 +++++++-
.../java/org/apache/james/protocols/smtp/hook/HeloHook.java | 10 ++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/EhloCmdHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/EhloCmdHandler.java
index ecbf0d4..7c794e2 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/EhloCmdHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/EhloCmdHandler.java
@@ -35,6 +35,7 @@ import org.apache.james.protocols.smtp.dsn.DSNStatus;
import org.apache.james.protocols.smtp.hook.HeloHook;
import org.apache.james.protocols.smtp.hook.HookResult;
+import com.github.steveash.guavate.Guavate;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
@@ -159,7 +160,12 @@ public class EhloCmdHandler extends AbstractHookableCmdHandler<HeloHook> impleme
@Override
public List<String> getImplementedEsmtpFeatures(SMTPSession session) {
- return ESMTP_FEATURES;
+ return ImmutableList.<String>builder()
+ .addAll(ESMTP_FEATURES)
+ .addAll(getHooks().stream()
+ .flatMap(heloHook -> heloHook.implementedEsmtpFeatures().stream())
+ .collect(Guavate.toImmutableList()))
+ .build();
}
}
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/hook/HeloHook.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/hook/HeloHook.java
index f792a40..3ca3c59 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/hook/HeloHook.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/hook/HeloHook.java
@@ -19,12 +19,22 @@
package org.apache.james.protocols.smtp.hook;
+import java.util.Set;
+
import org.apache.james.protocols.smtp.SMTPSession;
+import com.google.common.collect.ImmutableSet;
+
/**
* Implement this interfaces to hook in the HELO Command
*/
public interface HeloHook extends Hook {
+ /**
+ * @return ESMTP extensions to be advertised as part of EHLO answers
+ */
+ default Set<String> implementedEsmtpFeatures() {
+ return ImmutableSet.of();
+ }
/**
* Return the HookResult after run the hook
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org