diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-24 21:38:28 +0200 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-24 21:38:28 +0200 |
commit | 18b6856aa416473019bc36ead2c0e9cda3719a44 (patch) | |
tree | b08f3ed09378dd288f3e4605ad9160d901640dc4 /src/gui/chat.cpp | |
parent | 768f3d93019b262ce6aa9f913aed0f45d5e4c929 (diff) | |
parent | 4e18e7619e9a8c909dea3374a2a7aa39befe0c16 (diff) | |
download | mana-client-18b6856aa416473019bc36ead2c0e9cda3719a44.tar.gz mana-client-18b6856aa416473019bc36ead2c0e9cda3719a44.tar.bz2 mana-client-18b6856aa416473019bc36ead2c0e9cda3719a44.tar.xz mana-client-18b6856aa416473019bc36ead2c0e9cda3719a44.zip |
Merge branch '0.0.29'
Diffstat (limited to 'src/gui/chat.cpp')
-rw-r--r-- | src/gui/chat.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 414d1e02..1ce1b77c 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -292,10 +292,12 @@ void ChatWindow::addTab(ChatTab *tab) void ChatWindow::removeWhisper(const std::string &nick) { - mWhispers.erase(nick); + std::string tempNick = nick; + toLower(tempNick); + mWhispers.erase(tempNick); } -void ChatWindow::chatInput(std::string &msg) +void ChatWindow::chatInput(const std::string &msg) { ChatTab *tab = getFocused(); tab->chatInput(msg); @@ -430,7 +432,8 @@ void ChatWindow::setRecordingFile(const std::string &msg) mRecorder->setRecordingFile(msg); } -void ChatWindow::whisper(const std::string &nick, std::string mes, bool own) +void ChatWindow::whisper(const std::string &nick, + const std::string &mes, bool own) { if (mes.empty()) return; @@ -444,12 +447,13 @@ void ChatWindow::whisper(const std::string &nick, std::string mes, bool own) if (tempNick.compare(playerName) == 0) return; - ChatTab *tab = mWhispers[tempNick]; + ChatTab *tab = 0; + TabMap::const_iterator i = mWhispers.find(tempNick); - if (!tab && config.getValue("whispertab", false)) - { + if (i != mWhispers.end()) + tab = i->second; + else if (config.getValue("whispertab", false)) tab = addWhisperTab(nick); - } if (tab) { @@ -468,7 +472,9 @@ void ChatWindow::whisper(const std::string &nick, std::string mes, bool own) nick.c_str(), mes.c_str()), BY_PLAYER); } else + { localChatTab->chatLog(nick + " : " + mes, ACT_WHISPER, false); + } } } @@ -480,10 +486,12 @@ ChatTab *ChatWindow::addWhisperTab(const std::string &nick, bool switchTo) toLower(playerName); toLower(tempNick); - if (mWhispers[tempNick] || tempNick.compare(playerName) == 0) + if (mWhispers.find(tempNick) != mWhispers.end() + || tempNick.compare(playerName) == 0) return NULL; - ChatTab *ret = mWhispers[tempNick] = new WhisperTab(nick); + ChatTab *ret = new WhisperTab(nick); + mWhispers[tempNick] = ret; if (switchTo) mChatTabs->setSelectedTab(ret); |