void CoreUserInputHandler::putPrivmsg(const QString &target, const QString &message, std::function<QByteArray(const QString &, const QString &)> encodeFunc, Cipher *cipher)
{
    QString cmd("PRIVMSG");
    QByteArray targetEnc = serverEncode(target);

    std::function<QList<QByteArray>(QString &)> cmdGenerator = [&] (QString &splitMsg) -> QList<QByteArray> {
        QByteArray splitMsgEnc = encodeFunc(target, splitMsg);

#ifdef HAVE_QCA2
        if (cipher && !cipher->key().isEmpty() && !splitMsg.isEmpty()) {
            cipher->encrypt(splitMsgEnc);
        }
#endif
        return QList<QByteArray>() << targetEnc << splitMsgEnc;
    };

    putCmd(cmd, network()->splitMessage(cmd, message, cmdGenerator));
}
Weaknesses in this category are related to improper management of system resources.