aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/Matrix.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 2321ff4..8b819a2 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -943,6 +943,22 @@ namespace QuickMedia {
return PluginResult::OK;
}
+ PluginResult Matrix::logout() {
+ Path session_path = get_storage_dir().join(name).join("session.json");
+ remove(session_path.data.c_str());
+
+ std::vector<CommandArg> additional_args = {
+ { "-X", "POST" },
+ { "-H", "Authorization: Bearer " + access_token }
+ };
+
+ std::string server_response;
+ if(download_to_string(homeserver + "/_matrix/client/r0/logout", server_response, std::move(additional_args), use_tor, true) != DownloadResult::OK)
+ return PluginResult::NET_ERR;
+
+ return PluginResult::OK;
+ }
+
PluginResult Matrix::load_and_verify_cached_session() {
Path session_path = get_storage_dir().join(name).join("session.json");
std::string session_json_content;