diff options
-rw-r--r-- | src/Protocol/Protocol17x.cpp | 3 | ||||
-rw-r--r-- | src/Server.cpp | 14 | ||||
-rw-r--r-- | src/Server.h | 3 |
3 files changed, 20 insertions, 0 deletions
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index 7d1f723a3..4d08df2d9 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -1115,6 +1115,9 @@ void cProtocol172::HandlePacketStatusRequest(cByteBuffer & a_ByteBuffer) AppendPrintf(Response, "\"description\":{\"text\":\"%s\"}", cRoot::Get()->GetServer()->GetDescription().c_str() ); + AppendPrintf(Response, "\"favicon\":\"data:image/png;base64,%s\"", + cRoot::Get()->GetServer()->GetFaviconData().c_str() + ); Response.append("}"); cPacketizer Pkt(*this, 0x00); // Response packet diff --git a/src/Server.cpp b/src/Server.cpp index e707235a8..b0439391c 100644 --- a/src/Server.cpp +++ b/src/Server.cpp @@ -203,6 +203,11 @@ bool cServer::InitServer(cIniFile & a_SettingsIni) m_PlayerCount = 0; m_PlayerCountDiff = 0; + if (cFile::Exists("favicon.png")) + { + m_FaviconData = Base64Encode(cFile::ReadWholeFile("favicon.png")); + } + if (m_bIsConnected) { LOGERROR("ERROR: Trying to initialize server while server is already running!"); @@ -289,6 +294,15 @@ int cServer::GetNumPlayers(void) +const AString & cServer::GetFaviconData(void) const +{ + return m_FaviconData; +} + + + + + void cServer::PrepareKeys(void) { // TODO: Save and load key for persistence across sessions diff --git a/src/Server.h b/src/Server.h index e62c4c7b7..2609b6874 100644 --- a/src/Server.h +++ b/src/Server.h @@ -106,6 +106,8 @@ public: // tolua_export /// Notifies the server that a player is being destroyed; the server uses this to adjust the number of players void PlayerDestroying(const cPlayer * a_Player); + + const AString & GetFaviconData(void) const; CryptoPP::RSA::PrivateKey & GetPrivateKey(void) { return m_PrivateKey; } CryptoPP::RSA::PublicKey & GetPublicKey (void) { return m_PublicKey; } @@ -183,6 +185,7 @@ private: cRCONServer m_RCONServer; AString m_Description; + AString m_FaviconData; int m_MaxPlayers; bool m_bIsHardcore; |