From: Manuel Nickschas Date: Sat, 11 Apr 2009 19:27:50 +0000 (+0200) Subject: Properly handle channel keys in the ircconnection wizard X-Git-Tag: 0.4.2~19 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=f3834efcf968a7f38c77ec34876ef011a46f944c Properly handle channel keys in the ircconnection wizard --- diff --git a/src/core/coresession.cpp b/src/core/coresession.cpp index b5ae06c8..0fbfed4d 100644 --- a/src/core/coresession.cpp +++ b/src/core/coresession.cpp @@ -320,6 +320,20 @@ void CoreSession::createNetwork(const NetworkInfo &info_, const QStringList &per id = info.networkId.toInt(); if(!_networks.contains(id)) { + + // create persistent chans + QRegExp rx("\\s*(\\S+)(?:\\s*(\\S+))?\\s*"); + foreach(QString channel, persistentChans) { + if(!rx.exactMatch(channel)) { + qWarning() << QString("Invalid persistent channel declaration: %1").arg(channel); + continue; + } + Core::bufferInfo(user(), info.networkId, BufferInfo::ChannelBuffer, rx.cap(1), true); + Core::setChannelPersistent(user(), info.networkId, rx.cap(1), true); + if(!rx.cap(2).isEmpty()) + Core::setPersistentChannelKey(user(), info.networkId, rx.cap(1), rx.cap(2)); + } + CoreNetwork *net = new CoreNetwork(id, this); connect(net, SIGNAL(displayMsg(Message::Type, BufferInfo::Type, QString, QString, QString, Message::Flags)), this, SLOT(recvMessageFromServer(Message::Type, BufferInfo::Type, QString, QString, QString, Message::Flags))); @@ -330,11 +344,6 @@ void CoreSession::createNetwork(const NetworkInfo &info_, const QStringList &per _networks[id] = net; signalProxy()->synchronize(net); emit networkCreated(id); - // create persistent chans - foreach(QString channel, persistentChans) { - Core::bufferInfo(user(), info.networkId, BufferInfo::ChannelBuffer, channel, true); - Core::setChannelPersistent(user(), info.networkId, channel, true); - } } else { qWarning() << qPrintable(tr("CoreSession::createNetwork(): Trying to create a network that already exists, updating instead!")); _networks[info.networkId]->requestSetNetworkInfo(info);