aboutsummaryrefslogtreecommitdiff
path: root/src/QuickMedia.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-10-01 07:34:47 +0200
committerdec05eba <dec05eba@protonmail.com>2020-10-01 07:34:47 +0200
commitae02ed04389117d100070c47f3ae69abb9080231 (patch)
treedadda40c41a219c56d3bebcc6b26f7bc2ee64fc1 /src/QuickMedia.cpp
parent211982f321830691038cb79698fb55dcd015c9fc (diff)
Matrix: add message delete with ctrl+d
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r--src/QuickMedia.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index ecb44d5..cb58a27 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -3585,6 +3585,19 @@ namespace QuickMedia {
// TODO: Show inline notification
show_notification("QuickMedia", "No message selected for editing");
}
+ } else if(tabs[selected_tab].type == ChatTabType::MESSAGES && event.key.control && event.key.code == sf::Keyboard::D) {
+ BodyItem *selected = tabs[selected_tab].body->get_selected();
+ if(selected) {
+ // TODO: Make asynchronous
+ std::string err_msg;
+ if(matrix->delete_message(current_room_id, selected->userdata, err_msg) != PluginResult::OK) {
+ // TODO: Show inline notification
+ show_notification("QuickMedia", "Failed to delete message, reason: " + err_msg, Urgency::CRITICAL);
+ }
+ } else {
+ // TODO: Show inline notification
+ show_notification("QuickMedia", "No message selected for deletion");
+ }
}
}