empty channel fix

master 2.0.0
const an teen 2021-12-06 06:58:02 -05:00
parent dbc3cda1d5
commit 74b6910084
5 changed files with 12 additions and 1 deletions

View File

@ -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;

View File

@ -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());
}

View File

@ -8,6 +8,7 @@
struct ConnectionData
{
ConnectionData();
bool isOk();
QString address;
quint16 port;

View File

@ -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);

View File

@ -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);