diff options
-rw-r--r-- | example-config.json | 3 | ||||
-rw-r--r-- | include/Config.hpp | 1 | ||||
-rw-r--r-- | src/Config.cpp | 1 | ||||
-rw-r--r-- | src/plugins/Matrix.cpp | 8 |
4 files changed, 9 insertions, 4 deletions
diff --git a/example-config.json b/example-config.json index 35f2702..cb332f0 100644 --- a/example-config.json +++ b/example-config.json @@ -76,7 +76,8 @@ // If you want others to know that you have read their message or not "send_read_receipts": true, // If you want others to know when you are typing a message in the room - "send_typing_notifications": true + "send_typing_notifications": true, + "appear_online": true }, "peertube": { // List of instances to display when opening peertube diff --git a/include/Config.hpp b/include/Config.hpp index 1d4675f..6f908c8 100644 --- a/include/Config.hpp +++ b/include/Config.hpp @@ -61,6 +61,7 @@ namespace QuickMedia { int room_description_font_size = 12; bool send_read_receipts = true; bool send_typing_notifications = true; + bool appear_online = true; }; struct PeertubeConfig { diff --git a/src/Config.cpp b/src/Config.cpp index a17e883..e8f67f6 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -242,6 +242,7 @@ namespace QuickMedia { get_json_value(matrix_json, "room_description_font_size", config->matrix.room_description_font_size); get_json_value(matrix_json, "send_read_receipts", config->matrix.send_read_receipts); get_json_value(matrix_json, "send_typing_notifications", config->matrix.send_typing_notifications); + get_json_value(matrix_json, "appear_online", config->matrix.appear_online); } if(!has_known_matrix_homeservers_config) 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; |