+
+
+CoreIrcChannel::~CoreIrcChannel()
+{
+#ifdef HAVE_QCA2
+ delete _cipher;
+#endif
+}
+
+
+#ifdef HAVE_QCA2
+Cipher *CoreIrcChannel::cipher() const
+{
+ if (!_cipher)
+ _cipher = new Cipher();
+
+ return _cipher;
+}
+
+
+void CoreIrcChannel::setEncrypted(bool e)
+{
+ IrcChannel::setEncrypted(e);
+
+ if (!Cipher::neededFeaturesAvailable())
+ return;
+
+ if (e) {
+ if (topic().isEmpty())
+ return;
+
+ QByteArray decrypted = cipher()->decryptTopic(topic().toAscii());
+ setTopic(decodeString(decrypted));
+ }
+}
+
+
+#endif