From ebbc900755b09862be95d29d2a02b8abd1792a3a Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Wed, 12 Jun 2019 15:10:41 -0400
Subject: added a few helper classes for user accounts and stats moved the api
label to the status bar refactored a bunch of copy/pasted code in
NexusInterface to use shouldThrottle() and throttledWarning()
---
src/nxmaccessmanager.cpp | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
(limited to 'src/nxmaccessmanager.cpp')
diff --git a/src/nxmaccessmanager.cpp b/src/nxmaccessmanager.cpp
index 684a53fa..5886d3ee 100644
--- a/src/nxmaccessmanager.cpp
+++ b/src/nxmaccessmanager.cpp
@@ -18,8 +18,8 @@ along with Mod Organizer. If not, see .
*/
#include "nxmaccessmanager.h"
-
#include "iplugingame.h"
+#include "nexusinterface.h"
#include "nxmurl.h"
#include "report.h"
#include "utility.h"
@@ -280,14 +280,11 @@ void NXMAccessManager::validateFinished()
QString name = credentialsData.value("name").toString();
bool premium = credentialsData.value("is_premium").toBool();
- std::tuple limits(std::make_tuple(
- m_ValidateReply->rawHeader("x-rl-daily-remaining").toInt(),
- m_ValidateReply->rawHeader("x-rl-daily-limit").toInt(),
- m_ValidateReply->rawHeader("x-rl-hourly-remaining").toInt(),
- m_ValidateReply->rawHeader("x-rl-hourly-limit").toInt()
- ));
-
- emit credentialsReceived(name, id, premium, limits);
+ emit credentialsReceived(APIUserAccount()
+ .id(QString("%1").arg(id))
+ .name(name)
+ .type(premium ? APIUserAccountTypes::Premium : APIUserAccountTypes::Regular)
+ .limits(NexusInterface::parseLimits(m_ValidateReply)));
m_ValidateReply->deleteLater();
m_ValidateReply = nullptr;
--
cgit v1.3.1