many bugfixes, utf8 output, integer input fields, version "(6) Düren"

refactor-result-recursion
Lars Rohwedder 7 years ago
parent da9f2554b3
commit 111e037bf5

@ -66,6 +66,11 @@ var Param2Form =
{
return genInput('inp_param_' + nr , 25, pp.direction, value);
},
Integer : function(nr, pp, value)
{
return genInput('inp_param_' + nr , 25, pp.direction, value);
},
StringList : function(nr, pp, value)
{
if(pp.direction=="Out")
@ -117,6 +122,10 @@ var Form2Param =
{
return document.getElementById( 'inp_param_' + nr ).value;
},
Integer: function(nr, pp, value)
{
return parseInt( document.getElementById( 'inp_param_' + nr ).value );
},
StringList : function(nr, pp, value)
{
var ret = [];
@ -296,7 +305,7 @@ function prepare_call(f)
}
document.getElementById("td_param").disabled = false;
func_params = new Array(func.params.length);
func_params = new Array(func.params.length, '');
var len = f.params.length;
if(len==0)

@ -36,7 +36,10 @@ In<std::size_t>::~In()
template<>
Out<char const*>::~Out()
{
if(value) free(const_cast<char*>(*value));
if(value)
{
free(const_cast<char*>(*value));
}
delete value;
}
@ -44,8 +47,11 @@ Out<char const*>::~Out()
template<>
Out<char*>::~Out()
{
if(value) free(*value);
*value = nullptr;
if(value)
{
free(*value);
*value = nullptr;
}
delete value;
}

@ -91,7 +91,7 @@ js::Object call(const FunctionMap& fm, const js::Object& request)
"\tmethod_name=\"" << method_name << "\","
"\tparams=" << js::write(params) << ". ===\n";
const js::Value result = fn->second->call(p);
std::cerr << "=== Result of call: " << js::write(result) << ". ===\n";
std::cerr << "=== Result of call: " << js::write(result, js::raw_utf8) << ". ===\n";
return make_result(result, request_id);
}

@ -44,8 +44,8 @@ const std::string server_version =
// "(5a) Eschweiler-West"; // add support for log_event() and trustwords()
// "(5b) Eschweiler-Ost"; // add support for get_identity() and get_languagelist()
// "(5c) Weisweiler"; // add missing members of struct message
"(5d) Langerwehe"; // add the remaining functions from pEpEngine.h
// "(5d) Langerwehe"; // add the remaining functions from pEpEngine.h
"(6) Düren"; // some bug fixes for missing data types, UTF-8 output etc., status in hex etc.
template<>
In<PEP_SESSION>::~In()
@ -54,22 +54,6 @@ In<PEP_SESSION>::~In()
}
// in pEpEngine.h positive values are hex, negative are decimal. :-o
std::string status_to_string(PEP_STATUS status)
{
if(status==PEP_STATUS_OK)
return "PEP_STATUS_OK";
std::stringstream ss;
if(status>0)
{
ss << "0x" << std::hex << status;
}else{
ss << status;
}
return ss.str();
}
PEP_SESSION createSession()
{
PEP_SESSION session = nullptr;
@ -81,6 +65,7 @@ PEP_SESSION createSession()
return session;
}
template<> const uint64_t SessionRegistry::Identifier = 0x44B0310A;
SessionRegistry session_registry(&createSession, &release);
@ -348,7 +333,7 @@ void OnApiRequest(evhttp_request* req, void*)
answer = make_error( JSON_RPC::INTERNAL_ERROR, "Got a std::exception: \"" + std::string(e.what()) + "\"", p, request_id );
}
sendReplyString(req, "text/plain", js::write(answer));
sendReplyString(req, "text/plain", js::write(answer, js::raw_utf8));
};

@ -29,6 +29,23 @@ namespace
}
// in pEpEngine.h positive values are hex, negative are decimal. :-o
std::string status_to_string(PEP_STATUS status)
{
if(status==PEP_STATUS_OK)
return "PEP_STATUS_OK";
std::stringstream ss;
if(status>0)
{
ss << "0x" << std::hex << status;
}else{
ss << status;
}
return ss.str();
}
template<>
In<const timestamp*>::~In()
{
@ -58,15 +75,21 @@ In<pEp_identity*>::~In()
template<>
Out<pEp_identity*>::~Out()
{
free_identity(*value);
if(value)
{
free_identity(*value);
}
delete value;
}
template<>
Out<pEp_identity*>::Out(const Out<pEp_identity*>& other)
: value( new pEp_identity* )
: value( new pEp_identity*{} )
{
*value = identity_dup(*other.value);
if(*other.value)
{
*value = identity_dup(*other.value);
}
}
@ -439,6 +462,7 @@ js::Value to_json<PEP_STATUS>(const PEP_STATUS& status)
{
js::Object o;
o.emplace_back( "status", int(status) );
o.emplace_back( "hex", status_to_string(status) );
return o;
}

@ -6,6 +6,7 @@
#include "function_map.hh"
#include <pEp/message_api.h>
// none necessary, yet. :-)
// in pEpEngine.h positive values are hex, negative are decimal. :-o
std::string status_to_string(PEP_STATUS status);
#endif // PEP_TYPES_HH

Loading…
Cancel
Save