fatal_handler( "Bad params to osrf_message_set_request_params()" );
if(msg->parse_json_params) {
- if( json_params != NULL )
+ if( json_params != NULL ) {
msg->params = json_tokener_parse(json_object_to_json_string(json_params));
- else
+ msg->_params = json_parse_string(json_object_to_json_string(json_params));
+ } else {
msg->params = json_tokener_parse("[]");
+ msg->_params = json_parse_string("[]");
+ }
}
msg->method_name = strdup( method_name );
debug_handler( "Message Parse JSON is set to: %d", msg->parse_json_result );
- if(msg->parse_json_result)
+ if(msg->parse_json_result) {
msg->result_content = json_tokener_parse(msg->result_string);
+ msg->_result_content = json_parse_string(msg->result_string);
+
+ char* j = object_to_json(msg->_result_content);
+ debug_handler("PARSE json result content %s", j);
+ free(j);
+ }
}
if( msg->result_content != NULL )
json_object_put( msg->result_content );
+ if( msg->_result_content != NULL )
+ free_object( msg->_result_content );
+
if( msg->result_string != NULL )
free( msg->result_string);
if( msg->params != NULL )
json_object_put( msg->params );
+ if( msg->_params != NULL )
+ free_object(msg->_params);
+
+
string_array_destroy(msg->parray);
free(msg);
if( msg->parse_json_params ) {
if( msg->params != NULL ) {
- char* jj = json_object_to_json_string( msg->params );
+ //char* jj = json_object_to_json_string( msg->params );
+ char* jj = msg->_params->to_json(msg->_params);
params_node = xmlNewChild( method_node, NULL, BAD_CAST "params", NULL );
xmlNodePtr tt = xmlNewDocTextLen( doc, BAD_CAST jj, strlen(jj) );
xmlAddChild(params_node, tt);
//new_msg->params = json_object_new_string( meth_node->children->content );
if( new_msg->parse_json_params) {
new_msg->params = json_tokener_parse(meth_node->children->content);
+ new_msg->_params = json_parse_string(meth_node->children->content);
} else {
/* XXX this will have to parse the JSON to
grab the strings for full support! This should only be
necessary for server support of
non-json-param-parsing, though. Ugh. */
new_msg->params = json_tokener_parse(meth_node->children->content);
+ new_msg->_params = json_parse_string(meth_node->children->content);
}
}
"request open-ils.auth open-ils.auth.authenticate.init \"%s\"", username );
parse_request(buf);
- char* hash = json_object_get_string( last_result->result_content );
+ //char* hash = json_object_get_string( last_result->result_content );
+
+ char* hash;
+ if(last_result && last_result->_result_content) {
+ object* r = last_result->_result_content;
+ hash = r->string_data;
+ } else return 0;
+
+ /*
+ fprintf(stderr, "HASHES %s : %s\n", hash, hash2);
+ object* r = last_result->_result_content;
+ fprintf(stderr, "%s\n", r->to_json(r));
+ */
+
char* pass_buf = md5sum(password);
char* mess_buf = md5sum(both_buf);
sprintf( buf2,
- "request open-ils.auth open-ils.auth.authenticate.complete \"%s\", \"%s\"",
+ "request open-ils.auth open-ils.auth.authenticate.complete \"%s\", \"%s\", \"opac\"",
username, mess_buf );
free(pass_buf);
parse_request( buf2 );
- login_session = strdup(json_object_get_string( last_result->result_content ));
+ //login_session = strdup(json_object_get_string( last_result->result_content ));
+ login_session = strdup(last_result->_result_content->string_data);
printf("Login Session: %s\n", login_session );
if( pretty_print )
content = json_printer( omsg->result_content );
else
- content = json_object_get_string(omsg->result_content);
+ //content = json_object_get_string(omsg->result_content);
+ content = object_get_string(omsg->_result_content);
debug_handler("srfsh2");