for (int i = 0; i < count; i++) {
MessageHook rawHandler = (MessageHook) messageHandlers.get(i);
session.getLogger().debug("executing message handler " + rawHandler);
long start = System.currentTimeMillis();
HookResult hRes = rawHandler.onMessage(session, mail);
long executionTime = System.currentTimeMillis() - start;
if (rHooks != null) {
for (int i2 = 0; i2 < rHooks.size(); i2++) {
Object rHook = rHooks.get(i2);
session.getLogger().debug("executing hook " + rHook);
hRes = ((HookResultHook) rHook).onHookResult(session, hRes, executionTime, rawHandler);
}
}
SMTPResponse response = AbstractHookableCmdHandler.calcDefaultSMTPResponse(hRes);
// if the response is received, stop processing of command
// handlers
if (response != null) {
return response;
}
}
// Not queue the message!
SMTPResponse response = AbstractHookableCmdHandler.calcDefaultSMTPResponse(new HookResult(HookReturnCode.DENY));
return response;
}