X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcore%2Fcoresession.cpp;h=961fcafefd6a8ae4722b5aa3069361436848cbec;hb=42d328e94a3bed8e6b0a32e7a234281e6d184325;hp=119d73d732e9ba060ee3d4fbcc8bb983151b7944;hpb=e38846f054ad1766f2e91992a57bbaffd33c7c06;p=quassel.git diff --git a/src/core/coresession.cpp b/src/core/coresession.cpp index 119d73d7..961fcafe 100644 --- a/src/core/coresession.cpp +++ b/src/core/coresession.cpp @@ -22,8 +22,6 @@ #include -#include - #include "core.h" #include "corebacklogmanager.h" #include "corebuffersyncer.h" @@ -78,10 +76,10 @@ CoreSession::CoreSession(UserId uid, bool restoreState, bool strictIdentEnabled, , _sessionEventProcessor(new CoreSessionEventProcessor(this)) , _ctcpParser(new CtcpParser(this)) , _ircParser(new IrcParser(this)) - , scriptEngine(new QScriptEngine(this)) , _processMessages(false) , _ignoreListManager(this) , _highlightRuleManager(this) + , _metricsServer(Core::instance()->metricsServer()) { SignalProxy* p = signalProxy(); p->setHeartBeatInterval(30); @@ -120,7 +118,6 @@ CoreSession::CoreSession(UserId uid, bool restoreState, bool strictIdentEnabled, _coreInfo->setCoreData(data); loadSettings(); - initScriptEngine(); eventManager()->registerObject(ircParser(), EventManager::NormalPriority); eventManager()->registerObject(sessionEventProcessor(), EventManager::HighPriority); // needs to process events *before* the stringifier! @@ -151,6 +148,10 @@ CoreSession::CoreSession(UserId uid, bool restoreState, bool strictIdentEnabled, restoreSessionState(); emit initialized(); + + if (_metricsServer) { + _metricsServer->addSession(user(), Core::instance()->strictSysIdent(_user)); + } } void CoreSession::shutdown() @@ -171,6 +172,10 @@ void CoreSession::shutdown() // Nothing to do, suicide so the core can shut down deleteLater(); } + + if (_metricsServer) { + _metricsServer->removeSession(user()); + } } void CoreSession::onNetworkDisconnected(NetworkId networkId) @@ -257,6 +262,10 @@ void CoreSession::addClient(RemotePeer* peer) _coreInfo->setConnectedClientData(signalProxy()->peerCount(), signalProxy()->peerData()); signalProxy()->setTargetPeer(nullptr); + + if (_metricsServer) { + _metricsServer->addClient(user()); + } } void CoreSession::addClient(InternalPeer* peer) @@ -271,6 +280,10 @@ void CoreSession::removeClient(Peer* peer) if (p) qInfo() << qPrintable(tr("Client")) << p->description() << qPrintable(tr("disconnected (UserId: %1).").arg(user().toInt())); _coreInfo->setConnectedClientData(signalProxy()->peerCount(), signalProxy()->peerData()); + + if (_metricsServer) { + _metricsServer->removeClient(user()); + } } QHash CoreSession::persistentChannels(NetworkId id) const @@ -515,21 +528,6 @@ Protocol::SessionState CoreSession::sessionState() const return Protocol::SessionState(identities, bufferInfos, networkIds); } -void CoreSession::initScriptEngine() -{ - signalProxy()->attachSlot(SIGNAL(scriptRequest(QString)), this, &CoreSession::scriptRequest); - signalProxy()->attachSignal(this, &CoreSession::scriptResult); - - // FIXME - // QScriptValue storage_ = scriptEngine->newQObject(storage); - // scriptEngine->globalObject().setProperty("storage", storage_); -} - -void CoreSession::scriptRequest(QString script) -{ - emit scriptResult(scriptEngine->evaluate(script).toString()); -} - /*** Identity Handling ***/ void CoreSession::createIdentity(const Identity& identity, const QVariantMap& additional) {