Only show warning about QCA on user input.
authorBas Pape <baspape@gmail.com>
Tue, 14 May 2013 22:16:01 +0000 (00:16 +0200)
committerBas Pape <baspape@gmail.com>
Thu, 16 May 2013 18:05:22 +0000 (20:05 +0200)
When compiled with QCA support, merely trying to decrypt messages
should not warn about missing qca-ossl; this message should only be
shown on user input (such as the key-related commands) and incoming
messages really requiring qca-ossl to function (key exchange).

src/core/cipher.cpp
src/core/coresessioneventprocessor.cpp
src/core/coreuserinputhandler.cpp

index 15a986b..9ea9c13 100644 (file)
@@ -473,6 +473,5 @@ bool Cipher::neededFeaturesAvailable()
     if (QCA::isSupported("blowfish-ecb") && QCA::isSupported("blowfish-cbc") && QCA::isSupported("dh"))
         return true;
 
-    qWarning() << "QCA provider plugin not found. It is usually provided by the qca-ossl plugin.";
     return false;
 }
index bcea825..80ea7d8 100644 (file)
@@ -444,7 +444,7 @@ void CoreSessionEventProcessor::processIrcEventTopic(IrcEvent *e)
 void CoreSessionEventProcessor::processKeyEvent(KeyEvent *e)
 {
     if (!Cipher::neededFeaturesAvailable()) {
-        emit newEvent(new MessageEvent(Message::Error, e->network(), tr("Unable to perform key exchange."), e->prefix(), e->target(), Message::None, e->timestamp()));
+        emit newEvent(new MessageEvent(Message::Error, e->network(), tr("Unable to perform key exchange, missing qca-ossl plugin."), e->prefix(), e->target(), Message::None, e->timestamp()));
         return;
     }
     CoreNetwork *net = qobject_cast<CoreNetwork*>(e->network());
index cac1ff2..87c497d 100644 (file)
@@ -186,8 +186,10 @@ void CoreUserInputHandler::handleDelkey(const BufferInfo &bufferInfo, const QStr
     if (!bufferInfo.isValid())
         return;
 
-    if (!Cipher::neededFeaturesAvailable())
+    if (!Cipher::neededFeaturesAvailable()) {
+        emit displayMsg(Message::Error, bufname, tr("Error: QCA provider plugin not found. It is usually provided by the qca-ossl plugin."));
         return;
+    }
 
     QStringList parms = msg.split(' ', QString::SkipEmptyParts);
 
@@ -225,7 +227,7 @@ void CoreUserInputHandler::doMode(const BufferInfo &bufferInfo, const QChar& add
     bool isNumber;
     int maxModes = network()->support("MODES").toInt(&isNumber);
     if (!isNumber || maxModes == 0) maxModes = 1;
-    
+
     QStringList nickList;
     if (nicks == "*") { // All users in channel
         const QList<IrcUser*> users = network()->ircChannel(bufferInfo.bufferName())->ircUsers();
@@ -234,12 +236,12 @@ void CoreUserInputHandler::doMode(const BufferInfo &bufferInfo, const QChar& add
                 || (addOrRemove == '-' && network()->ircChannel(bufferInfo.bufferName())->userModes(user).contains(mode)))
                 nickList.append(user->nick());
         }
-    } else { 
+    } else {
         nickList = nicks.split(' ', QString::SkipEmptyParts);
     }
-    
+
     if (nickList.count() == 0) return;
-    
+
     while (!nickList.isEmpty()) {
         int amount = qMin(nickList.count(), maxModes);
         QString m = addOrRemove; for(int i = 0; i < amount; i++) m += mode;
@@ -355,8 +357,10 @@ void CoreUserInputHandler::handleKeyx(const BufferInfo &bufferInfo, const QStrin
     if (!bufferInfo.isValid())
         return;
 
-    if (!Cipher::neededFeaturesAvailable())
+    if (!Cipher::neededFeaturesAvailable()) {
+        emit displayMsg(Message::Error, bufname, tr("Error: QCA provider plugin not found. It is usually provided by the qca-ossl plugin."));
         return;
+    }
 
     QStringList parms = msg.split(' ', QString::SkipEmptyParts);
 
@@ -592,8 +596,10 @@ void CoreUserInputHandler::handleSetkey(const BufferInfo &bufferInfo, const QStr
     if (!bufferInfo.isValid())
         return;
 
-    if (!Cipher::neededFeaturesAvailable())
+    if (!Cipher::neededFeaturesAvailable()) {
+        emit displayMsg(Message::Error, bufname, tr("Error: QCA provider plugin not found. It is usually provided by the qca-ossl plugin."));
         return;
+    }
 
     QStringList parms = msg.split(' ', QString::SkipEmptyParts);
 
@@ -628,8 +634,10 @@ void CoreUserInputHandler::handleShowkey(const BufferInfo &bufferInfo, const QSt
     if (!bufferInfo.isValid())
         return;
 
-    if (!Cipher::neededFeaturesAvailable())
+    if (!Cipher::neededFeaturesAvailable()) {
+        emit displayMsg(Message::Error, bufname, tr("Error: QCA provider plugin not found. It is usually provided by the qca-ossl plugin."));
         return;
+    }
 
     QStringList parms = msg.split(' ', QString::SkipEmptyParts);