QXmppPasswordReply *QXmppPasswordChecker::checkPassword(const QXmppPasswordRequest &request) { QXmppPasswordReply *reply = new QXmppPasswordReply; QString secret; QXmppPasswordReply::Error error = getPassword(request, secret); if (error == QXmppPasswordReply::NoError) { if (request.password() != secret) reply->setError(QXmppPasswordReply::AuthorizationError); } else { reply->setError(error); } // reply is finished reply->finishLater(); return reply; }
QXmppPasswordReply *QXmppPasswordChecker::getDigest(const QXmppPasswordRequest &request) { QXmppPasswordReply *reply = new QXmppPasswordReply; QString secret; QXmppPasswordReply::Error error = getPassword(request, secret); if (error == QXmppPasswordReply::NoError) { reply->setDigest(QCryptographicHash::hash( (request.username() + ":" + request.domain() + ":" + secret).toUtf8(), QCryptographicHash::Md5)); } else { reply->setError(error); } // reply is finished reply->finishLater(); return reply; }