aboutsummaryrefslogtreecommitdiffstats
path: root/ctl-lib/ctl-event.c
diff options
context:
space:
mode:
Diffstat (limited to 'ctl-lib/ctl-event.c')
-rw-r--r--ctl-lib/ctl-event.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/ctl-lib/ctl-event.c b/ctl-lib/ctl-event.c
index 62632e6..5be8b24 100644
--- a/ctl-lib/ctl-event.c
+++ b/ctl-lib/ctl-event.c
@@ -27,27 +27,27 @@
#ifdef AFB_BINDING_PREV3
PUBLIC void CtrlDispatchApiEvent (AFB_ApiT apiHandle, const char *evtLabel, struct json_object *eventJ) {
AFB_ApiNotice (apiHandle, "Received event=%s, query=%s", evtLabel, json_object_get_string(eventJ));
-
+
// retrieve section config from api handle
CtlConfigT *ctrlConfig = (CtlConfigT*) afb_dynapi_get_userdata(apiHandle);
-
+
CtlActionT* actions = ctrlConfig->sections[CTL_SECTION_EVENT].actions;
-
+
int index= ActionLabelToIndex(actions, evtLabel);
if (index < 0) {
AFB_ApiWarning(apiHandle, "CtlDispatchEvent: fail to find uid=%s in action event section", evtLabel);
return;
}
- // create a dummy source for action
+ // create a dummy source for action
CtlSourceT source;
source.uid = actions[index].uid;
source.api = actions[index].api;
source.request = NULL;
-
- // Best effort ignoring error to exec corresponding action
+
+ // Best effort ignoring error to exec corresponding action
(void) ActionExecOne (&source, &actions[index], eventJ);
-
+
}
#else
// In API-V2 controller config is unique and static
@@ -56,34 +56,34 @@ extern CtlConfigT *ctrlConfig;
// call action attached to even name if any
PUBLIC void CtrlDispatchV2Event(const char *evtLabel, json_object *eventJ) {
CtlActionT* actions = ctrlConfig->sections[CTL_SECTION_EVENT].actions;
-
+
int index= ActionLabelToIndex(actions, evtLabel);
if (index < 0) {
AFB_WARNING ("CtlDispatchEvent: fail to find uid=%s in action event section", evtLabel);
return;
}
-
+
CtlSourceT source;
source.uid = actions[index].uid;
source.api = actions[index].api;
source.request = AFB_ReqNone;
- // Best effort ignoring error to exec corresponding action
+ // Best effort ignoring error to exec corresponding action
(void) ActionExecOne (&source, &actions[index], eventJ);
}
#endif
// onload section receive one action or an array of actions
PUBLIC int EventConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *actionsJ) {
-
+
// Load time parse actions in config file
if (actionsJ != NULL) {
section->actions= ActionConfig(apiHandle, actionsJ, 0);
-
+
if (!section->actions) {
AFB_ApiError (apiHandle, "EventLoad config fail processing onload actions");
goto OnErrorExit;
- }
+ }
}
return 0;