mirror of
https://github.com/glest/glest-source.git
synced 2025-08-09 09:56:30 +02:00
- when changing playername, we reset the irc client connection when entering the internet lobby
This commit is contained in:
@@ -308,11 +308,23 @@ MenuStateMasterserver::MenuStateMasterserver(Program *program, MainMenu *mainMen
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("#1 IRCCLient Cache check\n");
|
||||
IRCThread * &ircThread = CacheManager::getCachedItem< IRCThread * >(GameConstants::ircClientCacheLookupKey);
|
||||
|
||||
// Playername changed so restart the IRC Thread
|
||||
if(ircThread != NULL && netPlayerName != ircThread->getPlayerName()) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
ircThread->leaveChannel();
|
||||
ircThread->setCallbackObj(NULL);
|
||||
ircThread->signalQuit();
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
ircThread = NULL;
|
||||
}
|
||||
|
||||
if(ircThread == NULL) {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("#2 IRCCLient Cache check\n");
|
||||
ircThread = new IRCThread(ircArgs,this);
|
||||
ircClient = ircThread;
|
||||
ircClient->setUniqueID(extractFileFromDirectoryPath(__FILE__).c_str());
|
||||
ircClient->setPlayerName(netPlayerName);
|
||||
ircClient->start();
|
||||
}
|
||||
else {
|
||||
|
@@ -65,6 +65,8 @@ protected:
|
||||
string channel;
|
||||
string nick;
|
||||
|
||||
string playerName;
|
||||
|
||||
bool hasJoinedChannel;
|
||||
bool eventDataDone;
|
||||
Mutex mutexNickList;
|
||||
@@ -83,6 +85,9 @@ public:
|
||||
virtual void signalQuit();
|
||||
virtual bool shutdownAndWait();
|
||||
|
||||
void setPlayerName(string value) { playerName = value; }
|
||||
string getPlayerName() const { return playerName; }
|
||||
|
||||
bool getWantToLeaveChannel() const { return wantToLeaveChannel; }
|
||||
|
||||
void SendIRCCmdMessage(string target, string msg);
|
||||
|
@@ -461,6 +461,7 @@ IRCThread::IRCThread(const std::vector<string> &argv, IRCCallbackInterface *call
|
||||
hasJoinedChannel = false;
|
||||
lastNickListUpdate = time(NULL);
|
||||
wantToLeaveChannel = false;
|
||||
playerName = "";
|
||||
}
|
||||
|
||||
void IRCThread::signalQuit() {
|
||||
|
Reference in New Issue
Block a user