X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcore%2Fcoresession.cpp;h=c81ac894d85e04b4098fbc0d386075bb2bef8835;hb=35c39237136ab3ddc94d20d8280b7bf6680f07c2;hp=df9061d3ee0c8c90babe192f47f16d2bdeba1a75;hpb=20f446a492d8e681156423f0dc3637db78c45bae;p=quassel.git diff --git a/src/core/coresession.cpp b/src/core/coresession.cpp index df9061d3..c81ac894 100644 --- a/src/core/coresession.cpp +++ b/src/core/coresession.cpp @@ -31,6 +31,7 @@ #include "coreeventmanager.h" #include "coreidentity.h" #include "coreignorelistmanager.h" +#include "coreinfo.h" #include "coreirclisthelper.h" #include "corenetwork.h" #include "corenetworkconfig.h" @@ -43,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" @@ -57,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)), @@ -68,7 +70,7 @@ CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent) _dccConfig(new CoreDccConfig(this)), _ircListHelper(new CoreIrcListHelper(this)), _networkConfig(new CoreNetworkConfig("GlobalNetworkConfig", this)), - _coreInfo(this), + _coreInfo(new CoreInfo(this)), _transferManager(new CoreTransferManager(this)), _eventManager(new CoreEventManager(this)), _eventStringifier(new EventStringifier(this)), @@ -109,6 +111,13 @@ CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent) p->attachSlot(SIGNAL(kickClient(int)), this, SLOT(kickClient(int))); p->attachSignal(this, SIGNAL(disconnectFromCore())); + QVariantMap data; + data["quasselVersion"] = Quassel::buildInfo().fancyVersionString; + data["quasselBuildDate"] = Quassel::buildInfo().commitDate; // "BuildDate" for compatibility + data["startTime"] = Core::instance()->startTime(); + data["sessionConnectedClients"] = 0; + _coreInfo->setCoreData(data); + loadSettings(); initScriptEngine(); @@ -122,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()); @@ -130,9 +139,12 @@ CoreSession::CoreSession(UserId uid, bool restoreState, QObject *parent) p->synchronize(dccConfig()); p->synchronize(ircListHelper()); p->synchronize(networkConfig()); - p->synchronize(&_coreInfo); + 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) @@ -262,8 +274,13 @@ void CoreSession::restoreSessionState() void CoreSession::addClient(RemotePeer *peer) { + signalProxy()->setTargetPeer(peer); + peer->dispatch(sessionState()); signalProxy()->addPeer(peer); + _coreInfo->setConnectedClientData(signalProxy()->peerCount(), signalProxy()->peerData()); + + signalProxy()->setTargetPeer(nullptr); } @@ -279,6 +296,7 @@ void CoreSession::removeClient(Peer *peer) RemotePeer *p = qobject_cast(peer); if (p) quInfo() << qPrintable(tr("Client")) << p->description() << qPrintable(tr("disconnected (UserId: %1).").arg(user().toInt())); + _coreInfo->setConnectedClientData(signalProxy()->peerCount(), signalProxy()->peerData()); } @@ -330,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; @@ -549,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)