summaryrefslogtreecommitdiff
path: root/src/gui/chat.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-02-18 20:14:23 +0100
committerIra Rice <irarice@gmail.com>2009-02-18 13:19:11 -0700
commitc3f7f72f37adad5103587069ff549798fc9d652d (patch)
treedf268b0bfd478cb3f4d740b1bce9a882bc70c538 /src/gui/chat.cpp
parentb8f0e1755ae8c6acf9bc681a83f18ef6ff0a1172 (diff)
downloadmana-c3f7f72f37adad5103587069ff549798fc9d652d.tar.gz
mana-c3f7f72f37adad5103587069ff549798fc9d652d.tar.bz2
mana-c3f7f72f37adad5103587069ff549798fc9d652d.tar.xz
mana-c3f7f72f37adad5103587069ff549798fc9d652d.zip
Introduced a toLower method and grouped string utils
The string utility methods are now grouped together in the stringutils.h header. Also, a toLower method was added for convenience.
Diffstat (limited to 'src/gui/chat.cpp')
-rw-r--r--src/gui/chat.cpp23
1 files changed, 5 insertions, 18 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 0e8810ac..91e410ce 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -47,8 +47,7 @@
#include "../utils/gettext.h"
#include "../utils/strprintf.h"
-#include "../utils/tostring.h"
-#include "../utils/trim.h"
+#include "../utils/stringutils.h"
ChatWindow::ChatWindow(Network * network):
Window(""), mNetwork(network), mTmpVisible(false)
@@ -336,15 +335,8 @@ void ChatWindow::whisper(const std::string &nick, std::string msg)
std::string playerName = player_node->getName();
std::string tempNick = recvnick;
- for (unsigned int i = 0; i < playerName.size(); i++)
- {
- playerName[i] = (char) tolower(playerName[i]);
- }
-
- for (unsigned int i = 0; i < tempNick.size(); i++)
- {
- tempNick[i] = (char) tolower(tempNick[i]);
- }
+ toLower(playerName);
+ toLower(tempNick);
if (tempNick.compare(playerName) == 0 || msg.empty())
return;
@@ -405,14 +397,9 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg)
start = msg.find('[', start + 1);
}
- std::string temp = msg.substr(start+1, end - start - 1);
-
- trim(temp);
+ std::string temp = msg.substr(start + 1, end - start - 1);
- for (unsigned int i = 0; i < temp.size(); i++)
- {
- temp[i] = (char) tolower(temp[i]);
- }
+ toLower(trim(temp));
const ItemInfo itemInfo = ItemDB::get(temp);
if (itemInfo.getName() != _("Unknown item"))