diff --git a/include/matrix/client.hpp b/include/matrix/client.hpp index d89bbce..4ad2f9a 100644 --- a/include/matrix/client.hpp +++ b/include/matrix/client.hpp @@ -48,23 +48,6 @@ namespace matrix{ client& operator=(const client&) = default; client& operator=(client&&) = default; - /* - * NOT thread safe. - * Returns: the current access token. - */ - const raii::rjp_string& access_token(void)const; - /* - * NOT thread safe - * Returns: the logged in user's userid. - */ - const raii::rjp_string& userid(void)const; - /* - * NOT thread safe - * Returns: the current useragent. - */ - const raii::string& useragent(void)const; - - /* * Sets the display name on the homeserver. * Note name must be safe to be placed in a json string. diff --git a/include/matrix/connection.hpp b/include/matrix/connection.hpp index 1798064..ae829c4 100644 --- a/include/matrix/connection.hpp +++ b/include/matrix/connection.hpp @@ -43,6 +43,22 @@ namespace matrix{ public: ~connection(void) = default; + /* + * NOT thread safe. + * Returns: the current access token. + */ + const raii::rjp_string& access_token(void)const; + /* + * NOT thread safe + * Returns: the logged in user's userid. + */ + const raii::rjp_string& userid(void)const; + /* + * NOT thread safe + * Returns: the current useragent. + */ + const raii::string& useragent(void)const; + /* * Returns: the http status code of the last operation performed. */ diff --git a/include/matrix/session.hpp b/include/matrix/session.hpp index 7a0b404..d80a158 100644 --- a/include/matrix/session.hpp +++ b/include/matrix/session.hpp @@ -31,7 +31,7 @@ namespace matrix{ //Manages connection to homeserver and user login. //Shares states with any spawned clients and syncers. - class session : protected connection + class session : public connection { private: bool m_valid = false; diff --git a/src/matrix/client.cpp b/src/matrix/client.cpp index ba362b8..7b52237 100644 --- a/src/matrix/client.cpp +++ b/src/matrix/client.cpp @@ -38,17 +38,6 @@ namespace matrix{ client::client(const std::shared_ptr& ses): connection(ses){} - //local getter - const raii::rjp_string& client::access_token(void)const{ - return m_ses->access_token; - } - const raii::rjp_string& client::userid(void)const{ - return m_ses->userid; - } - const raii::string& client::useragent(void)const{ - return m_ses->useragent; - } - //networked setter bool client::set_display_name(const raii::string_base& newname){ _put_curl(raii::string("{\"displayname\":\"" + newname + "\"}"), m_ses->urls.displayname(), raii::curl_llist()); diff --git a/src/matrix/connection.cpp b/src/matrix/connection.cpp index 89e2e65..a4bf087 100644 --- a/src/matrix/connection.cpp +++ b/src/matrix/connection.cpp @@ -30,6 +30,17 @@ namespace matrix{ { _set_curl_defaults(""_ss); } + //local getter + const raii::rjp_string& connection::access_token(void)const{ + return m_ses->access_token; + } + const raii::rjp_string& connection::userid(void)const{ + return m_ses->userid; + } + const raii::string& connection::useragent(void)const{ + return m_ses->useragent; + } + long connection::http_status(void)const{ return m_curl.last_status(); }