X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fircparser.cpp;h=88c6b3cb2340a9d9589262ab225049f43033ec09;hp=f558f5f245fbecd7db4f03512904e555995fdd98;hb=6df87033d69892ce1a12c5242b8d217087d6ddc8;hpb=694f9bfbf7f1af19108461c7e00d133e55082bce diff --git a/src/core/ircparser.cpp b/src/core/ircparser.cpp index f558f5f2..88c6b3cb 100644 --- a/src/core/ircparser.cpp +++ b/src/core/ircparser.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #include "ircparser.h" @@ -28,6 +28,7 @@ #ifdef HAVE_QCA2 # include "cipher.h" +# include "keyevent.h" #endif IrcParser::IrcParser(CoreSession *session) : @@ -58,7 +59,7 @@ QByteArray IrcParser::decrypt(Network *network, const QString &bufferName, const return message; Cipher *cipher = qobject_cast(network)->cipher(bufferName); - if (!cipher) + if (!cipher || cipher->key().isEmpty()) return message; return isTopic ? cipher->decryptTopic(message) : cipher->decrypt(message); @@ -228,7 +229,16 @@ void IrcParser::processNetworkIncoming(NetworkDataEvent *e) if (!net->isChannelName(target)) target = nickFromMask(prefix); } - events << new IrcEventRawMessage(EventManager::IrcEventRawNotice, net, params[1], prefix, target, e->timestamp()); + +#ifdef HAVE_QCA2 + // Handle DH1080 key exchange + if (params[1].startsWith("DH1080_INIT") && !net->isChannelName(target)) { + events << new KeyEvent(EventManager::KeyEvent, net, prefix, target, KeyEvent::Init, params[1].mid(12)); + } else if (params[1].startsWith("DH1080_FINISH") && !net->isChannelName(target)) { + events << new KeyEvent(EventManager::KeyEvent, net, prefix, target, KeyEvent::Finish, params[1].mid(14)); + } else +#endif + events << new IrcEventRawMessage(EventManager::IrcEventRawNotice, net, params[1], prefix, target, e->timestamp()); } } break; @@ -298,6 +308,11 @@ void IrcParser::processNetworkIncoming(NetworkDataEvent *e) for (int i = decParams.count(); i < params.count(); i++) decParams << net->serverDecode(params.at(i)); + // We want to trim the last param just in case, except for PRIVMSG and NOTICE + // ... but those happen to be the only ones not using defaultHandling anyway + if (!decParams.isEmpty() && decParams.last().endsWith(' ')) + decParams.append(decParams.takeLast().trimmed()); + IrcEvent *event; if (type == EventManager::IrcEventNumeric) event = new IrcEventNumeric(num, net, prefix, target);