mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-23 21:05:44 +03:00
SocketAPI: don't trim the command #3297
This commit is contained in:
parent
84f1bdbc87
commit
39289a3164
1 changed files with 4 additions and 3 deletions
|
@ -164,14 +164,15 @@ void SocketApi::slotReadSocket()
|
||||||
Q_ASSERT(socket);
|
Q_ASSERT(socket);
|
||||||
|
|
||||||
while(socket->canReadLine()) {
|
while(socket->canReadLine()) {
|
||||||
QString line = QString::fromUtf8(socket->readLine()).trimmed();
|
QString line = QString::fromUtf8(socket->readLine());
|
||||||
QString command = line.split(":").first();
|
line.chop(1); // remove the '\n'
|
||||||
|
QString command = line.split(":").value(0);
|
||||||
QString function = QString(QLatin1String("command_")).append(command);
|
QString function = QString(QLatin1String("command_")).append(command);
|
||||||
|
|
||||||
QString functionWithArguments = function + QLatin1String("(QString,QIODevice*)");
|
QString functionWithArguments = function + QLatin1String("(QString,QIODevice*)");
|
||||||
int indexOfMethod = this->metaObject()->indexOfMethod(functionWithArguments.toAscii());
|
int indexOfMethod = this->metaObject()->indexOfMethod(functionWithArguments.toAscii());
|
||||||
|
|
||||||
QString argument = line.remove(0, command.length()+1).trimmed();
|
QString argument = line.remove(0, command.length()+1);
|
||||||
if(indexOfMethod != -1) {
|
if(indexOfMethod != -1) {
|
||||||
QMetaObject::invokeMethod(this, function.toAscii(), Q_ARG(QString, argument), Q_ARG(QIODevice*, socket));
|
QMetaObject::invokeMethod(this, function.toAscii(), Q_ARG(QString, argument), Q_ARG(QIODevice*, socket));
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue