void GoogleRecaptchaPlugin::getCaptcha(const QString &captchaKey) { QUrl url("http://www.google.com/recaptcha/api/challenge?k=" + captchaKey); QNetworkRequest request(url); QNetworkReply *reply = networkAccessManager()->get(request); connect(reply, SIGNAL(finished()), this, SLOT(onCaptchaDownloaded())); connect(this, SIGNAL(currentOperationCanceled()), reply, SLOT(deleteLater())); }
void SolveMediaRecaptchaPlugin::getCaptcha(const QString &captchaKey) { QUrl url("http://api.solvemedia.com/papi/_challenge.js?k=" + captchaKey); QNetworkRequest request(url); QNetworkReply *reply = networkAccessManager()->get(request); connect(reply, SIGNAL(finished()), this, SLOT(onCaptchaDownloaded())); connect(this, SIGNAL(currentOperationCanceled()), reply, SLOT(deleteLater())); }
void SolveMediaRecaptchaPlugin::downloadCaptchaImage(const QString &challenge) { m_challenge = challenge; QUrl url("http://api.solvemedia.com/papi/media?c=" + challenge); QNetworkRequest request(url); QNetworkReply *reply = networkAccessManager()->get(request); connect(reply, SIGNAL(finished()), this, SLOT(onCaptchaImageDownloaded())); connect(this, SIGNAL(currentOperationCanceled()), reply, SLOT(deleteLater())); }
void PublishToMePlugin::followRedirect(const QUrl &url, const char* slot) { m_redirects++; QNetworkRequest request(url); request.setRawHeader("Accept-Language", "en-GB,en-US;q=0.8,en;q=0.6"); QNetworkReply *reply = networkAccessManager()->get(request); connect(reply, SIGNAL(finished()), this, slot); connect(this, SIGNAL(currentOperationCanceled()), reply, SLOT(deleteLater())); }
void PublishToMePlugin::checkUrl(const QString &url, const QVariantMap &) { m_redirects = 0; QNetworkRequest request(QUrl::fromUserInput(url)); request.setRawHeader("Accept-Language", "en-GB,en-US;q=0.8,en;q=0.6"); QNetworkReply *reply = networkAccessManager()->get(request); connect(reply, SIGNAL(finished()), this, SLOT(checkUrlIsValid())); connect(this, SIGNAL(currentOperationCanceled()), reply, SLOT(deleteLater())); }
void PublishToMePlugin::login(const QString &username, const QString &password) { m_redirects = 0; const QString data = QString("LoginForm[username]=%1&LoginForm[password]=%2").arg(username).arg(password); QNetworkRequest request(LOGIN_URL); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); request.setRawHeader("X-Requested-With", "XMLHttpRequest"); QNetworkReply *reply = networkAccessManager()->post(request, data.toUtf8()); connect(reply, SIGNAL(finished()), this, SLOT(checkLogin())); connect(this, SIGNAL(currentOperationCanceled()), reply, SLOT(deleteLater())); }
void PublishToMePlugin::getDownloadLink() { m_redirects = 0; QNetworkRequest request(m_url); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); request.setRawHeader("Referer", m_url.toString().toUtf8()); request.setRawHeader("X-Requested-With", "XMLHttpRequest"); QNetworkReply *reply = networkAccessManager()->post(request, "free=1&uniqueId=" + m_fileId.toUtf8()); connect(reply, SIGNAL(finished()), this, SLOT(checkDownloadLink())); connect(this, SIGNAL(currentOperationCanceled()), reply, SLOT(deleteLater())); }
void PublishToMePlugin::submitCaptchaResponse(const QString &, const QString &response) { m_redirects = 0; const QString data = QString("CaptchaForm[code]=%1&free=1&freeDownloadRequest=1&uniqueId=%2").arg(response) .arg(m_fileId); QNetworkRequest request(m_url); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); request.setRawHeader("Referer", m_url.toString().toUtf8()); request.setRawHeader("X-Requested-With", "XMLHttpRequest"); QNetworkReply *reply = networkAccessManager()->post(request, data.toUtf8()); connect(reply, SIGNAL(finished()), this, SLOT(checkCaptcha())); connect(this, SIGNAL(currentOperationCanceled()), reply, SLOT(deleteLater())); }
void SolveMediaRecaptchaPlugin::getCaptcha(int captchaType, const QString &captchaKey, const QVariantMap &) { if (captchaType != CaptchaType::Image) { error(tr("Captcha type %1 not supported").arg(captchaType)); return; } QUrl url(CAPTCHA_CHALLENGE_URL + captchaKey); QNetworkRequest request(url); QNetworkReply *reply = networkAccessManager()->get(request); connect(reply, SIGNAL(finished()), this, SLOT(onCaptchaDownloaded())); connect(this, SIGNAL(currentOperationCanceled()), reply, SLOT(deleteLater())); }
bool GoogleRecaptchaPlugin::cancelCurrentOperation() { emit currentOperationCanceled(); return true; }
bool SolveMediaRecaptchaPlugin::cancelCurrentOperation() { emit currentOperationCanceled(); return true; }
bool PublishToMePlugin::cancelCurrentOperation() { stopWaitTimer(); m_redirects = 0; emit currentOperationCanceled(); return true; }