bool VkAuthManager::CheckError (const QUrl& url) { if (url.path () != "/error") return false; #if QT_VERSION < 0x050000 const auto errNum = url.queryItemValue ("err").toInt (); #else const auto errNum = QUrlQuery { url }.queryItemValue ("err").toInt (); #endif IsRequesting_ = false; qWarning () << Q_FUNC_INFO << "got error" << errNum; if (errNum == 2) { clearAuthData (); RequestAuthKey (); return true; } const auto& e = Util::MakeNotification ("VK.com", tr ("VK.com authentication for %1 failed because of error %2. " "Report upstream please.") .arg (AccountHR_) .arg (errNum), PCritical_); Proxy_->GetEntityManager ()->HandleEntity (e); return true; }
void VkAuthManager::GetAuthKey () { if (Token_.isEmpty () || ReceivedAt_.secsTo (QDateTime::currentDateTime ()) > ValidFor_) { RequestAuthKey (); return; } emit gotAuthKey (Token_); }
void VkAuthManager::GetAuthKey () { if (SilentMode_) { PrioManagedQueues_.clear (); ManagedQueues_.clear (); return; } if (!IsAuthenticated ()) { RequestAuthKey (); return; } InvokeQueues (Token_); emit gotAuthKey (Token_); }
void VkAuthManager::execScheduledRequest () { IsRequestScheduled_ = false; RequestAuthKey (); }