question: protected Response calcDefaultSMTPResponse ( HookResult result ) { if ( result != null ) { int rCode = result . getResult ( ) ; String smtpRetCode = result . getSmtpRetCode ( ) ; String smtpDesc = result . getSmtpDescription ( ) ; if ( ( rCode & HookReturnCode . DENY ) == HookReturnCode . DENY ) { if ( smtpRetCode == null ) smtpRetCode = SMTPRetCode . AUTH_FAILED ; if ( smtpDesc == null ) smtpDesc = "Authentication Failed" ; SMTPResponse response = new SMTPResponse ( smtpRetCode , smtpDesc ) ; if ( ( rCode & HookReturnCode . DISCONNECT ) == HookReturnCode . DISCONNECT ) { response . setEndSession ( true ) ; } return response ; } else if ( ( rCode & HookReturnCode . DENYSOFT ) == HookReturnCode . DENYSOFT ) { if ( smtpRetCode == null ) smtpRetCode = SMTPRetCode . LOCAL_ERROR ; if ( smtpDesc == null ) smtpDesc = "Temporary problem. Please try again later" ; SMTPResponse response = new SMTPResponse ( smtpRetCode , smtpDesc ) ; if ( ( rCode & HookReturnCode . DISCONNECT ) == HookReturnCode . DISCONNECT ) { response . setEndSession ( true ) ; } return response ; } else if ( ( rCode & HookReturnCode . OK ) == HookReturnCode . OK ) { if ( smtpRetCode == null ) smtpRetCode = SMTPRetCode . AUTH_OK ; if ( smtpDesc == null ) smtpDesc = "Authentication Succesfull" ; SMTPResponse response = new SMTPResponse ( smtpRetCode , smtpDesc ) ; if ( ( rCode & HookReturnCode . DISCONNECT ) == HookReturnCode . DISCONNECT ) { response . setEndSession ( true ) ; } return response ; } else if ( ( rCode & HookReturnCode . DISCONNECT ) == HookReturnCode . DISCONNECT ) { SMTPResponse response = new SMTPResponse ( "" ) ; response . setEndSession ( true ) ; return response ; } else { return null ; } } else { return null ; } }
target:  Calculate the SMTPResponse for the given result