trmsg_foreach_active_messages()
#
Iterates over all active messages in the given list
, invoking the specified callback function for each message.
Prototype
int trmsg_foreach_active_messages(
json_t *list,
int (*callback)(
json_t *list, // Not yours!
const char *key,
json_t *record, // It's yours, Must be owned
void *user_data1,
void *user_data2
),
void *user_data1,
void *user_data2,
json_t *jn_filter // owned
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
A JSON object representing the list of messages to iterate over. |
|
|
A function pointer to the callback that will be invoked for each active message. The callback receives the list, message key, record, and user-defined data. |
|
|
A user-defined pointer passed to the callback function. |
|
|
A second user-defined pointer passed to the callback function. |
|
|
A JSON object containing filter criteria for selecting messages. The caller owns this object. |
Return Value
Returns 0 on success, a negative value if the iteration was interrupted by the callback, or a positive error code on failure.
Notes
The callback function should return a negative value to break the iteration, 0 to continue, or 1 to add the record to the returned list. See trmsg_foreach_messages()
for iterating over all messages.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples