3535
3636using namespace Online ;
3737
38- NewsManager *NewsManager::m_news_manager=NULL ;
38+ NewsManager *NewsManager::m_news_manager = nullptr ;
39+ std::string NewsManager::m_news_filename = " online_news.xml" ;
3940
4041// ----------------------------------------------------------------------------
4142NewsManager::NewsManager () : m_news(std::vector<NewsMessage>())
@@ -45,7 +46,7 @@ NewsManager::NewsManager() : m_news(std::vector<NewsMessage>())
4546 m_force_refresh = false ;
4647
4748 // Clean .part file which may be left behind
48- std::string news_part = file_manager->getAddonsFile (" news.xml .part" );
49+ std::string news_part = file_manager->getAddonsFile (m_news_filename + " .part" );
4950 if (file_manager->fileExists (news_part))
5051 file_manager->removeFile (news_part);
5152
@@ -60,16 +61,16 @@ NewsManager::~NewsManager()
6061// ---------------------------------------------------------------------------
6162/* * This function initialises the data for the news manager. It starts a
6263 * separate thread to execute downloadNews() - which (if necessary) downloads
63- * the news.xml file and updates the list of news messages. It also
64+ * the m_news_filename file and updates the list of news messages. It also
6465 * initialises the addons manager (which can trigger another download of
65- * news.xml ).
66- * \param force_refresh Re-download news.xml , even if
66+ * m_news_filename ).
67+ * \param force_refresh Re-download m_news_filename , even if
6768 */
6869void NewsManager::init (bool force_refresh)
6970{
7071 m_force_refresh = force_refresh;
7172
72- // The rest (which potentially involves downloading news.xml ) is handled
73+ // The rest (which potentially involves downloading m_news_filename ) is handled
7374 // in a separate thread, so that the GUI remains responsive. It is only
7475 // started if internet access is enabled, else nothing is done in the
7576 // thread anyway (and the addons menu is disabled as a result).
@@ -93,7 +94,7 @@ void NewsManager::init(bool force_refresh)
9394} // init
9495
9596// ---------------------------------------------------------------------------
96- /* * This function submits request which will download the news.xml file
97+ /* * This function submits request which will download the m_news_filename file
9798 * if necessary. It is running in its own thread, so we can use blocking
9899 * download calls without blocking the GUI.
99100 * \param obj This is 'this' object, passed on during pthread creation.
@@ -104,15 +105,15 @@ void* NewsManager::downloadNews(void *obj)
104105 NewsManager *me = (NewsManager*)obj;
105106 me->clearErrorMessage ();
106107
107- std::string xml_file = file_manager->getAddonsFile (" news.xml " );
108+ std::string xml_file = file_manager->getAddonsFile (m_news_filename );
108109 // Prevent downloading when .part file created, which is already downloaded
109- std::string xml_file_part = file_manager->getAddonsFile (" news.xml .part" );
110+ std::string xml_file_part = file_manager->getAddonsFile (m_news_filename + " .part" );
110111 bool news_exists = file_manager->fileExists (xml_file);
111112
112113 // The news message must be updated if either it has never been updated,
113114 // or if the time of the last update was more than news_frequency ago,
114115 // or because a 'refresh' was explicitly requested by the user, or no
115- // news.xml file exists.
116+ // m_news_filename file exists.
116117 bool download = ( UserConfigParams::m_news_last_updated==0 ||
117118 UserConfigParams::m_news_last_updated
118119 +UserConfigParams::m_news_frequency
@@ -149,8 +150,8 @@ void* NewsManager::downloadNews(void *obj)
149150 {
150151 core::stringw error_message (" " );
151152
152- HTTPRequest *download_req = new HTTPRequest (" news.xml " );
153- download_req->setAddonsURL (" news.xml " );
153+ HTTPRequest *download_req = new HTTPRequest (m_news_filename );
154+ download_req->setAddonsURL (m_news_filename );
154155
155156 // Initialise the online portion of the addons manager.
156157 if (UserConfigParams::logAddons ())
@@ -167,10 +168,10 @@ void* NewsManager::downloadNews(void *obj)
167168
168169 // We need a new object, since the state of the old
169170 // download request is now done.
170- download_req = new HTTPRequest (" news.xml " );
171+ download_req = new HTTPRequest (m_news_filename );
171172
172173 // make sure the new server address is actually used
173- download_req->setAddonsURL (" news.xml " );
174+ download_req->setAddonsURL (m_news_filename );
174175 download_req->executeNow ();
175176
176177 if (download_req->hadDownloadError ())
0 commit comments