diff options
Diffstat (limited to 'src/TextInputWidget.cc')
-rw-r--r-- | src/TextInputWidget.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/TextInputWidget.cc b/src/TextInputWidget.cc index f894a247..b90a7caa 100644 --- a/src/TextInputWidget.cc +++ b/src/TextInputWidget.cc @@ -148,6 +148,11 @@ TextInputWidget::onSendButtonClicked() if (!text.isEmpty()) emit sendEmoteMessage(text); + } else if (msgText.startsWith(JOIN_COMMAND)) { + auto room = parseJoinCommand(msgText); + + if (!room.isEmpty()) + emit sendJoinRoomRequest(room); } else { emit sendTextMessage(msgText); } @@ -156,6 +161,17 @@ TextInputWidget::onSendButtonClicked() } QString +TextInputWidget::parseJoinCommand(const QString &cmd) +{ + auto room = cmd.right(cmd.size() - JOIN_COMMAND.size()).trimmed(); + + if (!room.isEmpty()) + return room; + + return QString(""); +} + +QString TextInputWidget::parseEmoteCommand(const QString &cmd) { auto text = cmd.right(cmd.size() - EMOTE_COMMAND.size()).trimmed(); |