|
@@ -137,14 +137,7 @@ void App::loadServerList()
|
|
|
print("Maximum number of servers allowed reached, some servers weren't added to the monitoring list.\n");
|
|
|
return;
|
|
|
}
|
|
|
- ActiveClient* ac = new ActiveClient(this, sv.supportsSendPrivate);
|
|
|
- ac->setAddress(QHostAddress(sv.address), sv.port);
|
|
|
- ac->client()->setQuakeFolder(Settings::globalInstance()->quakeFolder().toAscii().data());
|
|
|
- ac->client()->setName(Settings::globalInstance()->botName().toAscii().data());
|
|
|
- ac->client()->setSpectator(Settings::globalInstance()->botSpectator());
|
|
|
- ac->client()->setPing(Settings::globalInstance()->botPing());
|
|
|
- ac->client()->setColor(Settings::globalInstance()->botTopColor(), Settings::globalInstance()->botBottomColor());
|
|
|
- myClients.push_back(ac);
|
|
|
+ addClient(sv.address, sv.port, sv.supportsSendPrivate);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -200,12 +193,12 @@ bool App::addClient(const QString &host, quint16 port, bool sendPrivateSupport)
|
|
|
{
|
|
|
ActiveClient* ac;
|
|
|
QHostAddress ha(host);
|
|
|
-
|
|
|
+ QString fullAddress = host + ":" + QString::number(port);
|
|
|
foreach(ac, myClients)
|
|
|
{
|
|
|
- if(QString(ac->client()->host()) == ha.toString() && ac->client()->port() == port)
|
|
|
+ if(ac->serverAddressString() == fullAddress)
|
|
|
{
|
|
|
- print("That client is already on the list.\n");
|
|
|
+ print("That client is already on the list [" + fullAddress + "]\n");
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -221,7 +214,7 @@ bool App::addClient(const QString &host, quint16 port, bool sendPrivateSupport)
|
|
|
|
|
|
saveServerList();
|
|
|
|
|
|
- print("Client added to watch list.\n");
|
|
|
+ print("Client added to watch list [" + fullAddress + "]\n");
|
|
|
|
|
|
return true;
|
|
|
}
|
|
@@ -230,11 +223,11 @@ bool App::addClient(const QString &host, quint16 port, bool sendPrivateSupport)
|
|
|
bool App::removeClient(const QString &host, quint16 port)
|
|
|
{
|
|
|
ActiveClient* ac;
|
|
|
- QHostAddress ha = QHostInfo::fromName(host).addresses().at(0);
|
|
|
-
|
|
|
+ QHostAddress ha(host);
|
|
|
+ QString fullAddress = host + ":" + QString::number(port);
|
|
|
foreach(ac, myClients)
|
|
|
{
|
|
|
- if(ac->serverAddressString() == QString(ha.toString() + ':' + QString::number(port)))
|
|
|
+ if(ac->serverAddressString() == fullAddress)
|
|
|
{
|
|
|
ac->client()->disconnect();
|
|
|
delete ac;
|
|
@@ -242,11 +235,11 @@ bool App::removeClient(const QString &host, quint16 port)
|
|
|
|
|
|
saveServerList();
|
|
|
|
|
|
- print("Client removed from watch list.\n");
|
|
|
+ print("Client removed from watch list [" + fullAddress + "]\n");
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
- print("Client not found on the list.\n");
|
|
|
+ print("Client not found on the list [" + fullAddress + "]\n");
|
|
|
return false;
|
|
|
}
|
|
|
|