Update to new rjp api
This commit is contained in:
parent
ec3901b904
commit
76431079c6
@ -67,7 +67,7 @@ namespace matrix{
|
||||
if(!reply)
|
||||
return _create_netreturn(reply, http_status());
|
||||
|
||||
raii::rjp_ptr root(rjp_parse(reply, RJP_PARSE_ALL_EXT));
|
||||
raii::rjp_ptr root(rjp_parse(reply, RJP_PARSE_ALL_EXT, NULL));
|
||||
netreturn<std::vector<raii::rjp_string>> retval = _create_netreturn(root, http_status());
|
||||
if(!root)
|
||||
return retval;
|
||||
@ -180,7 +180,7 @@ namespace matrix{
|
||||
|
||||
if(!reply)
|
||||
return netreturn<sync::client_response>(rexy::string(), rexy::string(), http_status(), {nullptr});
|
||||
raii::rjp_ptr root(rjp_parse(reply, RJP_PARSE_ALL_EXT));
|
||||
raii::rjp_ptr root(rjp_parse(reply, RJP_PARSE_ALL_EXT, NULL));
|
||||
netreturn<sync::client_response> retval = _create_netreturn(root, http_status());
|
||||
if(!root)
|
||||
return retval;
|
||||
@ -227,7 +227,7 @@ namespace matrix{
|
||||
if(!succ || !fileurl)
|
||||
return _create_netreturn(fileurl, http_status());
|
||||
|
||||
raii::rjp_ptr root(rjp_parse(fileurl, RJP_PARSE_ALL_EXT));
|
||||
raii::rjp_ptr root(rjp_parse(fileurl, RJP_PARSE_ALL_EXT, NULL));
|
||||
netreturn<uploaded_file> retval = _create_netreturn(root, http_status());
|
||||
if(!root)
|
||||
return retval;
|
||||
|
||||
@ -161,7 +161,7 @@ namespace matrix{
|
||||
rexy::string reply = _post_curl(data, url, header);
|
||||
if(!reply)
|
||||
return _create_netreturn(reply, http_status());
|
||||
raii::rjp_ptr root(rjp_parse(reply, RJP_PARSE_ALL_EXT));
|
||||
raii::rjp_ptr root(rjp_parse(reply, RJP_PARSE_ALL_EXT, NULL));
|
||||
netreturn<raii::rjp_string> retval = _create_netreturn(root, http_status());
|
||||
retval.value() = _curl_reply_search(reply, target);
|
||||
return retval;
|
||||
@ -172,7 +172,7 @@ namespace matrix{
|
||||
rexy::string reply = _put_curl(data, url, header);
|
||||
if(!reply)
|
||||
return _create_netreturn(reply, http_status());
|
||||
raii::rjp_ptr root(rjp_parse(reply, RJP_PARSE_ALL_EXT));
|
||||
raii::rjp_ptr root(rjp_parse(reply, RJP_PARSE_ALL_EXT, NULL));
|
||||
netreturn<raii::rjp_string> retval = _create_netreturn(root, http_status());
|
||||
retval.value() = _curl_reply_search(reply, target);
|
||||
return retval;
|
||||
@ -181,13 +181,13 @@ namespace matrix{
|
||||
rexy::string reply = _get_curl(url);
|
||||
if(!reply)
|
||||
return _create_netreturn(reply, http_status());
|
||||
raii::rjp_ptr root(rjp_parse(reply, RJP_PARSE_ALL_EXT));
|
||||
raii::rjp_ptr root(rjp_parse(reply, RJP_PARSE_ALL_EXT, NULL));
|
||||
netreturn<raii::rjp_string> retval = _create_netreturn(root, http_status());
|
||||
retval.value() = _curl_reply_search(reply, target);
|
||||
return retval;
|
||||
}
|
||||
raii::rjp_string connection::_curl_reply_search(const rexy::string_base& reply, const rexy::string_base& target)const{
|
||||
raii::rjp_ptr root(rjp_parse(reply, RJP_PARSE_ALL_EXT));
|
||||
raii::rjp_ptr root(rjp_parse(reply, RJP_PARSE_ALL_EXT, NULL));
|
||||
return _curl_reply_search(root, target);
|
||||
}
|
||||
raii::rjp_string connection::_curl_reply_search(const raii::rjp_ptr& root, const rexy::string_base& target)const{
|
||||
@ -218,7 +218,7 @@ namespace matrix{
|
||||
netreturn_base connection::_create_netreturn(const rexy::string_base& mxjson, int httpstatus){
|
||||
if(!mxjson)
|
||||
return netreturn_base(""_ss, ""_ss, httpstatus);
|
||||
raii::rjp_ptr root(rjp_parse(mxjson.get(), RJP_PARSE_ALL_EXT));
|
||||
raii::rjp_ptr root(rjp_parse(mxjson.get(), RJP_PARSE_ALL_EXT, NULL));
|
||||
return _create_netreturn(root, httpstatus);
|
||||
}
|
||||
netreturn_base connection::_create_netreturn(const raii::rjp_ptr& root, int httpstatus){
|
||||
|
||||
@ -57,7 +57,7 @@ namespace matrix{
|
||||
|
||||
rexy::string resp = _get_curl(m_urls.room_members());
|
||||
if(!resp) return _create_netreturn(resp, http_status());
|
||||
raii::rjp_ptr root(rjp_parse(resp.get(), RJP_PARSE_ALL_EXT));
|
||||
raii::rjp_ptr root(rjp_parse(resp.get(), RJP_PARSE_ALL_EXT, NULL));
|
||||
if(!root) return _create_netreturn(root, http_status());
|
||||
RJP_value* res = rjp_search_member(root.get(), json::keys::joined());
|
||||
if(!res) return _create_netreturn(root, http_status());
|
||||
@ -107,7 +107,7 @@ namespace matrix{
|
||||
if(!reply)
|
||||
return _create_netreturn(reply, http_status());
|
||||
|
||||
raii::rjp_ptr root(rjp_parse(reply, RJP_PARSE_ALL_EXT));
|
||||
raii::rjp_ptr root(rjp_parse(reply, RJP_PARSE_ALL_EXT, NULL));
|
||||
netreturn<raii::rjp_string> retval = _create_netreturn(root, http_status());
|
||||
retval.value() = _curl_reply_search(root, json::keys::event::eventid());
|
||||
return retval;
|
||||
@ -144,7 +144,7 @@ namespace matrix{
|
||||
netreturn<sync::roomcxn_message_event_list> roomcxn::get_event(const rexy::string_base& eventid)const{
|
||||
rexy::string reply = _get_curl(m_urls.event(*m_ses, m_curl.encode(m_roomid), eventid));
|
||||
if(!reply) return _create_netreturn(reply, http_status());
|
||||
raii::rjp_ptr root(rjp_parse(reply.get(), RJP_PARSE_ALL_EXT));
|
||||
raii::rjp_ptr root(rjp_parse(reply.get(), RJP_PARSE_ALL_EXT, NULL));
|
||||
if(!root.get()) _create_netreturn(root, http_status());
|
||||
|
||||
netreturn<sync::roomcxn_message_event_list> retval = _create_netreturn(root, http_status());
|
||||
@ -160,7 +160,7 @@ namespace matrix{
|
||||
netreturn<sync::roomcxn_message_event_list> roomcxn::_get_events(int amount, rexy::static_string direction, const rexy::string_base& from, const rexy::string_base& to){
|
||||
rexy::string reply = _get_curl(m_urls.messages(*m_ses, m_curl.encode(m_roomid), from, to, direction, amount));
|
||||
if(!reply) return _create_netreturn(reply, http_status());
|
||||
raii::rjp_ptr root(rjp_parse(reply.get(), RJP_PARSE_ALL_EXT));
|
||||
raii::rjp_ptr root(rjp_parse(reply.get(), RJP_PARSE_ALL_EXT, NULL));
|
||||
if(!root.get()) _create_netreturn(root, http_status());
|
||||
|
||||
netreturn<sync::roomcxn_message_event_list> retval = _create_netreturn(root, http_status());
|
||||
|
||||
@ -82,7 +82,7 @@ namespace matrix{
|
||||
rexy::string reply = _post_curl(json::_empty(), rest::session_urls::password(*m_ses), raii::curl_llist());
|
||||
if(!reply)
|
||||
return _create_netreturn(reply, http_status());
|
||||
raii::rjp_ptr root(rjp_parse(reply, RJP_PARSE_ALL_EXT));
|
||||
raii::rjp_ptr root(rjp_parse(reply, RJP_PARSE_ALL_EXT, NULL));
|
||||
netreturn<void> retval = _create_netreturn(root, http_status());
|
||||
if(!root)
|
||||
return retval;
|
||||
@ -155,7 +155,7 @@ namespace matrix{
|
||||
rexy::string reply = _request_access_token(name, pass, loginurl);
|
||||
if(!reply)
|
||||
return _create_netreturn(reply, http_status());
|
||||
raii::rjp_ptr root(rjp_parse(reply, RJP_PARSE_ALL_EXT));
|
||||
raii::rjp_ptr root(rjp_parse(reply, RJP_PARSE_ALL_EXT, NULL));
|
||||
netreturn<std::pair<raii::rjp_string,raii::rjp_string>> retval = _create_netreturn(root, http_status());
|
||||
if(!root)
|
||||
return retval;
|
||||
|
||||
@ -51,7 +51,7 @@ namespace matrix::sync{
|
||||
|
||||
//Sync response
|
||||
client_response::client_response(const rexy::string_base& s):
|
||||
m_root(rjp_parse(s, RJP_PARSE_ALL_EXT)){}
|
||||
m_root(rjp_parse(s, RJP_PARSE_ALL_EXT, NULL)){}
|
||||
client_response::client_response(RJP_value* root):
|
||||
m_root(root){}
|
||||
room_list client_response::room_join_events(void)const{
|
||||
|
||||
@ -37,7 +37,7 @@ matrix::auth_data read_auth_file(const char* filename){
|
||||
if(!fp){
|
||||
return {};
|
||||
}
|
||||
raii::rjp_ptr root(rjp_parse(fp.read(fp.length()), RJP_PARSE_ALL_EXT));
|
||||
raii::rjp_ptr root(rjp_parse(fp.read(fp.length()), RJP_PARSE_ALL_EXT, NULL));
|
||||
if(!root.get())
|
||||
return {};
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ matrix::auth_data read_auth_file(const char* filename){
|
||||
if(!fp){
|
||||
return {};
|
||||
}
|
||||
raii::rjp_ptr root(rjp_parse(fp.read(fp.length())));
|
||||
raii::rjp_ptr root(rjp_parse(fp.read(fp.length()), RJP_PARSE_ALL_EXT, NULL));
|
||||
if(!root.get())
|
||||
return {};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user