X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcoresession.cpp;h=33f5b09dde7c8527aad6e3dff091c3b65462aa2b;hp=be1e6ef30720f2bee75515fcc334b95d133106f3;hb=39eb2fda3eaef2de78a8134556015ff86e9b85d4;hpb=f6781dc095957d65e8fc1683fda1c5a5b9cbedbb diff --git a/src/core/coresession.cpp b/src/core/coresession.cpp index be1e6ef3..33f5b09d 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; @@ -326,7 +337,7 @@ void CoreSession::createIdentity(const CoreIdentity &identity) { _identities[identity.id()] = coreIdentity; // CoreIdentity has it's own synchronize method since it's "private" sslManager needs to be synced aswell coreIdentity->synchronize(signalProxy()); - connect(coreIdentity, SIGNAL(updated(const QVariantMap &)), this, SLOT(updateIdentityBySender())); + connect(coreIdentity, SIGNAL(updated()), this, SLOT(updateIdentityBySender())); emit identityCreated(*coreIdentity); } @@ -362,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);