Add raw access to json structure from event

This commit is contained in:
rexy712 2020-01-03 21:24:56 -08:00
parent 4f5efa9ba9
commit 500c0eb6ee
2 changed files with 10 additions and 0 deletions

View File

@ -31,6 +31,7 @@ namespace matrix::sync{
class event class event
{ {
protected: protected:
RJP_value* m_event;
RJP_value* m_type; RJP_value* m_type;
RJP_value* m_content; RJP_value* m_content;
public: public:
@ -43,6 +44,8 @@ namespace matrix::sync{
raii::rjp_string type(void)&&; raii::rjp_string type(void)&&;
const RJP_value* content(void)const; const RJP_value* content(void)const;
RJP_value* content(void); RJP_value* content(void);
const RJP_value* raw(void)const;
RJP_value* raw(void);
}; };

View File

@ -23,6 +23,7 @@ namespace matrix::sync{
//Event base //Event base
event::event(RJP_value* ev): event::event(RJP_value* ev):
m_event(ev),
m_type(rjp_search_member(ev, json::keys::event::type(), 0).value), m_type(rjp_search_member(ev, json::keys::event::type(), 0).value),
m_content(rjp_search_member(ev, json::keys::event::content(), 0).value){} m_content(rjp_search_member(ev, json::keys::event::content(), 0).value){}
raii::static_string event::type(void)const&{ raii::static_string event::type(void)const&{
@ -37,6 +38,12 @@ namespace matrix::sync{
RJP_value* event::content(void){ RJP_value* event::content(void){
return m_content; return m_content;
} }
const RJP_value* event::raw(void)const{
return m_event;
}
RJP_value* event::raw(void){
return m_event;
}
//Room event //Room event
room_event::room_event(RJP_value* ev, const raii::string_base& roomid): room_event::room_event(RJP_value* ev, const raii::string_base& roomid):