afb-evt: unprefix event name
authorJosé Bollo <jose.bollo@iot.bzh>
Mon, 31 Jul 2017 14:25:06 +0000 (16:25 +0200)
committerJosé Bollo <jose.bollo@iot.bzh>
Mon, 31 Jul 2017 14:25:06 +0000 (16:25 +0200)
Removes the api prefix of the event name.

Change-Id: I050dc86beb08659751c1e57b8d3ea233bac9e411
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
src/afb-evt.c

index d80af04..20ef5e9 100644 (file)
@@ -213,9 +213,11 @@ static int evt_push(struct afb_evt_event *evt, struct json_object *obj)
  */
 static const char *evt_name(struct afb_evt_event *evt)
 {
+       const char *name = strchr(evt->name, '/');
+       name = name ? name + 1 : evt->name;
        if (evt->hookflags & afb_hook_flag_evt_name)
                afb_hook_evt_name(evt->name, evt->id);
-       return evt->name;
+       return name;
 }
 
 /*