summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--binding/hvac-demo-binding.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/binding/hvac-demo-binding.c b/binding/hvac-demo-binding.c
index 1d5e6ac..47223e7 100644
--- a/binding/hvac-demo-binding.c
+++ b/binding/hvac-demo-binding.c
@@ -703,7 +703,7 @@ static int bindingServicePreInit(afb_api_t api)
if(parse_config() != 0)
AFB_WARNING("Default values are being used!\n");
- open_can_dev();
+ return open_can_dev();
}
static int bindingServiceInit(afb_api_t api)
@@ -717,20 +717,18 @@ static int bindingServiceInit(afb_api_t api)
static void onEvent(afb_api_t api, const char *event_name, struct json_object *object)
{
- json_object *language = json_object_new_object();
json_object *id_evt_name, *current_identity;
- AFB_API_NOTICE(api, "Event '%s' received: %s", event_name,
- json_object_to_json_string_ext(object, JSON_C_TO_STRING_PRETTY));
-
if (json_object_object_get_ex(object, "eventName", &id_evt_name) &&
!strcmp(json_object_get_string(id_evt_name), "login") &&
!afb_api_call_sync(api, "identity", "get", json_object_new_object(), &current_identity, NULL, NULL)) {
+ json_object *language = NULL;
json_object *response;
if (! json_object_object_get_ex(current_identity, "response", &response) || ! json_object_object_get_ex(response, "graphPreferredLanguage", &language)) {
language = json_object_new_string("en_US");
}
afb_event_broadcast(event, language);
+ return;
}
}