VkAuthManager::VkAuthManager (const QString& accName, const QString& id, const QStringList& scope, const QByteArray& cookies, ICoreProxy_ptr proxy, QueueManager *queueMgr, QObject *parent) : QObject (parent) , Proxy_ (proxy) , AccountHR_ (accName) , AuthNAM_ (new QNetworkAccessManager (this)) , Cookies_ (new Util::CustomCookieJar (this)) , Queue_ (queueMgr) , ValidFor_ (0) , IsRequesting_ (false) , ID_ (id) , URL_ (URLFromClientID (ID_, scope)) , IsRequestScheduled_ (false) , ScheduleTimer_ (new QTimer (this)) { AuthNAM_->setCookieJar (Cookies_); Cookies_->Load (cookies); ScheduleTimer_->setSingleShot (true); connect (ScheduleTimer_, SIGNAL (timeout ()), this, SLOT (execScheduledRequest ())); }
void VkAuthManager::UpdateScope (const QStringList& scope) { const auto& newUrl = URLFromClientID (ID_, scope); if (URL_ == newUrl) return; URL_ = newUrl; Token_.clear (); ReceivedAt_ = QDateTime (); ValidFor_ = 0; }
VkAuthManager::VkAuthManager (const QString& id, const QStringList& scope, const QByteArray& cookies, ICoreProxy_ptr proxy, QObject *parent) : QObject (parent) , Proxy_ (proxy) , AuthNAM_ (new QNetworkAccessManager (this)) , Cookies_ (new Util::CustomCookieJar) , ValidFor_ (0) , IsRequesting_ (false) , URL_ (URLFromClientID (id, scope)) { AuthNAM_->setCookieJar (Cookies_); Cookies_->Load (cookies); }