summaryrefslogtreecommitdiff
path: root/src/gui/chat.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-16 15:50:00 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-16 15:50:00 +0000
commit32badd4b6f843cb74fdc3238fe92119518c8c0ab (patch)
treeade2ace7f5ef62ae9fd14c6409d9c2df43a2348b /src/gui/chat.cpp
parent65ccfccfc1e35a2e65638aea61c46e4e51bd874e (diff)
downloadmana-client-32badd4b6f843cb74fdc3238fe92119518c8c0ab.tar.gz
mana-client-32badd4b6f843cb74fdc3238fe92119518c8c0ab.tar.bz2
mana-client-32badd4b6f843cb74fdc3238fe92119518c8c0ab.tar.xz
mana-client-32badd4b6f843cb74fdc3238fe92119518c8c0ab.zip
A bunch of cosmetic changes.
Diffstat (limited to 'src/gui/chat.cpp')
-rw-r--r--src/gui/chat.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 558c5558..7e0e4849 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -197,9 +197,9 @@ ChatWindow::action(const std::string& eventId)
{
std::string message = mChatInput->getText();
- if (message.length() > 0) {
+ if (!message.empty()) {
// If message different from previous, put it in the history
- if (mHistory.size() == 0 || message != mHistory.back()) {
+ if (mHistory.empty() || message != mHistory.back()) {
mHistory.push_back(message);
}
@@ -207,7 +207,7 @@ ChatWindow::action(const std::string& eventId)
mCurHist = mHistory.end();
// Send the message to the server
- chatSend(player_node->getName().c_str(), message.c_str());
+ chatSend(player_node->getName(), message);
// Clear the text from the chat input
mChatInput->setText("");
@@ -252,7 +252,7 @@ ChatWindow::isFocused()
}
void
-ChatWindow::chatSend(std::string nick, std::string msg)
+ChatWindow::chatSend(const std::string &nick, std::string msg)
{
// Prepare command
if (msg.substr(0, 1) == "/")
@@ -292,9 +292,7 @@ ChatWindow::chatSend(std::string nick, std::string msg)
}
// Prepare ordinary message
else {
- nick += " : ";
- nick += msg;
- msg = nick;
+ msg = nick + " : " + msg;
MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_CHAT_MESSAGE);