Sounds good!
It will be great if you could open a JIRA
(https://issues.apache.org/jira/browse/PROTOCOLS) for this and upload
there a patch :)
Thx, Eric
On 07/17/2012 04:47 PM, Tze-Kei Lee wrote:
Hi,
For the DENYSONY, I guess AbstractHookableCmdHandler:179 should be
} else if ((rCode & HookReturnCode.DENYSOFT) == HookReturnCode.DENYSOFT) {
instead of
} else if (rCode == HookReturnCode.DENYSOFT) {
?
For the lonely DISCONNECT, how about take the same approach as other codes ?
Use the code and description from HookResult, if code is null then use
TRANSACTION_FAILED,
if description is null we can just use "Server Disconnected".
On Tue, Jul 17, 2012 at 11:12 PM, Eric Charles <[email protected]> wrote:
Hi, See comments inline, Eric
On 07/16/2012 10:10 AM, Tze-Kei Lee wrote:
Hi,
I am writing a custom hook on smtp with return code DENTSOFY |
DISCONNECT, but the SMTPResponse throws exception with stacktrace:
java.lang.IllegalArgumentException: Invalid Response format. Format
should be [Code Description]
at
org.apache.james.protocols.smtp.SMTPResponse.extractCode(SMTPResponse.java:69)
at
org.apache.james.protocols.smtp.SMTPResponse.<init>(SMTPResponse.java:59)
at
org.apache.james.protocols.smtp.core.AbstractHookableCmdHandler.calcDefaultSMTPResponse(AbstractHookableCmdHandler.java:202)
at
org.apache.james.protocols.smtp.core.AbstractHookableCmdHandler.processHooks(AbstractHookableCmdHandler.java:136)
Tracing AbstractHookableCmdHandler.calcDefaultSMTPResponse i found
that it's rCode == HookReturnCode.DENYSOFT instead of (rCode & code)
== code, so I got two questions here
1. Is this intentional that DENYSOFT should be used alone ?
DENYSOFT can't be used in combination with DECLINED, nor OK, nor DENY.
You can combine it with DISCONNECT.
2. in AbstractHookableCmdHandler:202, SMTPResponse is constructed with
empty string which will trigger the exception above. Is this
intentional ?
If you return DENYSOFT, you shouldn't come to new SMTPResponse("")
(AbstractHookableCmdHandler:189 should return a correctly constructed
SMTPReponse).
Now your question remains in case we have a DISCONNECT which returns
SMTPResponse(""). I tried to follow the DISCONNECT processing, but I still
don't have everything to fix this. Don't hesitate to come with a proposal.
Best Regards
Tze-Kei
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
--
eric | http://about.echarles.net | @echarles
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Best Regards
Tze-Kei
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
--
eric | http://about.echarles.net | @echarles
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]