From 3f8c025e648a98e5b8d940c2781546e7ae817b8c Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sat, 19 Aug 2017 15:29:36 +0200 Subject: [PATCH] Store default client id in `credentials.hpp` --- src/credentials.hpp | 10 ++++++++++ src/ircmanager.cpp | 2 -- src/ircmanager.hpp | 2 -- src/widgets/accountpopup.cpp | 5 +++-- 4 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 src/credentials.hpp diff --git a/src/credentials.hpp b/src/credentials.hpp new file mode 100644 index 000000000..e66cd2d34 --- /dev/null +++ b/src/credentials.hpp @@ -0,0 +1,10 @@ +#pragma once + +namespace chatterino { + +inline QByteArray getDefaultClientID() +{ + return QByteArray("7ue61iz46fz11y3cugd0l3tawb4taal"); +} + +} // namespace chatterino diff --git a/src/ircmanager.cpp b/src/ircmanager.cpp index 8dc1701a8..74fc0f32b 100644 --- a/src/ircmanager.cpp +++ b/src/ircmanager.cpp @@ -25,8 +25,6 @@ using namespace chatterino::messages; namespace chatterino { -const QString IrcManager::defaultClientId("7ue61iz46fz11y3cugd0l3tawb4taal"); - IrcManager::IrcManager(ChannelManager &_channelManager, Resources &_resources, EmoteManager &_emoteManager, WindowManager &_windowManager) : channelManager(_channelManager) diff --git a/src/ircmanager.hpp b/src/ircmanager.hpp index b658ae413..c3153e59d 100644 --- a/src/ircmanager.hpp +++ b/src/ircmanager.hpp @@ -30,8 +30,6 @@ public: IrcManager(ChannelManager &_channelManager, Resources &_resources, EmoteManager &_emoteManager, WindowManager &_windowManager); - static const QString defaultClientId; - void connect(); void disconnect(); diff --git a/src/widgets/accountpopup.cpp b/src/widgets/accountpopup.cpp index e54b70840..a58a8a493 100644 --- a/src/widgets/accountpopup.cpp +++ b/src/widgets/accountpopup.cpp @@ -1,5 +1,6 @@ #include "widgets/accountpopup.hpp" #include "channel.hpp" +#include "credentials.hpp" #include "ui_accountpopupform.h" #include @@ -42,7 +43,7 @@ void AccountPopupWidget::getUserId() QNetworkRequest req(nameUrl); req.setRawHeader(QByteArray("Accept"), QByteArray("application/vnd.twitchtv.v5+json")); - req.setRawHeader(QByteArray("Client-ID"), QByteArray("7ue61iz46fz11y3cugd0l3tawb4taal")); + req.setRawHeader(QByteArray("Client-ID"), getDefaultClientID()); static auto manager = new QNetworkAccessManager(); auto *reply = manager->get(req); @@ -66,7 +67,7 @@ void AccountPopupWidget::getUserData() QNetworkRequest req(idUrl); req.setRawHeader(QByteArray("Accept"), QByteArray("application/vnd.twitchtv.v5+json")); - req.setRawHeader(QByteArray("Client-ID"), QByteArray("7ue61iz46fz11y3cugd0l3tawb4taal")); + req.setRawHeader(QByteArray("Client-ID"), getDefaultClientID()); static auto manager = new QNetworkAccessManager(); auto *reply = manager->get(req);