From 913841f50115379ebaaba1cb88c3f1cdfed09320 Mon Sep 17 00:00:00 2001 From: Bill Derouin Date: Tue, 7 Jan 2014 09:31:06 -0600 Subject: Implement favicon for 1.7.2 Favicon data is a png encoded in base64 which is stored in the server and sent in the server response packet --- src/Server.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/Server.cpp') diff --git a/src/Server.cpp b/src/Server.cpp index 7dedc3904..e5050f321 100644 --- a/src/Server.cpp +++ b/src/Server.cpp @@ -203,6 +203,8 @@ bool cServer::InitServer(cIniFile & a_SettingsIni) m_PlayerCount = 0; m_PlayerCountDiff = 0; + if (cFile::Exists("favicon.png")) m_Favicon = Base64Encode(cFile::ReadWholeFile("favicon.png")); + if (m_bIsConnected) { LOGERROR("ERROR: Trying to initialize server while server is already running!"); @@ -289,6 +291,15 @@ int cServer::GetNumPlayers(void) +AString cServer::GetFaviconData(void) +{ + return m_Favicon; +} + + + + + void cServer::PrepareKeys(void) { // TODO: Save and load key for persistence across sessions -- cgit v1.2.3 From ede6757f6731fbdabb07092f8785fa09a59c5375 Mon Sep 17 00:00:00 2001 From: Bill Derouin Date: Tue, 7 Jan 2014 09:40:59 -0600 Subject: A few touch ups --- src/Server.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/Server.cpp') diff --git a/src/Server.cpp b/src/Server.cpp index e5050f321..0afd8958d 100644 --- a/src/Server.cpp +++ b/src/Server.cpp @@ -203,7 +203,10 @@ bool cServer::InitServer(cIniFile & a_SettingsIni) m_PlayerCount = 0; m_PlayerCountDiff = 0; - if (cFile::Exists("favicon.png")) m_Favicon = Base64Encode(cFile::ReadWholeFile("favicon.png")); + if (cFile::Exists("favicon.png")) + { + m_FaviconData = Base64Encode(cFile::ReadWholeFile("favicon.png")); + } if (m_bIsConnected) { -- cgit v1.2.3 From 1c2eb4a1c07167e2fb53f9398383d3fda0940b0b Mon Sep 17 00:00:00 2001 From: Bill Derouin Date: Tue, 7 Jan 2014 09:49:52 -0600 Subject: A few more touch ups --- src/Server.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Server.cpp') diff --git a/src/Server.cpp b/src/Server.cpp index 0afd8958d..30c401d59 100644 --- a/src/Server.cpp +++ b/src/Server.cpp @@ -296,7 +296,7 @@ int cServer::GetNumPlayers(void) AString cServer::GetFaviconData(void) { - return m_Favicon; + return m_FaviconData; } -- cgit v1.2.3 From 5012b81578396154150cb4696d57c455766e22f2 Mon Sep 17 00:00:00 2001 From: Bill Derouin Date: Tue, 7 Jan 2014 10:26:56 -0600 Subject: Avoid making copies of favicon string --- src/Server.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Server.cpp') diff --git a/src/Server.cpp b/src/Server.cpp index 30c401d59..e2a73541a 100644 --- a/src/Server.cpp +++ b/src/Server.cpp @@ -294,7 +294,7 @@ int cServer::GetNumPlayers(void) -AString cServer::GetFaviconData(void) +const AString & cServer::GetFaviconData(void) const { return m_FaviconData; } -- cgit v1.2.3