Api keys: add class instead single functions to check api keys

Without class build was broken, with static versions it should working.


Origin commit data
------------------
Branch: ni/coolstream
Commit: 7d6a4db686
Author: Thilo Graf <dbt@novatux.de>
Date: 2018-04-29 (Sun, 29 Apr 2018)



------------------
This commit was generated by Migit
This commit is contained in:
2018-04-29 03:13:08 +02:00
committed by vanhofen
parent 0bca1ee7d8
commit 66532c9a5c
3 changed files with 27 additions and 24 deletions

View File

@@ -158,14 +158,17 @@ class CAutoModeNotifier : public CChangeObserver
bool changeNotify(const neutrino_locale_t, void * data);
};
//do we need a class?
int check_api_key(const std::string& api_key_setting, const std::string& api_key_pattern)
class CApiKey
{
return ((api_key_setting != api_key_pattern) && !api_key_setting.empty());
}
inline int check_shoutcast_dev_id() { return check_api_key(g_settings.shoutcast_dev_id, "XXXXXXXXXXXXXXXX"); }
inline int check_youtube_dev_id() { return check_api_key(g_settings.youtube_dev_id, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); }
inline int check_tmdb_api_key() { return check_api_key(g_settings.tmdb_api_key, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); }
inline int check_omdb_api_key() { return check_api_key(g_settings.omdb_api_key, "XXXXXXXX"); }
public:
static int check_api_key(const std::string& api_key_setting, const std::string& api_key_pattern)
{
return ((api_key_setting != api_key_pattern) && !api_key_setting.empty());
}
static int check_shoutcast_dev_id() { return CApiKey::check_api_key(g_settings.shoutcast_dev_id, "XXXXXXXXXXXXXXXX"); }
static int check_youtube_dev_id() { return CApiKey::check_api_key(g_settings.youtube_dev_id, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); }
static int check_tmdb_api_key() { return CApiKey::check_api_key(g_settings.tmdb_api_key, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); }
static int check_omdb_api_key() { return CApiKey::check_api_key(g_settings.omdb_api_key, "XXXXXXXX"); }
};
#endif