+void IrcServerHandler::handleCap(const QString &prefix, const QList<QByteArray> ¶ms) {
+ // for SASL, there will only be a single param of 'sasl', however you can check here for
+ // additional CAP messages (ls, multi-prefix, et cetera).
+
+ Q_UNUSED(prefix);
+
+ if(params.size() == 3) {
+ QString param = serverDecode(params[2]);
+ if(param == QString("sasl")) { // SASL Ready
+ network()->putRawLine(serverEncode("AUTHENTICATE PLAIN")); // Only working with PLAIN atm, blowfish later
+ }
+ }
+}
+
+void IrcServerHandler::handleAuthenticate() {
+ QString construct = network()->saslAccount();
+ construct.append(QChar(QChar::Null));
+ construct.append(network()->saslAccount());
+ construct.append(QChar(QChar::Null));
+ construct.append(network()->saslPassword());
+ QByteArray saslData = QByteArray(construct.toAscii().toBase64());
+ saslData.prepend(QString("AUTHENTICATE ").toAscii());
+ network()->putRawLine(saslData);
+}
+