summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/commandhandler.cpp3
-rw-r--r--src/gui/chat.cpp7
-rw-r--r--src/gui/chat.h4
-rw-r--r--src/gui/widgets/chattab.cpp3
-rw-r--r--src/gui/widgets/chattab.h2
5 files changed, 12 insertions, 7 deletions
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp
index aaca632a..0af77398 100644
--- a/src/commandhandler.cpp
+++ b/src/commandhandler.cpp
@@ -340,7 +340,8 @@ void CommandHandler::handleMsg(const std::string &args, ChatTab *tab)
tab->chatLog(_("Cannot send empty whispers!"), BY_SERVER);
}
-void CommandHandler::handleQuery(const std::string &args, ChatTab *tab) {
+void CommandHandler::handleQuery(const std::string &args, ChatTab *tab)
+{
if (chatWindow->addWhisperTab(args, true))
return;
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 73af83ff..1ce1b77c 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -297,7 +297,7 @@ void ChatWindow::removeWhisper(const std::string &nick)
mWhispers.erase(tempNick);
}
-void ChatWindow::chatInput(std::string &msg)
+void ChatWindow::chatInput(const std::string &msg)
{
ChatTab *tab = getFocused();
tab->chatInput(msg);
@@ -432,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;
@@ -471,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);
+ }
}
}
diff --git a/src/gui/chat.h b/src/gui/chat.h
index c6e8e326..7080392e 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -136,7 +136,7 @@ class ChatWindow : public Window,
*
* @param msg The message text which is to be sent.
*/
- void chatInput(std::string &msg);
+ void chatInput(const std::string &msg);
/** Called when key is pressed */
void keyPressed(gcn::KeyEvent &event);
@@ -171,7 +171,7 @@ class ChatWindow : public Window,
void doPresent();
- void whisper(const std::string &nick, std::string mes,
+ void whisper(const std::string &nick, const std::string &mes,
bool own = false);
ChatTab *addWhisperTab(const std::string &nick, bool switchTo = false);
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index ad0911c9..d2fa33b8 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -203,8 +203,9 @@ void ChatTab::chatLog(const std::string &nick, const std::string &msg)
false);
}
-void ChatTab::chatInput(std::string &msg)
+void ChatTab::chatInput(const std::string &message)
{
+ std::string msg = message;
trim(msg);
if (msg.empty())
diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h
index dc0d3047..4cb6a58f 100644
--- a/src/gui/widgets/chattab.h
+++ b/src/gui/widgets/chattab.h
@@ -77,7 +77,7 @@ class ChatTab : public Tab
*
* @param msg The message text which is to be sent.
*/
- void chatInput(std::string &msg);
+ void chatInput(const std::string &msg);
/**
* Scrolls the chat window