aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-06-13 17:59:25 +0200
committerdec05eba <dec05eba@protonmail.com>2023-06-13 17:59:25 +0200
commit3554a838c2318863f59ad4b50a17edc19b5cb94a (patch)
tree1d9e6b25ef8124a0b15733c76cfb7321c71956f6
parentac58f524a8a734e9ea6a8c5acc063891f480d58d (diff)
Matrix: add send_typing_notifications config
-rw-r--r--TODO3
-rw-r--r--example-config.json4
-rw-r--r--include/Config.hpp1
-rw-r--r--src/Config.cpp1
-rw-r--r--src/plugins/Matrix.cpp6
5 files changed, 13 insertions, 2 deletions
diff --git a/TODO b/TODO
index 61cf92b..b52b212 100644
--- a/TODO
+++ b/TODO
@@ -268,4 +268,5 @@ Rename local-anime/local-manga to more generic media forms (local-media/local-sh
Add ability to create room, commands for changing nickname, roomnickname, avatar, kick, ban, etc.
Replace pepper emoji with gimp pepper.
Consider adding typing notification to matrix.
-Make it possible to switch between list and grid view. \ No newline at end of file
+Make it possible to switch between list and grid view.
+Automatically manage cache - remove old cache files. \ No newline at end of file
diff --git a/example-config.json b/example-config.json
index 675636a..b2efea3 100644
--- a/example-config.json
+++ b/example-config.json
@@ -67,7 +67,9 @@
"room_name_font_size": 18,
"room_description_font_size": 12,
// If you want others to know that you have read their message or not
- "send_read_receipts": true
+ "send_read_receipts": true,
+ // If you want others to know when you are typing a message in the room
+ "send_typing_notifications": true
},
"peertube": {
// List of instances to display when opening peertube
diff --git a/include/Config.hpp b/include/Config.hpp
index 2316f06..5bbeaff 100644
--- a/include/Config.hpp
+++ b/include/Config.hpp
@@ -54,6 +54,7 @@ namespace QuickMedia {
int room_name_font_size = 18;
int room_description_font_size = 12;
bool send_read_receipts = true;
+ bool send_typing_notifications = true;
};
struct PeertubeConfig {
diff --git a/src/Config.cpp b/src/Config.cpp
index bdc4012..fe4e984 100644
--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -231,6 +231,7 @@ namespace QuickMedia {
get_json_value(matrix_json, "room_name_font_size", config->matrix.room_name_font_size);
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);
}
if(!has_known_matrix_homeservers_config)
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index b2b05e2..16dd098 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -5413,6 +5413,9 @@ namespace QuickMedia {
}
PluginResult Matrix::on_start_typing(RoomData *room) {
+ if(!QuickMedia::get_config().matrix.send_typing_notifications)
+ return PluginResult::OK;
+
rapidjson::Document request_data(rapidjson::kObjectType);
request_data.AddMember("typing", true, request_data.GetAllocator());
request_data.AddMember("timeout", 30000, request_data.GetAllocator()); // 30 sec timeout
@@ -5434,6 +5437,9 @@ namespace QuickMedia {
}
PluginResult Matrix::on_stop_typing(RoomData *room) {
+ if(!QuickMedia::get_config().matrix.send_typing_notifications)
+ return PluginResult::OK;
+
rapidjson::Document request_data(rapidjson::kObjectType);
request_data.AddMember("typing", false, request_data.GetAllocator());