X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fircparser.cpp;h=8c1c84eaf57fad6daff569cf1dc7ef1f238771ed;hp=7811e05de38a80c07f643ed7b54a2cb3c97c9bef;hb=a72e2b4a90ce18c58b54e111161691ba008dc47d;hpb=a5ee21025ec613dc128ceb78a7e5fcd0f353275e diff --git a/src/core/ircparser.cpp b/src/core/ircparser.cpp index 7811e05d..8c1c84ea 100644 --- a/src/core/ircparser.cpp +++ b/src/core/ircparser.cpp @@ -34,7 +34,7 @@ IrcParser::IrcParser(CoreSession *session) : QObject(session), _coreSession(session) { - + connect(this, SIGNAL(newEvent(Event *)), coreSession()->eventManager(), SLOT(postEvent(Event *))); } bool IrcParser::checkParamCount(const QString &cmd, const QList ¶ms, int minParams) { @@ -50,6 +50,9 @@ QByteArray IrcParser::decrypt(Network *network, const QString &bufferName, const if(message.isEmpty()) return message; + if(!Cipher::neededFeaturesAvailable()) + return message; + Cipher *cipher = qobject_cast(network)->cipher(bufferName); if(!cipher) return message; @@ -133,16 +136,18 @@ void IrcParser::processNetworkIncoming(NetworkDataEvent *e) { QList events; EventManager::EventType type = EventManager::Invalid; - // numeric replies have the target as first param (RFC 2812 - 2.4). this is usually our own nick. Remove this! uint num = cmd.toUInt(); if(num > 0) { + // numeric reply if(params.count() == 0) { qWarning() << "Message received from server violates RFC and is ignored!" << msg; return; } + // numeric replies have the target as first param (RFC 2812 - 2.4). this is usually our own nick. Remove this! target = net->serverDecode(params.takeFirst()); type = EventManager::IrcEventNumeric; } else { + // any other irc command QString typeName = QLatin1String("IrcEvent") + cmd.at(0).toUpper() + cmd.mid(1).toLower(); type = eventManager()->eventTypeByName(typeName); if(type == EventManager::Invalid) { @@ -270,7 +275,7 @@ void IrcParser::processNetworkIncoming(NetworkDataEvent *e) { break; case 333: /* Topic set by... */ - if(params.count() >= 2) { + if(params.count() >= 3) { QString channel = net->serverDecode(params.at(0)); decParams << channel << net->serverDecode(params.at(1)); decParams << net->channelDecode(channel, params.at(2)); @@ -297,6 +302,6 @@ void IrcParser::processNetworkIncoming(NetworkDataEvent *e) { } foreach(Event *event, events) { - coreSession()->eventManager()->sendEvent(event); + emit newEvent(event); } }