Do not allow keyx to be used on channels.
authorBas Pape <baspape@gmail.com>
Sun, 25 Aug 2013 16:41:33 +0000 (18:41 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Thu, 10 Oct 2013 18:08:18 +0000 (20:08 +0200)
Given that incoming exchanges are ignored for channels, it makes no
sense to send them either.

src/core/coreuserinputhandler.cpp

index 24d5f8b..12c13cd 100644 (file)
@@ -368,12 +368,17 @@ void CoreUserInputHandler::handleKeyx(const BufferInfo &bufferInfo, const QStrin
         parms.prepend(bufferInfo.bufferName());
     else if (parms.count() != 1) {
         emit displayMsg(Message::Info, bufname,
         parms.prepend(bufferInfo.bufferName());
     else if (parms.count() != 1) {
         emit displayMsg(Message::Info, bufname,
-            tr("[usage] /keyx [<nick|channel>] Initiates a DH1080 key exchange with the target."));
+            tr("[usage] /keyx [<nick>] Initiates a DH1080 key exchange with the target."));
         return;
     }
 
     QString target = parms.at(0);
 
         return;
     }
 
     QString target = parms.at(0);
 
+    if (network()->isChannelName(target)) {
+        emit displayMsg(Message::Info, 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;
     Cipher *cipher = network()->cipher(target);
     if (!cipher) // happens when there is no CoreIrcChannel for the target
         return;