X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcorenetwork.cpp;h=23125bbc9ea6b27bc58082515094c05a1a2a9019;hp=94854990ee05492669636b9153247d2e06bc9fbe;hb=160492494676f09b7836badc165727a538f03ece;hpb=ddeaf866099f56f42bf86b2bfc72a92763c733aa diff --git a/src/core/corenetwork.cpp b/src/core/corenetwork.cpp index 94854990..23125bbc 100644 --- a/src/core/corenetwork.cpp +++ b/src/core/corenetwork.cpp @@ -77,6 +77,12 @@ CoreNetwork::CoreNetwork(const NetworkId &networkid, CoreSession *session) connect(&socket, SIGNAL(encrypted()), this, SLOT(socketInitialized())); connect(&socket, SIGNAL(sslErrors(const QList &)), this, SLOT(sslErrors(const QList &))); #endif + connect(this, SIGNAL(newEvent(Event *)), coreSession()->eventManager(), SLOT(postEvent(Event *))); + + if(Quassel::isOptionSet("oidentd")) { + connect(this, SIGNAL(socketInitialized(const CoreIdentity*,QHostAddress,quint16,QHostAddress,quint16)), Core::instance()->oidentdConfigGenerator(), SLOT(addSocket(const CoreIdentity*,QHostAddress,quint16,QHostAddress,quint16))); + connect(this, SIGNAL(socketDisconnected(const CoreIdentity*,QHostAddress,quint16,QHostAddress,quint16)), Core::instance()->oidentdConfigGenerator(), SLOT(removeSocket(const CoreIdentity*,QHostAddress,quint16,QHostAddress,quint16))); + } } CoreNetwork::~CoreNetwork() { @@ -275,6 +281,9 @@ Cipher *CoreNetwork::cipher(const QString &target) const { if(target.isEmpty()) return 0; + if(!Cipher::neededFeaturesAvailable()) + return 0; + QByteArray key = cipherKey(target); if(key.isEmpty()) return 0; @@ -327,7 +336,7 @@ void CoreNetwork::socketHasData() { #else event->setTimestamp(QDateTime::currentDateTime().toUTC()); #endif - coreSession()->eventManager()->sendEvent(event); + emit newEvent(event); } } @@ -359,6 +368,8 @@ void CoreNetwork::socketInitialized() { return; } + emit socketInitialized(identity, localAddress(), localPort(), peerAddress(), peerPort()); + // TokenBucket to avoid sending too much at once _messageDelay = 2200; // this seems to be a safe value (2.2 seconds delay) _burstSize = 5; @@ -403,6 +414,7 @@ void CoreNetwork::socketDisconnected() { setConnected(false); emit disconnected(networkId()); + emit socketDisconnected(identityPtr(), localAddress(), localPort(), peerAddress(), peerPort()); if(_quitRequested) { _quitRequested = false; setConnectionState(Network::Disconnected);