X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcoresession.cpp;h=0c62171845e6b57dc3697e1cbccea8e01fa650f2;hp=32429a3a7ed942891dc78c9d98ae22d172377e96;hb=6245a8d29e893eaff25a12b0be2f47b64f0f7bcd;hpb=91113c1a557409765625c41b05432af6d0f7e9d3 diff --git a/src/core/coresession.cpp b/src/core/coresession.cpp index 32429a3a..0c621718 100644 --- a/src/core/coresession.cpp +++ b/src/core/coresession.cpp @@ -28,6 +28,7 @@ #include "corebacklogmanager.h" #include "corebufferviewmanager.h" #include "coreirclisthelper.h" +#include "corenetworkconfig.h" #include "storage.h" #include "coreidentity.h" @@ -53,6 +54,7 @@ CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent) _backlogManager(new CoreBacklogManager(this)), _bufferViewManager(new CoreBufferViewManager(_signalProxy, this)), _ircListHelper(new CoreIrcListHelper(this)), + _networkConfig(new CoreNetworkConfig("GlobalNetworkConfig", this)), _coreInfo(this), scriptEngine(new QScriptEngine(this)), _processMessages(false) @@ -87,6 +89,7 @@ CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent) p->synchronize(&aliasManager()); p->synchronize(_backlogManager); p->synchronize(ircListHelper()); + p->synchronize(networkConfig()); p->synchronize(&_coreInfo); // Restore session state @@ -148,6 +151,7 @@ void CoreSession::loadSettings() { void CoreSession::saveSessionState() const { _bufferSyncer->storeDirtyIds(); _bufferViewManager->saveBufferViews(); + _networkConfig->save(); } void CoreSession::restoreSessionState() { @@ -203,7 +207,14 @@ void CoreSession::msgFromClient(BufferInfo bufinfo, QString msg) { // ALL messages coming pass through these functions before going to the GUI. // So this is the perfect place for storing the backlog and log stuff. void CoreSession::recvMessageFromServer(NetworkId networkId, Message::Type type, BufferInfo::Type bufferType, - const QString &target, const QString &text, const QString &sender, Message::Flags flags) { + const QString &target, const QString &text_, const QString &sender, Message::Flags flags) { + + // U+FDD0 and U+FDD1 are special characters for Qt's text engine, specifically they mark the boundaries of + // text frames in a QTextDocument. This might lead to problems in widgets displaying QTextDocuments (such as + // KDE's notifications), hence we remove those just to be safe. + QString text = text_; + text.remove(QChar(0xfdd0)).remove(QChar(0xfdd1)); + _messageQueue << RawMessage(networkId, type, bufferType, target, text, sender, flags); if(!_processMessages) { _processMessages = true; @@ -230,7 +241,6 @@ void CoreSession::customEvent(QEvent *event) { } void CoreSession::processMessages() { - qDebug() << "processing" << _messageQueue.count() << "messages.."; if(_messageQueue.count() == 1) { const RawMessage &rawMsg = _messageQueue.first(); BufferInfo bufferInfo = Core::bufferInfo(user(), rawMsg.networkId, rawMsg.bufferType, rawMsg.target); @@ -363,21 +373,30 @@ 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(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))); + SLOT(recvMessageFromServer(NetworkId, Message::Type, BufferInfo::Type, const QString &, const QString &, const QString &, Message::Flags))); + connect(net, SIGNAL(displayStatusMsg(QString)), 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);