mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-08 03:35:35 +08:00
Ref T192, fixed parsing of DBus string
This commit is contained in:
@@ -104,14 +104,17 @@ namespace BlackMisc
|
||||
const QStringList parts(address.split(','));
|
||||
for (const QString &part : parts)
|
||||
{
|
||||
if (part.startsWith("host="))
|
||||
// "host=" or "tcp:host="
|
||||
if (part.contains("host=", Qt::CaseInsensitive))
|
||||
{
|
||||
host = part.midRef(part.lastIndexOf("=") + 1).trimmed().toString();
|
||||
const QString h = part.mid(part.lastIndexOf("=") + 1).trimmed();
|
||||
host = h;
|
||||
}
|
||||
else if (part.startsWith("port="))
|
||||
else if (part.contains("port=", Qt::CaseInsensitive))
|
||||
{
|
||||
const QString p = part.mid(part.lastIndexOf("=") + 1).trimmed();
|
||||
bool ok;
|
||||
port = part.midRef(part.lastIndexOf("=") + 1).trimmed().toInt(&ok);
|
||||
port = p.toInt(&ok);
|
||||
if (! ok) { port = -1; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user