+ if (network()->isChannelName(target)) {
+ emit displayMsg(NetworkInternalMessage(
+ Message::Info,
+ typeByTarget(bufname),
+ bufname,
+ tr("It is only possible to exchange keys in a query buffer.")
+ ));
+ return;
+ }
+
+ Cipher* cipher = network()->cipher(target);
+ if (!cipher) // happens when there is no CoreIrcChannel for the target
+ return;
+
+ QByteArray pubKey = cipher->initKeyExchange();
+ if (pubKey.isEmpty())
+ emit displayMsg(NetworkInternalMessage(
+ Message::Error,
+ typeByTarget(bufname),
+ bufname,
+ tr("Failed to initiate key exchange with %1.").arg(target)
+ ));
+ else {
+ QList<QByteArray> params;
+ params << serverEncode(target) << serverEncode("DH1080_INIT ") + pubKey;
+ emit putCmd("NOTICE", params);
+ emit displayMsg(NetworkInternalMessage(
+ Message::Info,
+ typeByTarget(bufname),
+ bufname,
+ tr("Initiated key exchange with %1.").arg(target)
+ ));
+ }
+#else
+ Q_UNUSED(msg)
+ emit displayMsg(NetworkInternalMessage(
+ Message::Error,
+ typeByTarget(bufname),
+ bufname,
+ tr("Error: Setting an encryption key requires Quassel to have been built "
+ "with support for the Qt Cryptographic Architecture (QCA) library. "
+ "Contact your distributor about a Quassel package with QCA "
+ "support, or rebuild Quassel with QCA present.")
+ ));
+#endif
+}
+
+void CoreUserInputHandler::handleKick(const BufferInfo& bufferInfo, const QString& msg)
+{
+ QString nick = msg.section(' ', 0, 0, QString::SectionSkipEmpty);
+ QString reason = msg.section(' ', 1, -1, QString::SectionSkipEmpty).trimmed();
+ if (reason.isEmpty())
+ reason = network()->identityPtr()->kickReason();
+
+ QList<QByteArray> params;
+ params << serverEncode(bufferInfo.bufferName()) << serverEncode(nick) << channelEncode(bufferInfo.bufferName(), reason);
+ emit putCmd("KICK", params);