From 0faec9628301e1fd9c57e220d2ad5485e52ced2f Mon Sep 17 00:00:00 2001 From: Milan Bartos Date: Wed, 12 Sep 2012 09:52:19 +0200 Subject: Change mmjsonparse so non-json messages doesn't get lost from ceelog modified: mmjsonparse.c --- plugins/mmjsonparse/mmjsonparse.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'plugins/mmjsonparse/mmjsonparse.c') diff --git a/plugins/mmjsonparse/mmjsonparse.c b/plugins/mmjsonparse/mmjsonparse.c index d419f246..0fc6a11c 100644 --- a/plugins/mmjsonparse/mmjsonparse.c +++ b/plugins/mmjsonparse/mmjsonparse.c @@ -149,6 +149,7 @@ BEGINdoAction msg_t *pMsg; uchar *buf; int bSuccess = 0; + struct json_object *jval; CODESTARTdoAction pMsg = (msg_t*) ppString[0]; /* note that we can performance-optimize the interface, but this also @@ -164,6 +165,14 @@ dbgprintf("mmjsonparse: msg is '%s'\n", buf); if(*buf == '\0' || strncmp((char*)buf, COOKIE, LEN_COOKIE)) { DBGPRINTF("mmjsonparse: no JSON cookie: '%s'\n", buf); + + /* create json if necessary and add buf as msg */ + if (!pMsg->json) { + pMsg->json = json_object_new_object(); + } + jval = json_object_new_string((char*)buf); + json_object_object_add(pMsg->json, "msg", jval); + FINALIZE; } buf += LEN_COOKIE; -- cgit v1.2.3