X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcore%2Fcoresession.cpp;h=c81ac894d85e04b4098fbc0d386075bb2bef8835;hb=aca209ca4d94994875a28f2cc98d68ce0cbbf1bd;hp=afaf48de118df040cb0ac34daf5e2dd4fa56f7f4;hpb=bd5414d8bfe2be18ba051d4bbf936e9ead0cdf66;p=quassel.git diff --git a/src/core/coresession.cpp b/src/core/coresession.cpp index afaf48de..c81ac894 100644 --- a/src/core/coresession.cpp +++ b/src/core/coresession.cpp @@ -44,7 +44,7 @@ #include "ircchannel.h" #include "ircparser.h" #include "ircuser.h" -#include "logger.h" +#include "logmessage.h" #include "messageevent.h" #include "remotepeer.h" #include "storage.h" @@ -58,9 +58,10 @@ public: }; -CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent) +CoreSession::CoreSession(UserId uid, bool restoreState, bool strictIdentEnabled, QObject *parent) : QObject(parent), _user(uid), + _strictIdentEnabled(strictIdentEnabled), _signalProxy(new SignalProxy(SignalProxy::Server, this)), _aliasManager(this), _bufferSyncer(new CoreBufferSyncer(this)), @@ -130,7 +131,7 @@ CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent) eventManager()->registerObject(ctcpParser(), EventManager::LowPriority, "send"); // periodically save our session state - connect(&(Core::instance()->syncTimer()), SIGNAL(timeout()), this, SLOT(saveSessionState())); + connect(Core::instance()->syncTimer(), SIGNAL(timeout()), this, SLOT(saveSessionState())); p->synchronize(_bufferSyncer); p->synchronize(&aliasManager()); @@ -141,6 +142,9 @@ CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent) p->synchronize(_coreInfo); p->synchronize(&_ignoreListManager); p->synchronize(&_highlightRuleManager); + // Listen to network removed events + connect(this, SIGNAL(networkRemoved(NetworkId)), + &_highlightRuleManager, SLOT(networkRemoved(NetworkId))); p->synchronize(transferManager()); // Restore session state if (restoreState) @@ -344,7 +348,8 @@ void CoreSession::recvMessageFromServer(NetworkId networkId, Message::Type type, if (_ignoreListManager.match(rawMsg, networkName) == IgnoreListManager::HardStrictness) return; - if (_highlightRuleManager.match(rawMsg, currentNetwork->myNick(), currentNetwork->identityPtr()->nicks())) + + if (currentNetwork && _highlightRuleManager.match(rawMsg, currentNetwork->myNick(), currentNetwork->identityPtr()->nicks())) rawMsg.flags |= Message::Flag::Highlight; _messageQueue << rawMsg; @@ -563,8 +568,14 @@ void CoreSession::createIdentity(const Identity &identity, const QVariantMap &ad createIdentity(coreIdentity); } -const QString CoreSession::strictSysident() { - return Core::instance()->strictSysIdent(_user); +const QString CoreSession::strictCompliantIdent(const CoreIdentity *identity) { + if (_strictIdentEnabled) { + // Strict mode enabled: only allow the user's Quassel username as an ident + return Core::instance()->strictSysIdent(_user); + } else { + // Strict mode disabled: allow any identity specified + return identity->ident(); + } } void CoreSession::createIdentity(const CoreIdentity &identity)