#include <utility>
-#include <QtScript>
-
#include "core.h"
#include "corebacklogmanager.h"
#include "corebuffersyncer.h"
, _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);
_coreInfo->setCoreData(data);
loadSettings();
- initScriptEngine();
eventManager()->registerObject(ircParser(), EventManager::NormalPriority);
eventManager()->registerObject(sessionEventProcessor(), EventManager::HighPriority); // needs to process events *before* the stringifier!
restoreSessionState();
emit initialized();
+
+ if (_metricsServer) {
+ _metricsServer->addSession(user(), Core::instance()->strictSysIdent(_user));
+ }
}
void CoreSession::shutdown()
// Nothing to do, suicide so the core can shut down
deleteLater();
}
+
+ if (_metricsServer) {
+ _metricsServer->removeSession(user());
+ }
}
void CoreSession::onNetworkDisconnected(NetworkId networkId)
_coreInfo->setConnectedClientData(signalProxy()->peerCount(), signalProxy()->peerData());
signalProxy()->setTargetPeer(nullptr);
+
+ if (_metricsServer) {
+ _metricsServer->addClient(user());
+ }
}
void CoreSession::addClient(InternalPeer* 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<QString, QString> CoreSession::persistentChannels(NetworkId id) 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)
{