summaryrefslogtreecommitdiff
path: root/src/gui/chat.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-03-10 05:25:49 -0600
committerJared Adams <jaxad0127@gmail.com>2009-03-10 05:25:49 -0600
commita872eb3364eec4a9778692a1e529aa506c9e09ca (patch)
tree83fd797ab20389b6e7da6ffd2dc13dac71c366fb /src/gui/chat.cpp
parent9e7dfd7397ed2c282015f4cc13c42598b6bb1f39 (diff)
downloadmana-client-a872eb3364eec4a9778692a1e529aa506c9e09ca.tar.gz
mana-client-a872eb3364eec4a9778692a1e529aa506c9e09ca.tar.bz2
mana-client-a872eb3364eec4a9778692a1e529aa506c9e09ca.tar.xz
mana-client-a872eb3364eec4a9778692a1e529aa506c9e09ca.zip
Fix typo in item link parsing
Diffstat (limited to 'src/gui/chat.cpp')
-rw-r--r--src/gui/chat.cpp31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 702327a5..8ecb5f63 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -224,34 +224,39 @@ void ChatWindow::chatLog(std::string line, int own, bool ignoreRecord)
<< "] ";
// Check for item link
- std::string::size_type start = msg.find('[');
- while (start != std::string::npos && msg[start+1] != '@')
+ std::string::size_type start = tmp.text.find('[');
+ while (start != std::string::npos && tmp.text[start+1] != '@')
{
- std::string::size_type end = msg.find(']', start);
+ std::string::size_type end = tmp.text.find(']', start);
if (start+1 != end && end != std::string::npos)
{
// Catch multiple embeds and ignore them
// so it doesn't crash the client.
- while ((msg.find('[', start + 1) != std::string::npos) &&
- (msg.find('[', start + 1) < end))
+ while ((tmp.text.find('[', start + 1) != std::string::npos) &&
+ (tmp.text.find('[', start + 1) < end))
{
- start = msg.find('[', start + 1);
+ start = tmp.text.find('[', start + 1);
}
- std::string temp = msg.substr(start + 1, end - start - 1);
+ std::string temp = tmp.text.substr(start+1, end - start - 1);
- toLower(trim(temp));
+ trim(temp);
+
+ for (unsigned int i = 0; i < temp.size(); i++)
+ {
+ temp[i] = (char) tolower(temp[i]);
+ }
const ItemInfo itemInfo = ItemDB::get(temp);
if (itemInfo.getName() != _("Unknown item"))
{
- msg.insert(end, "@@");
- msg.insert(start+1, "|");
- msg.insert(start+1, toString(itemInfo.getId()));
- msg.insert(start+1, "@@");
+ tmp.text.insert(end, "@@");
+ tmp.text.insert(start+1, "|");
+ tmp.text.insert(start+1, toString(itemInfo.getId()));
+ tmp.text.insert(start+1, "@@");
}
}
- start = msg.find('[', start + 1);
+ start = tmp.text.find('[', start + 1);
}
line = lineColor + timeStr.str() + tmp.nick + tmp.text;