mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Normalized handling of leading/trailing whitespace in sample app (refs #22)
This commit is contained in:
@@ -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&)
|
||||
|
||||
Reference in New Issue
Block a user