summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-02-06 17:38:12 -0700
committerIra Rice <irarice@gmail.com>2009-02-06 17:38:12 -0700
commit1458c6b808afaf3af2f1f50f1988427edf64826c (patch)
tree711b48bb56ff05fa333cc4ef984a37839045cfe9 /src/gui
parentb7c33d7ec26735bade5c6e8a2ff9d06586cc7d0c (diff)
downloadmana-1458c6b808afaf3af2f1f50f1988427edf64826c.tar.gz
mana-1458c6b808afaf3af2f1f50f1988427edf64826c.tar.bz2
mana-1458c6b808afaf3af2f1f50f1988427edf64826c.tar.xz
mana-1458c6b808afaf3af2f1f50f1988427edf64826c.zip
Sanitized item links so that at no point is the internal representation
of the item link shown. This should help make it easier for people to represent the square brackets with item links, and prevent people from forging item links when they never see the internal representation of an item link. Should also reduce confusion from people who haven't upgraded their clients as well, as they wonder what all the junk is around the item name. Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/chat.cpp4
-rw-r--r--src/gui/chat.h2
-rw-r--r--src/gui/popupmenu.cpp21
3 files changed, 13 insertions, 14 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index f4d9763b..b53552a6 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -735,10 +735,10 @@ void ChatWindow::setInputText(std::string input_str)
requestChatFocus();
}
-void ChatWindow::addItemText(int itemId, const std::string &item)
+void ChatWindow::addItemText(const std::string &item)
{
std::ostringstream text;
- text << "[@@" << itemId << "|" << item << "@@] ";
+ text << "[" << item << "] ";
mChatInput->setText(mChatInput->getText() + text.str());
requestChatFocus();
}
diff --git a/src/gui/chat.h b/src/gui/chat.h
index 872c0041..2fadb014 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -179,7 +179,7 @@ class ChatWindow : public Window, public gcn::ActionListener,
void setInputText(std::string input_str);
/** Called to add item to chat */
- void addItemText(int itemid, const std::string &item);
+ void addItemText(const std::string &item);
/** Override to reset mTmpVisible */
void setVisible(bool visible);
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index cf6a7188..6c0e6ad6 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -75,27 +75,27 @@ void PopupMenu::showPopup(int x, int y, Being *being)
// Players can be traded with. Later also attack, follow and
// add as buddy will be options in this menu.
const std::string &name = mBeing->getName();
- mBrowserBox->addRow(_("@@trade|Trade With ") + name + "@@");
- mBrowserBox->addRow(_("@@attack|Attack ") + name + "@@");
+ mBrowserBox->addRow(strprintf(_("@@trade|Trade With %s@@"), name.c_str()));
+ mBrowserBox->addRow(strprintf(_("@@attack|Attack %s@@"), name.c_str()));
mBrowserBox->addRow("##3---");
switch (player_relations.getRelation(name)) {
case PlayerRelation::NEUTRAL:
- mBrowserBox->addRow(_("@@friend|Befriend ") + name + "@@");
+ mBrowserBox->addRow(strprintf(_("@@friend|Befriend %s@@"), name.c_str()));
case PlayerRelation::FRIEND:
- mBrowserBox->addRow(_("@@disregard|Disregard ") + name + "@@");
- mBrowserBox->addRow(_("@@ignore|Ignore ") + name + "@@");
+ mBrowserBox->addRow(strprintf(_("@@disregard|Disregard %s@@"), name.c_str()));
+ mBrowserBox->addRow(strprintf(_("@@ignore|Ignore %s@@"), name.c_str()));
break;
case PlayerRelation::DISREGARDED:
- mBrowserBox->addRow(_("@@unignore|Un-Ignore ") + name + "@@");
- mBrowserBox->addRow(_("@@ignore|Completely ignore ") + name + "@@");
+ mBrowserBox->addRow(strprintf(_("@@unignore|Un-Ignore %s@@"), name.c_str()));
+ mBrowserBox->addRow(strprintf(_("@@ignore|Completely ignore %s@@"), name.c_str()));
break;
case PlayerRelation::IGNORED:
- mBrowserBox->addRow(_("@@unignore|Un-Ignore ") + name + "@@");
+ mBrowserBox->addRow(strprintf(_("@@unignore|Un-Ignore %s@@"), name.c_str()));
break;
}
@@ -103,8 +103,7 @@ void PopupMenu::showPopup(int x, int y, Being *being)
//mBrowserBox->addRow(_("@@buddy|Add ") + name + " to Buddy List@@");
mBrowserBox->addRow("##3---");
- mBrowserBox->addRow(_("@@party-invite|Invite ") + name +
- " to party@@");
+ mBrowserBox->addRow(strprintf(_("@@party-invite|Invite %s to party@@"), name.c_str()));
}
break;
@@ -247,7 +246,7 @@ void PopupMenu::handleLink(const std::string& link)
else if (link == "chat")
{
- chatWindow->addItemText(mItem->getId(), mItem->getInfo().getName());
+ chatWindow->addItemText(mItem->getInfo().getName());
}
else if (link == "drop")