From f79cda7eb406a577d13394d15551d1f444afc04e Mon Sep 17 00:00:00 2001 From: Szymon Tomasz Stefanek Date: Sun, 28 Dec 2014 22:53:34 +0000 Subject: Merge patch by TheReign * Adds support for DH1080_INIT_cbc keyx recognition and responds appropriately to it. * Note: keyx still won't work the other way around with _cbc clients as KVIrc defaults DH1080_INIT/DH1080_FINISH to CBC instead of ECB as the _cbc client expects. (Not a huge deal as long as said client initiates the keyx, it will be fine. at least they can keyx now) git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@6414 17fca916-40b9-46aa-a4ea-0a15b648b75c --- src/modules/fish/libkvifish.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'src/modules') diff --git a/src/modules/fish/libkvifish.cpp b/src/modules/fish/libkvifish.cpp index cf81340e8..67aa026ef 100644 --- a/src/modules/fish/libkvifish.cpp +++ b/src/modules/fish/libkvifish.cpp @@ -146,19 +146,32 @@ return false; } - if(szMessage.startsWith("DH1080_INIT ", Qt::CaseSensitive)) + if(szMessage.startsWith("DH1080_INIT ", Qt::CaseSensitive) || szMessage.startsWith("DH1080_INIT_cbc ", Qt::CaseSensitive)) { c->window()->output(KVI_OUT_SYSTEMMESSAGE,__tr2qs("FiSH: Received DH1080 public key from %1, sending mine...").arg(szNick)); // fish appends an 'A' to all base64 coded strings - szHisPubKey = szMessage.mid(12).toLatin1(); + if(szMessage.startsWith("DH1080_INIT_cbc ", Qt::CaseSensitive)) + szHisPubKey = szMessage.mid(16).toLatin1(); + else + szHisPubKey = szMessage.mid(12).toLatin1(); szHisPubKey.truncate(FISH_KEYLEN); szHisPubKey = QByteArray::fromBase64(szHisPubKey); szTmp = QByteArray((char *)szMyPubKey, iMyPubKeyLen).toBase64(); - c->window()->console()->connection()->sendFmtData("NOTICE %s :DH1080_FINISH %sA", - c->window()->console()->connection()->encodeText(szNick).data(), - szTmp.data() - ); + if(szMessage.startsWith("DH1080_INIT_cbc ", Qt::CaseSensitive)) + { + c->window()->console()->connection()->sendFmtData("NOTICE %s :DH1080_FINISH_cbc %sA", + c->window()->console()->connection()->encodeText(szNick).data(), + szTmp.data() + ); + } + else + { + c->window()->console()->connection()->sendFmtData("NOTICE %s :DH1080_FINISH %sA", + c->window()->console()->connection()->encodeText(szNick).data(), + szTmp.data() + ); + } } if(szMessage.startsWith("DH1080_FINISH ", Qt::CaseSensitive)) -- cgit v1.3.1-10-gc9f91