mirror of https://notabug.org/acetone/ircabot.git
parent
dbc3cda1d5
commit
74b6910084
|
@ -223,8 +223,8 @@ void ApplicationData::readConfig()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
newConnection.channels = channelsString.split(',');
|
newConnection.channels = channelsString.split(',');
|
||||||
|
newConnection.channels.removeAll("");
|
||||||
for (auto &ch: newConnection.channels) {
|
for (auto &ch: newConnection.channels) {
|
||||||
if (ch.isEmpty()) continue;
|
|
||||||
ch.remove(' ');
|
ch.remove(' ');
|
||||||
if (not ch.startsWith('#')) {
|
if (not ch.startsWith('#')) {
|
||||||
ch = '#' + ch;
|
ch = '#' + ch;
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
#include "connectiondata.h"
|
#include "connectiondata.h"
|
||||||
|
|
||||||
ConnectionData::ConnectionData() : port(0) {}
|
ConnectionData::ConnectionData() : port(0) {}
|
||||||
|
|
||||||
|
bool ConnectionData::isOk()
|
||||||
|
{
|
||||||
|
return (not address.isEmpty() and
|
||||||
|
port != 0 and
|
||||||
|
not displayName.isEmpty() and
|
||||||
|
not channels.isEmpty());
|
||||||
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
struct ConnectionData
|
struct ConnectionData
|
||||||
{
|
{
|
||||||
ConnectionData();
|
ConnectionData();
|
||||||
|
bool isOk();
|
||||||
|
|
||||||
QString address;
|
QString address;
|
||||||
quint16 port;
|
quint16 port;
|
||||||
|
|
|
@ -28,6 +28,7 @@ IrcClient::IrcClient(const ConnectionData& config, QObject *parent) :
|
||||||
dir.mkdir(path);
|
dir.mkdir(path);
|
||||||
}
|
}
|
||||||
dir.cd(path);
|
dir.cd(path);
|
||||||
|
m_connectionData.channels.removeAll("");
|
||||||
for (auto chan: m_connectionData.channels) {
|
for (auto chan: m_connectionData.channels) {
|
||||||
chan.remove('#');
|
chan.remove('#');
|
||||||
dir.mkdir(chan);
|
dir.mkdir(chan);
|
||||||
|
|
1
main.cpp
1
main.cpp
|
@ -68,6 +68,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
auto serversData = configuration.getConnections();
|
auto serversData = configuration.getConnections();
|
||||||
for (auto server: serversData) {
|
for (auto server: serversData) {
|
||||||
|
if (not server.isOk()) continue;
|
||||||
IrcClientStarter* wrapper = new IrcClientStarter(server, &webInterface);
|
IrcClientStarter* wrapper = new IrcClientStarter(server, &webInterface);
|
||||||
QThread* thread = new QThread;
|
QThread* thread = new QThread;
|
||||||
wrapper->moveToThread(thread);
|
wrapper->moveToThread(thread);
|
||||||
|
|
Loading…
Reference in New Issue