aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 7cd5d8d..3a2f2f5 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -6319,7 +6319,9 @@ namespace QuickMedia {
"/me [text]: Send a message of type \"m.emote\".\n"
"/react [text]: React to the selected message (also works if you are replying to a message).\n"
"/id: Show the room id.\n"
- "/encrypt [text]: Send a message encrypted with gpg. gpg needs to be installed to do this. Uses the gpg key specified by the user id in your config variable \"matrix.gpg_user_id\".";
+ "/whoami: Show your user id.\n"
+ "/encrypt [text]: Send a message encrypted with gpg. gpg needs to be installed to do this. Uses the gpg key specified by the user id in your config variable \"matrix.gpg_user_id\".\n"
+ "/bot [text]: Send a message as a bot would.";
message->timestamp = time(nullptr) * 1000; // TODO: What if the user has broken local time?
matrix->append_system_message(current_room, std::move(message));
@@ -6339,9 +6341,24 @@ namespace QuickMedia {
chat_state = ChatState::NAVIGATING;
matrix->get_room_extra_data(current_room).editing_message_id.clear();
return true;
+ } else if(text == "/whoami") {
+ auto message = std::make_shared<Message>();
+ message->type = MessageType::SYSTEM;
+ message->user = me;
+ message->body = me->user_id;
+ message->timestamp = time(nullptr) * 1000; // TODO: What if the user has broken local time?
+ matrix->append_system_message(current_room, std::move(message));
+
+ chat_input.set_editable(false);
+ chat_state = ChatState::NAVIGATING;
+ matrix->get_room_extra_data(current_room).editing_message_id.clear();
+ return true;
} else if(strncmp(text.c_str(), "/me ", 4) == 0) {
msgtype = "m.emote";
text.erase(text.begin(), text.begin() + 4);
+ } else if(strncmp(text.c_str(), "/bot ", 5) == 0) {
+ msgtype = "m.notice";
+ text.erase(text.begin(), text.begin() + 5);
} else if(strncmp(text.c_str(), "/react ", 7) == 0) {
msgtype = "m.reaction";
text.erase(text.begin(), text.begin() + 7);