diff --git a/applicationdata.cpp b/applicationdata.cpp index c209152..951bb14 100644 --- a/applicationdata.cpp +++ b/applicationdata.cpp @@ -223,8 +223,8 @@ void ApplicationData::readConfig() continue; } newConnection.channels = channelsString.split(','); + newConnection.channels.removeAll(""); for (auto &ch: newConnection.channels) { - if (ch.isEmpty()) continue; ch.remove(' '); if (not ch.startsWith('#')) { ch = '#' + ch; diff --git a/connectiondata.cpp b/connectiondata.cpp index c03bbcc..4f27a45 100644 --- a/connectiondata.cpp +++ b/connectiondata.cpp @@ -1,3 +1,11 @@ #include "connectiondata.h" ConnectionData::ConnectionData() : port(0) {} + +bool ConnectionData::isOk() +{ + return (not address.isEmpty() and + port != 0 and + not displayName.isEmpty() and + not channels.isEmpty()); +} diff --git a/connectiondata.h b/connectiondata.h index ee3f458..4775b53 100644 --- a/connectiondata.h +++ b/connectiondata.h @@ -8,6 +8,7 @@ struct ConnectionData { ConnectionData(); + bool isOk(); QString address; quint16 port; diff --git a/ircclient.cpp b/ircclient.cpp index 25747fd..c0355c0 100644 --- a/ircclient.cpp +++ b/ircclient.cpp @@ -28,6 +28,7 @@ IrcClient::IrcClient(const ConnectionData& config, QObject *parent) : dir.mkdir(path); } dir.cd(path); + m_connectionData.channels.removeAll(""); for (auto chan: m_connectionData.channels) { chan.remove('#'); dir.mkdir(chan); diff --git a/main.cpp b/main.cpp index 06223aa..fcf7f5b 100644 --- a/main.cpp +++ b/main.cpp @@ -68,6 +68,7 @@ int main(int argc, char *argv[]) auto serversData = configuration.getConnections(); for (auto server: serversData) { + if (not server.isOk()) continue; IrcClientStarter* wrapper = new IrcClientStarter(server, &webInterface); QThread* thread = new QThread; wrapper->moveToThread(thread);