+
+/*** Network Handling ***/
+
+void CoreSession::createNetwork(const NetworkInfo &info_, const QStringList &persistentChans) {
+ NetworkInfo info = info_;
+ int id;
+
+ if(!info.networkId.isValid())
+ Core::createNetwork(user(), info);
+
+ if(!info.networkId.isValid()) {
+ qWarning() << qPrintable(tr("CoreSession::createNetwork(): Got invalid networkId from Core when trying to create network %1!").arg(info.networkName));
+ return;
+ }
+
+ id = info.networkId.toInt();
+ if(!_networks.contains(id)) {
+ CoreNetwork *net = new CoreNetwork(id, this);
+ connect(net, SIGNAL(displayMsg(NetworkId, Message::Type, BufferInfo::Type, const QString &, const QString &, const QString &, Message::Flags)),
+ this, SLOT(recvMessageFromServer(NetworkId, Message::Type, BufferInfo::Type, const QString &, const QString &, const QString &, Message::Flags)));
+ connect(net, SIGNAL(displayStatusMsg(QString)), this, SLOT(recvStatusMsgFromServer(QString)));
+
+ net->setNetworkInfo(info);
+ net->setProxy(signalProxy());
+ _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);