コード例 #1
0
ファイル: mailMS.cpp プロジェクト: dthain/irods
/**
 * \fn msiSendStdoutAsEmail(msParam_t* xtoAddr, msParam_t* xsubjectLine, ruleExecInfo_t *rei)
 *
 * \brief Sends the current buffer content in rei->ruleExecOut->stdoutBuf.buf as email.
 *
 * \module core
 *
 * \since pre-2.1
 *
 * \author  Arcot Rajasekar
 * \date    2008-05
 *
 * \note   This microservice sends contents of the buffer rei->ruleExecOut->stdoutBuf.buf as email.
 *
 * \usage See clients/icommands/test/rules3.0/
 *
 * \param[in] xtoAddr - a msParam of type STR_MS_T which is the address of the receiver.
 * \param[in] xsubjectLine - a msParam of type STR_MS_T which is the subject of the message.
 * \param[in,out] rei - The RuleExecInfo structure that is automatically
 *    handled by the rule engine. The user does not include rei as a
 *    parameter in the rule invocation.
 *
 * \DolVarDependence none
 * \DolVarModified none
 * \iCatAttrDependence none
 * \iCatAttrModified none
 * \sideeffect none
 *
 * \return integer
 * \retval 0 on success
 * \pre none
 * \post none
 * \sa writeLine, writeString
**/
int msiSendStdoutAsEmail( msParam_t* xtoAddr, msParam_t* xsubjectLine, ruleExecInfo_t *rei ) {
    int i;
    msParam_t *mP;
    char tmpVarName[MAX_ACTION_SIZE];
    execCmdOut_t *myExecCmdOut;
    if ( ( mP = getMsParamByLabel( rei->msParamArray, "ruleExecOut" ) ) == NULL ) {
        return NO_VALUES_FOUND;
    }
    myExecCmdOut = ( execCmdOut_t* )mP->inOutStruct;
    getNewVarName( tmpVarName, rei->msParamArray );
    addMsParam( rei->msParamArray, tmpVarName,  STR_MS_T, myExecCmdOut->stdoutBuf.buf , NULL );
    mP = getMsParamByLabel( rei->msParamArray, tmpVarName );
    i = msiSendMail( xtoAddr, xsubjectLine, mP, rei );
    rmMsParamByLabel( rei->msParamArray, tmpVarName, 1 );
    return i;

}
コード例 #2
0
ファイル: mailMS.cpp プロジェクト: jrandall/irods
/**
 * \fn msiSendStdoutAsEmail(msParam_t* xtoAddr, msParam_t* xsubjectLine, ruleExecInfo_t *rei)
 *
 * \brief Sends the current buffer content in rei->ruleExecOut->stdoutBuf.buf as email.
 *
 * \module core
 *
 * \since pre-2.1
 *
 *
 * \note   This microservice sends contents of the buffer rei->ruleExecOut->stdoutBuf.buf as email.
 *
 * \usage See clients/icommands/test/rules3.0/
 *
 * \param[in] xtoAddr - a msParam of type STR_MS_T which is the address of the receiver.
 * \param[in] xsubjectLine - a msParam of type STR_MS_T which is the subject of the message.
 * \param[in,out] rei - The RuleExecInfo structure that is automatically
 *    handled by the rule engine. The user does not include rei as a
 *    parameter in the rule invocation.
 *
 * \DolVarDependence none
 * \DolVarModified none
 * \iCatAttrDependence none
 * \iCatAttrModified none
 * \sideeffect none
 *
 * \return integer
 * \retval 0 on success
 * \pre none
 * \post none
 * \sa writeLine, writeString
**/
int msiSendStdoutAsEmail( msParam_t* xtoAddr, msParam_t* xsubjectLine, ruleExecInfo_t *rei ) {
    msParam_t *mP;
    if ( ( mP = getMsParamByLabel( rei->msParamArray, "ruleExecOut" ) ) == NULL ) {
        return NO_VALUES_FOUND;
    }
    execCmdOut_t *myExecCmdOut = ( execCmdOut_t* )mP->inOutStruct;
    char tmpVarName[MAX_ACTION_SIZE];
    getNewVarName( tmpVarName, rei->msParamArray );
    addMsParam( rei->msParamArray, tmpVarName,  STR_MS_T, myExecCmdOut->stdoutBuf.buf , NULL );
    mP = getMsParamByLabel( rei->msParamArray, tmpVarName );
    int status;
    if ( NULL != mP ) {
        status = msiSendMail( xtoAddr, xsubjectLine, mP, rei );
    }
    else {
        status = SYS_INTERNAL_NULL_INPUT_ERR;
    }
    rmMsParamByLabel( rei->msParamArray, tmpVarName, 1 );
    return status;

}