mirror of https://notabug.org/acetone/ircabot.git
parent
dbc3cda1d5
commit
74b6910084
|
@ -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;
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
struct ConnectionData
|
||||
{
|
||||
ConnectionData();
|
||||
bool isOk();
|
||||
|
||||
QString address;
|
||||
quint16 port;
|
||||
|
|
|
@ -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);
|
||||
|
|
1
main.cpp
1
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);
|
||||
|
|
Loading…
Reference in New Issue