fix command parsing
This commit is contained in:
parent
ff2e7bb989
commit
6c31bb6ddc
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <mtx/responses/common.hpp>
|
#include <mtx/responses/common.hpp>
|
||||||
#include <mtx/responses/media.hpp>
|
#include <mtx/responses/media.hpp>
|
||||||
|
#include <QRegExp>
|
||||||
|
|
||||||
#include "Cache.h"
|
#include "Cache.h"
|
||||||
#include "ChatPage.h"
|
#include "ChatPage.h"
|
||||||
@ -203,9 +204,7 @@ InputBar::send()
|
|||||||
auto wasEdit = !room->edit().isEmpty();
|
auto wasEdit = !room->edit().isEmpty();
|
||||||
|
|
||||||
if (text().startsWith('/')) {
|
if (text().startsWith('/')) {
|
||||||
int command_end = text().indexOf(' ');
|
int command_end = text().indexOf(QRegExp("\\s+"));
|
||||||
if (command_end == -1)
|
|
||||||
command_end = text().indexOf('\n');
|
|
||||||
if (command_end == -1)
|
if (command_end == -1)
|
||||||
command_end = text().size();
|
command_end = text().size();
|
||||||
auto name = text().mid(1, command_end - 1);
|
auto name = text().mid(1, command_end - 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user