diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2006-01-03 16:14:06 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2006-01-03 16:14:06 +0000 |
commit | 08310d2bad4f7d2f00ef506630a350bff2f4a951 (patch) | |
tree | 2826f4d9796178f785c6e6f2f6aa2e32609c9394 /src/gui | |
parent | 8cbb88a3317386ccccfed5cee02050c731bf26d5 (diff) | |
download | mana-08310d2bad4f7d2f00ef506630a350bff2f4a951.tar.gz mana-08310d2bad4f7d2f00ef506630a350bff2f4a951.tar.bz2 mana-08310d2bad4f7d2f00ef506630a350bff2f4a951.tar.xz mana-08310d2bad4f7d2f00ef506630a350bff2f4a951.zip |
Really disabled /commands and added proper message when logging in and banned.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/chat.cpp | 30 | ||||
-rw-r--r-- | src/gui/chat.h | 6 | ||||
-rw-r--r-- | src/gui/login.cpp | 6 | ||||
-rw-r--r-- | src/gui/trade.cpp | 2 |
4 files changed, 22 insertions, 22 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 664ba5cd..91b6be91 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -101,7 +101,7 @@ ChatWindow::logic() } void -ChatWindow::chat_log(std::string line, int own) +ChatWindow::chatLog(std::string line, int own) { // Delete overhead from the end of the list while ((int)chatlog.size() > items_keep) { @@ -183,9 +183,9 @@ ChatWindow::chat_log(std::string line, int own) } void -ChatWindow::chat_log(CHATSKILL act) +ChatWindow::chatLog(CHATSKILL act) { - chat_log(const_msg(act), BY_SERVER); + chatLog(const_msg(act), BY_SERVER); } void @@ -194,6 +194,7 @@ ChatWindow::action(const std::string& eventId) if (eventId == "chatinput") { std::string message = chatInput->getText(); + printf("Message: %s\n", message.c_str()); if (message.length() > 0) { // If message different from previous, put it in the history @@ -205,7 +206,7 @@ ChatWindow::action(const std::string& eventId) curHist = history.end(); // Send the message to the server - chat_send(player_info->name.c_str(), message.c_str()); + chatSend(player_info->name.c_str(), message.c_str()); // Clear the text from the chat input chatInput->setText(""); @@ -250,32 +251,25 @@ ChatWindow::isFocused() } void -ChatWindow::chat_send(std::string nick, std::string msg) +ChatWindow::chatSend(std::string nick, std::string msg) { short packetId = CMSG_CHAT_MESSAGE; // prepare command if (msg.substr(0, 1) == "/") { - // global announcement - /*if(msg.substr(0, IS_ANNOUNCE_LENGTH) == IS_ANNOUNCE) { - msg.erase(0, IS_ANNOUNCE_LENGTH); - packid = 0x0099; - }*/ // prepare ordinary message - chat_log("Sorry but /commands are not available yet", BY_PLAYER); + chatLog("Sorry but /commands are not available yet", BY_SERVER); } else { nick += " : "; nick += msg; msg = nick; - //packetId = 0x008c; - } - // send processed message - MessageOut outMsg; - outMsg.writeInt16(packetId); - outMsg.writeInt16(msg.length() + 4); - outMsg.writeString(msg, msg.length()); + MessageOut outMsg; + outMsg.writeInt16(packetId); + outMsg.writeInt16(msg.length() + 4); + outMsg.writeString(msg, msg.length()); + } } std::string diff --git a/src/gui/chat.h b/src/gui/chat.h index a4547d86..80189665 100644 --- a/src/gui/chat.h +++ b/src/gui/chat.h @@ -130,12 +130,12 @@ class ChatWindow : public Window, public gcn::ActionListener, * @param line Text message. * @parem own Type of message (usually the owner-type). */ - void chat_log(std::string line, int own); + void chatLog(std::string line, int own); /* * Calls original chat_log() after processing the packet. */ - void chat_log(CHATSKILL); + void chatLog(CHATSKILL); /** * Performs action. @@ -177,7 +177,7 @@ class ChatWindow : public Window, public gcn::ActionListener, * chatlog.chat_send("Zaeiru", "Hello to all users on the screen!"); */ void - chat_send(std::string nick, std::string msg); + chatSend(std::string nick, std::string msg); /** Called when key is pressed */ void keyPress(const gcn::Key& key); diff --git a/src/gui/login.cpp b/src/gui/login.cpp index b24c4629..13908bf9 100644 --- a/src/gui/login.cpp +++ b/src/gui/login.cpp @@ -325,9 +325,15 @@ LoginDialog::checkLogin() case 4: errorMessage = "You have been blocked by the GM Team"; break; + case 6: + errorMessage = "You have been banned for 5 minutes"; + break; case 9: errorMessage = "This account is already logged in"; break; + default: + errorMessage = "Unknown error"; + break; } skip(msg.getLength()); state = ERROR_STATE; diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp index 31efab2e..767888f4 100644 --- a/src/gui/trade.cpp +++ b/src/gui/trade.cpp @@ -284,7 +284,7 @@ void TradeWindow::action(const std::string &eventId) } if (myInventory->contains(item)) { - chatWindow->chat_log("Failed adding item. You can not " + chatWindow->chatLog("Failed adding item. You can not " "overlap one kind of item on the window.", BY_SERVER); return; } |