diff options
author | dec05eba <dec05eba@protonmail.com> | 2023-11-05 18:17:23 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2023-11-05 18:17:23 +0100 |
commit | 913e40f114fb6e18f495ca65e5f332ef37a320f9 (patch) | |
tree | aed20724ce1d255113c46f2d565f5b8d480f5f82 /src/plugins | |
parent | 7b2cd582f1f69f57c8f826ae8e0a7eadd6e33627 (diff) |
Matrix: add config option 'appear_online' to set online presence
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/Matrix.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 4ec7f35..5882653 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -1745,14 +1745,16 @@ namespace QuickMedia { else filter_encoded = url_param_encode(CONTINUE_FILTER); + const char *presence = ::QuickMedia::get_config().matrix.appear_online ? "online" : "offline"; + while(sync_running) { char url[2048]; if(next_batch.empty()) - snprintf(url, sizeof(url), "%s/_matrix/client/r0/sync?filter=%s&timeout=0", homeserver.c_str(), filter_encoded.c_str()); + snprintf(url, sizeof(url), "%s/_matrix/client/r0/sync?filter=%s&timeout=0&set_presence=%s", homeserver.c_str(), filter_encoded.c_str(), presence); else if(first_sync) - snprintf(url, sizeof(url), "%s/_matrix/client/r0/sync?filter=%s&timeout=0&since=%s", homeserver.c_str(), filter_encoded.c_str(), next_batch.c_str()); + snprintf(url, sizeof(url), "%s/_matrix/client/r0/sync?filter=%s&timeout=0&since=%s&set_presence=%s", homeserver.c_str(), filter_encoded.c_str(), next_batch.c_str(), presence); else - snprintf(url, sizeof(url), "%s/_matrix/client/r0/sync?filter=%s&timeout=30000&since=%s", homeserver.c_str(), filter_encoded.c_str(), next_batch.c_str()); + snprintf(url, sizeof(url), "%s/_matrix/client/r0/sync?filter=%s&timeout=30000&since=%s&set_presence=%s", homeserver.c_str(), filter_encoded.c_str(), next_batch.c_str(), presence); rapidjson::Document json_root; std::string err_msg; |