aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/Matrix.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 82ca583..f79b10c 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -966,6 +966,34 @@ namespace QuickMedia {
title = "Invites (0)";
}
+ PluginResult MatrixSettingsPage::submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) {
+ if(args.url == "join") {
+ result_tabs.push_back(Tab{create_body(), std::make_unique<MatrixRoomInputPage>(program, matrix), create_search_bar("Enter room id...", SEARCH_DELAY_FILTER)});
+ return PluginResult::OK;
+ } else if(args.url == "logout") {
+ matrix->logout();
+ program->set_go_to_previous_page();
+ return PluginResult::OK;
+ } else {
+ return PluginResult::ERR;
+ }
+ }
+
+ PluginResult MatrixRoomInputPage::submit(const SubmitArgs &args, std::vector<Tab>&) {
+ if(args.title.empty()) {
+ show_notification("QuickMedia", "Room id can't be empty", Urgency::CRITICAL);
+ return PluginResult::OK;
+ }
+
+ if(matrix->join_room(args.title) == PluginResult::OK) {
+ show_notification("QuickMedia", "You joined " + args.title, Urgency::NORMAL);
+ program->set_go_to_previous_page();
+ } else {
+ show_notification("QuickMedia", "Failed to join " + args.title, Urgency::CRITICAL);
+ }
+ return PluginResult::OK;
+ }
+
MatrixChatPage::MatrixChatPage(Program *program, std::string room_id, MatrixRoomsPage *rooms_page, std::string jump_to_event_id) :
Page(program), room_id(std::move(room_id)), rooms_page(rooms_page), jump_to_event_id(std::move(jump_to_event_id))
{