jsonObject *msg_wrapper = NULL; // free me
const jsonObject *tmp_obj = NULL;
+ const jsonObject *osrf_msg_list = NULL;
const jsonObject *osrf_msg = NULL;
const char *service = NULL;
const char *thread = NULL;
const char *log_xid = NULL;
char *msg_body = NULL;
char *recipient = NULL;
+ int i;
if (buffer_size <= 0) return OK;
memcpy(buf, buffer, buffer_size);
buf[buffer_size] = '\0';
- msg_wrapper = jsonParseRaw(buf);
+ msg_wrapper = jsonParse(buf);
if (msg_wrapper == NULL) {
osrfLogWarning(OSRF_LOG_MARK, "WS Invalid JSON: %s", buf);
return HTTP_BAD_REQUEST;
}
- osrf_msg = jsonObjectGetKeyConst(msg_wrapper, "osrf_msg");
+ osrf_msg_list = jsonObjectGetKeyConst(msg_wrapper, "osrf_msg");
if (tmp_obj = jsonObjectGetKeyConst(msg_wrapper, "service"))
service = jsonObjectGetString(tmp_obj);
}
}
- // TODO: activity log entry? -- requires message analysis
osrfLogDebug(OSRF_LOG_MARK,
"WS relaying message thread=%s, xid=%s, recipient=%s",
thread, osrfLogGetXid(), recipient);
- msg_body = jsonObjectToJSONRaw(osrf_msg);
+ // for each included message:
+ // 1. Stamp the ingress
+ // 2. REQUEST: log it as activity
+ // 3. DISCONNECT: remove the cached recipient
+
+ osrfMessage* msg;
+ osrfMessage* msg_ist[MAX_MSGS_PER_PACKET];
+ int num_msgs = osrfMessageDeserialize(osrf_msg_list, msg_list, MAX_MSGS_PER_PACKET);
+
+ msg_body = jsonObjectToJSON(osrf_msg_list);
transport_message *tmsg = message_init(
msg_body, NULL, thread, recipient, NULL);
message_set_osrf_xid(tmsg, osrfLogGetXid());
client_send_message(osrf_handle, tmsg);
- osrfLogClearXid();
+
+ for (i = 0; i < osrf_msg_list->size; i++) {
+ osrf_msg = jsonObjectGetIndex(osrf_msg_list, i);
+ if (osrf_msg) {
+ }
+ }
+
+
+ osrfLogClearXid();
message_free(tmsg);
jsonObjectFree(msg_wrapper);
free(msg_body);