- json_object *root, *request, *reply;
- const char *message;
-
- /* builds the answering structure */
- root = json_object_new_object();
- json_object_object_add(root, "jtype", json_object_new_string("afb-reply"));
- request = json_object_new_object();
- json_object_object_add(root, "request", request);
- json_object_object_add(request, "status", json_object_new_string(status));
- if (info)
- json_object_object_add(request, "info", json_object_new_string(info));
- if (resp)
- json_object_object_add(root, "response", resp);
-
- /* make the reply */
- reply = json_object_new_array();
- json_object_array_add(reply, json_object_new_int(retcode));
- json_object_array_add(reply, json_object_new_string_len(wsreq->id, (int)wsreq->idlen));
- json_object_array_add(reply, root);
- json_object_array_add(reply, json_object_new_string(wsreq->aws->context->token));
+ json_object *msg;
+ const char *token;
+ const char *txt;
+
+ /* pack the message */
+ msg = json_object_new_array();
+ json_object_array_add(msg, json_object_new_int(code));
+ json_object_array_add(msg, json_object_new_string_len(id, (int)idlen));
+ json_object_array_add(msg, data);
+ token = aws->context->token;
+ if (token)
+ json_object_array_add(msg, json_object_new_string(token));