Normalized handling of leading/trailing whitespace in sample app (refs #22)

This commit is contained in:
Mathew Sutcliffe
2013-08-04 17:49:46 +01:00
parent d1e35c0b27
commit 56e05b55a9
2 changed files with 3 additions and 2 deletions

View File

@@ -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&)