From 2133b8fd07e8fca38fc948613960fb8498d85e1f Mon Sep 17 00:00:00 2001 From: titiger Date: Sat, 11 Mar 2017 23:57:44 +0100 Subject: [PATCH] show megaglest version in irc WhoIS --- source/glest_game/menu/menu_state_masterserver.cpp | 1 + source/shared_lib/include/platform/posix/ircclient.h | 2 ++ source/shared_lib/sources/platform/posix/ircclient.cpp | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/source/glest_game/menu/menu_state_masterserver.cpp b/source/glest_game/menu/menu_state_masterserver.cpp index be2262d7..b1876ec9 100644 --- a/source/glest_game/menu/menu_state_masterserver.cpp +++ b/source/glest_game/menu/menu_state_masterserver.cpp @@ -329,6 +329,7 @@ MenuStateMasterserver::MenuStateMasterserver(Program *program, MainMenu *mainMen ircClient = ircThread; ircClient->setUniqueID(mutexOwnerId); ircClient->setPlayerName(netPlayerName); + ircClient->setGlestVersionString(glestVersionString); ircClient->start(); } else { diff --git a/source/shared_lib/include/platform/posix/ircclient.h b/source/shared_lib/include/platform/posix/ircclient.h index cd672fc9..3ae99be5 100644 --- a/source/shared_lib/include/platform/posix/ircclient.h +++ b/source/shared_lib/include/platform/posix/ircclient.h @@ -69,6 +69,7 @@ protected: string nick; string playerName; + string glestVersionString; bool hasJoinedChannel; @@ -97,6 +98,7 @@ public: static void setGlobalCacheContainerName(const char *name) { globalCacheContainerName = name; } void setPlayerName(string value) { playerName = value; } + void setGlestVersionString(string value) { glestVersionString = value; } string getPlayerName() const { return playerName; } bool getWantToLeaveChannel() const { return wantToLeaveChannel; } diff --git a/source/shared_lib/sources/platform/posix/ircclient.cpp b/source/shared_lib/sources/platform/posix/ircclient.cpp index 7e21e250..b6feee1d 100644 --- a/source/shared_lib/sources/platform/posix/ircclient.cpp +++ b/source/shared_lib/sources/platform/posix/ircclient.cpp @@ -540,6 +540,7 @@ IRCThread::IRCThread(const std::vector &argv, IRCCallbackInterface *call lastNickListUpdate = time(NULL); wantToLeaveChannel = false; playerName = ""; + glestVersionString = ""; } void IRCThread::disconnect() { @@ -824,7 +825,7 @@ void IRCThread::execute() { if(SystemFlags::VERBOSE_MODE_ENABLED || IRCThread::debugEnabled) printf ("===> IRC: Line: %d\n", __LINE__); safeMutex.Lock(); - if(irc_connect(ircSession, argv[0].c_str(), IRC_SERVER_PORT, 0, this->nick.c_str(), this->username.c_str(), "megaglest")) { + if(irc_connect(ircSession, argv[0].c_str(), IRC_SERVER_PORT, 0, this->nick.c_str(), this->username.c_str(), ("MegagGlest "+glestVersionString).c_str())) { safeMutex.ReleaseLock(); if(SystemFlags::VERBOSE_MODE_ENABLED || IRCThread::debugEnabled) printf ("===> IRC Could not connect: %s\n", irc_strerror (irc_errno(ircSession))); return;