diff --git a/samples/cli_client/client.cpp b/samples/cli_client/client.cpp index c885d0bdb..b51b6cb52 100644 --- a/samples/cli_client/client.cpp +++ b/samples/cli_client/client.cpp @@ -93,6 +93,7 @@ void Client::command(QString line) QTextStream stream (&line, QIODevice::ReadOnly); QString cmd; stream >> cmd; + stream.skipWhiteSpace(); auto found = m_commands.find(cmd); if (found == m_commands.end()) @@ -154,7 +155,7 @@ void Client::setCallsignCmd(QTextStream& args) void Client::setRealNameCmd(QTextStream& args) { - emit setRealName(args.readLine().mid(1)); //readLine returns the entire line up to, but excluding, the LF character. mid(int) is the QString equivilent of a substring(start), used here to remove a space + emit setRealName(args.readAll()); } void Client::initiateConnectionCmd(QTextStream&) diff --git a/samples/cli_client/reader.cpp b/samples/cli_client/reader.cpp index c7bfbc7f8..a6ad50885 100644 --- a/samples/cli_client/reader.cpp +++ b/samples/cli_client/reader.cpp @@ -12,7 +12,7 @@ void LineReader::run() file.open(stdin, QIODevice::ReadOnly | QIODevice::Text); forever { - QString line = file.readLine(); + QString line = file.readLine().trimmed(); if (! line.isEmpty()) { emit command(line);