mirror of
https://github.com/glest/glest-source.git
synced 2025-08-10 02:16:31 +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");
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("#1 IRCCLient Cache check\n");
|
||||||
IRCThread * &ircThread = CacheManager::getCachedItem< IRCThread * >(GameConstants::ircClientCacheLookupKey);
|
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(ircThread == NULL) {
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("#2 IRCCLient Cache check\n");
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("#2 IRCCLient Cache check\n");
|
||||||
ircThread = new IRCThread(ircArgs,this);
|
ircThread = new IRCThread(ircArgs,this);
|
||||||
ircClient = ircThread;
|
ircClient = ircThread;
|
||||||
ircClient->setUniqueID(extractFileFromDirectoryPath(__FILE__).c_str());
|
ircClient->setUniqueID(extractFileFromDirectoryPath(__FILE__).c_str());
|
||||||
|
ircClient->setPlayerName(netPlayerName);
|
||||||
ircClient->start();
|
ircClient->start();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@@ -65,6 +65,8 @@ protected:
|
|||||||
string channel;
|
string channel;
|
||||||
string nick;
|
string nick;
|
||||||
|
|
||||||
|
string playerName;
|
||||||
|
|
||||||
bool hasJoinedChannel;
|
bool hasJoinedChannel;
|
||||||
bool eventDataDone;
|
bool eventDataDone;
|
||||||
Mutex mutexNickList;
|
Mutex mutexNickList;
|
||||||
@@ -83,6 +85,9 @@ public:
|
|||||||
virtual void signalQuit();
|
virtual void signalQuit();
|
||||||
virtual bool shutdownAndWait();
|
virtual bool shutdownAndWait();
|
||||||
|
|
||||||
|
void setPlayerName(string value) { playerName = value; }
|
||||||
|
string getPlayerName() const { return playerName; }
|
||||||
|
|
||||||
bool getWantToLeaveChannel() const { return wantToLeaveChannel; }
|
bool getWantToLeaveChannel() const { return wantToLeaveChannel; }
|
||||||
|
|
||||||
void SendIRCCmdMessage(string target, string msg);
|
void SendIRCCmdMessage(string target, string msg);
|
||||||
|
@@ -461,6 +461,7 @@ IRCThread::IRCThread(const std::vector<string> &argv, IRCCallbackInterface *call
|
|||||||
hasJoinedChannel = false;
|
hasJoinedChannel = false;
|
||||||
lastNickListUpdate = time(NULL);
|
lastNickListUpdate = time(NULL);
|
||||||
wantToLeaveChannel = false;
|
wantToLeaveChannel = false;
|
||||||
|
playerName = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void IRCThread::signalQuit() {
|
void IRCThread::signalQuit() {
|
||||||
|
Reference in New Issue
Block a user