diff options
Diffstat (limited to 'runtime/ruleset.c')
-rw-r--r-- | runtime/ruleset.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/runtime/ruleset.c b/runtime/ruleset.c index faec122c..392473e9 100644 --- a/runtime/ruleset.c +++ b/runtime/ruleset.c @@ -206,6 +206,7 @@ static inline sbool *newActive(batch_t *pBatch) } static inline void freeActive(sbool *active) { free(active); } + /* for details, see scriptExec() header comment! */ /* call action for all messages with filter on */ static rsRetVal @@ -219,6 +220,24 @@ dbgprintf("RRRR: execAct: batch of %d elements, active %p\n", batchNumMsgs(pBatc } /* for details, see scriptExec() header comment! */ +static rsRetVal +execSet(struct cnfstmt *stmt, batch_t *pBatch, sbool *active) +{ + int i; + struct var result; + DEFiRet; + for(i = 0 ; i < batchNumMsgs(pBatch) && !*(pBatch->pbShutdownImmediate) ; ++i) { + if( pBatch->pElem[i].state != BATCH_STATE_DISC + && (active == NULL || active[i])) { + cnfexprEval(stmt->d.s_set.expr, &result, pBatch->pElem[i].pUsrp); + msgSetJSONFromVar(pBatch->pElem[i].pUsrp, stmt->d.s_set.varname, + &result); + } + } + RETiRet; +} + +/* for details, see scriptExec() header comment! */ /* "stop" simply discards the filtered items - it's just a (hopefully more intuitive * shortcut for users. */ @@ -452,6 +471,9 @@ dbgprintf("RRRR: scriptExec: batch of %d elements, active %p, stmt %p, nodetype case S_IF: execIf(stmt, pBatch, active); break; + case S_SET: + execSet(stmt, pBatch, active); + break; case S_PRIFILT: execPRIFILT(stmt, pBatch, active); break; |